Superface

Pull Requests

vcs/pull-requests@2.0.1
3 providers

PullRequests

Get pull requests of the specified repository.

Input
Owner
Repo
Result
pullRequests

1.Choose a provider

2.Use PullRequests 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/pull-requests@2.0.1');

  // Use the profile
  const result = await profile
    .getUseCase('PullRequests')
    .perform({
      owner: 'superfaceai',
      repo: 'one-sdk-js'
    }, {
      provider: 'mock'
    });

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

run();

Structure details

Input (object)

owner
Owner of the repository
repo
Repository name

Example

{
  "owner": "superfaceai",
  "repo": "one-sdk-js"
}

Result (object)

pullRequests
title
Title of pull request
id
Pull request Id
url
Web url of pull request
sha
Pull request sha

Example

{
  "pullRequests": [
    {
      "title": "feat: add magic abilities",
      "id": 123456789,
      "url": "https://api.github.com/repos/superfaceai/one-sdk-js/pulls/173",
      "sha": "4z123ad91519dde1d8da2f141237b5760afd9bed"
    }
  ]
}

Implementation details

Provider
mock
Use case
PullRequests
Author
@superface
Source
Verified