Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for repeatable parameter for list pull request #74

Open
chalenge opened this issue Oct 6, 2020 · 1 comment
Open

Support for repeatable parameter for list pull request #74

chalenge opened this issue Oct 6, 2020 · 1 comment

Comments

@chalenge
Copy link

chalenge commented Oct 6, 2020

The state parameter in pullrequests - list can be repeated such as /repositories/{workspace}/{repo_slug}/pullrequests?state=MERGED&state=OPEN

Is there a way this can be supported using in the client. Currently only specifying one parameter is supported

@MunifTanjim
Copy link
Owner

See the discussion on #44 to know about why this isn't properly supported.
(TLDR: Bitbucket's API Specification: https://api.bitbucket.org/swagger.json is incorrect)

With that said, here's a dirty hack that you can do to make this work. (requires: v2.4.2+)

// @ts-ignore
bitbucket.repositories.listPullRequests = bitbucket.repositories.listPullRequests.defaults(
  {
    request: {
      validate: {
        state: {
          enum: undefined,
          type: 'array',
          items: {
            enum: ['OPEN', 'DECLINED', 'MERGED', 'SUPERSEDED'],
            type: 'string',
          },
        },
      },
    },
  }
)

bitbucket.repositories.listPullRequests({
  workspace: '<workspace>',
  repo_slug: '<repo_slug>',
  // @ts-ignore
  state: ['OPEN', 'DECLINED'],
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants