feat: add listBranchesByRepository method to BitbucketCloudClient
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
@@ -95,6 +95,26 @@ export class BitbucketCloudClient {
|
||||
);
|
||||
}
|
||||
|
||||
listBranchesByRepository(
|
||||
repository: string,
|
||||
workspace: string,
|
||||
options?: FilterAndSortOptions & PartialResponseOptions,
|
||||
): WithPagination<Models.PaginatedBranches, Models.Branch> {
|
||||
const workspaceEnc = encodeURIComponent(workspace);
|
||||
|
||||
return new WithPagination(
|
||||
paginationOptions =>
|
||||
this.createUrl(
|
||||
`/repositories/${workspaceEnc}/${repository}/refs/branches`,
|
||||
{
|
||||
...paginationOptions,
|
||||
...options,
|
||||
},
|
||||
),
|
||||
url => this.getTypeMapped(url),
|
||||
);
|
||||
}
|
||||
|
||||
private createUrl(endpoint: string, options?: RequestOptions): URL {
|
||||
const request = new URL(this.config.apiBaseUrl + endpoint);
|
||||
for (const key in options) {
|
||||
|
||||
@@ -275,6 +275,17 @@ export namespace Models {
|
||||
values?: Set<Workspace>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A paginated list of branches.
|
||||
* @public
|
||||
*/
|
||||
export interface PaginatedBranches extends Paginated<Branch> {
|
||||
/**
|
||||
* The values of the current page.
|
||||
*/
|
||||
values?: Set<Branch>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object describing a user's role on resources like commits or pull requests.
|
||||
* @public
|
||||
|
||||
Reference in New Issue
Block a user