MunifTanjim / node-bitbucket

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

fields support #41

Closed RafalSkorka closed 4 years ago

RafalSkorka commented 4 years ago

Bitbucket allows to specify fields as a query parameter and that limits the response fields. However, this option is not available here. See the docs: https://developer.atlassian.com/bitbucket/api/2/reference/meta/partial-response eg. if I add

        "fields": {
          "in": "query",
          "type": "string"
        },

to routes.json -> listTags then it properly works by adding the fields parameter using a call like:

        let {
            data,
            headers
        } = await bitbucket.refs.listTags({
            repo_slug: 'myrepo',
            username: 'myteam',
            pagelen: 20,
            sort: "-name",
            fields: "values.name,values.target.hash"
        });

Could you add "fields" parameter to queries?

MunifTanjim commented 4 years ago

@RafalSkorka Would you be willing to try the beta version?

docs: https://next--bitbucketjs.netlify.com/ npm: https://www.npmjs.com/package/bitbucket/v/next source: https://github.com/MunifTanjim/node-bitbucket/tree/next

It already has that feature.

It's also has a 20% smaller bundle size :smiley:

RafalSkorka commented 4 years ago

Seems to be working fine in 2.0. Thanks!

MunifTanjim commented 4 years ago

bitbucket@2.0.0 is published :tada: