Superface

Repository Files

vcs/repository-files@1.0.0
1 provider

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

Below instructions are for our Node.js SDK. Use OneService for other languages.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });

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
name
File name
path
File path
type
Whether the entry is a directory or a file
size
Empty for directories.
rawUrl
Empty for directories.
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