Repository Files

vcs/repository-files@1.0.0
Supported by 1 provider
G

List Files in Directory

List files in a repository on the provided path

Input
Repository
Repository Owner
Directory Path
Reference (branch)
Page
Result
entries
Next page

1.Choose a provider

2.Use ListDirectory with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('vcs/repository-files@1.0.0');

  // Use the profile
  const result = await profile
    .getUseCase('ListDirectory')
    .perform({
      repository: '',
      owner: '',
      path: '',
      reference: '',
      page: ''
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

repository
Repository name or identifier, e.g.: `octocat/hello-worId` (without `owner`), or `hello-worId` (if `owner` is set).
owner
Username of the account owning the repository. Optional if provided in `repository`.
path
Path to the directory for listing. Defaults to the root directory (`/`).
reference
Branch name or commit reference. Defaults to the default branch for the repository (e.g. `main` or `master`).
page
For entries pagination, use value from `nextPage`.

Example

{
  "repository": "",
  "owner": "",
  "path": "",
  "reference": "",
  "page": ""
}

Result (object)

entries
nextPage
For paginating entries. Pass to `page` parameter.

Example

{
  "entries": [
    {
      "name": "",
      "path": "",
      "type": "file",
      "size": 42,
      "rawUrl": ""
    }
  ],
  "nextPage": ""
}

Implementation details

Provider
mock
Use case
ListDirectory
Author
@superface
Source
Verified