MunifTanjim / node-bitbucket

Bitbucket API client for Browser and Node.js
https://bitbucketjs.netlify.app
MIT License
106 stars 28 forks source link

Get pull requests for user endpoint #80

Closed Style87 closed 3 years ago

Style87 commented 3 years ago

Is the /2.0/pullrequests/{selected_user} endpoint implemented? After digging into the source the answer is definitely no. So I would like to request an enhancement to include this endpoint as either bitbucket.user.listPullRequests or bitbucket.pullrequests.listForUser (or both with an alias). Both of which would require a selected_user parameter. If I manage to learn enough TS to create this enhancement myself I'll make a PR from my fork.

Style87 commented 3 years ago

@MunifTanjim , I'm confused as to how this resolves the issue. While a value was given in the endpoint-names.json file since no definition exists in the routes.json file the endpoint is still unable to be called. I believe something like the snippet below would have to be added to one of the main keys in routes.json.

    "listPullrequestsForUser": {
      "method": "GET",
      "params": {
        "state": {
          "enum": ["MERGED", "SUPERSEDED", "OPEN", "DECLINED"],
          "type": "string"
        },
        "selected_user": {
          "required": true,
          "type": "string"
        }
      },
      "returns": "PaginatedPullrequests",
      "url": "/pullrequests/{selected_user}"
    }

Apologies if I'm way off base. While I'm a programmer I'm not used to json configuration building into compiled code.

MunifTanjim commented 3 years ago

Hey @Style87 , I'm sorry about this. You are absolutely right. I forgot to run npm run generate:routes after I added that name.

MunifTanjim commented 3 years ago

It should be available in v2.5.1 🎉