type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model for a repository
* Return the branching model as applied to the repository.
*/
export async function main(
auth: Bitbucket,
repo_slug: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/branching-model`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 375 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model for a repository
* Return the branching model as applied to the repository.
*/
export async function main(
auth: Bitbucket,
repo_slug: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/branching-model`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 935 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model for a repository
* Return the branching model as applied to the repository. This view is
read-only. The branching model settings can be changed using the
[settings](#api-repositories-workspace-repo-slug-branching-model-settings-get) API.
The returned object:
1. Always has a `development` property. `development.branch` contains
the actual repository branch object that is considered to be the
`development` branch. `development.branch` will not be present
if it does not exist.
2. Might have a `production` property. `production` will not
be present when `production` is disabled.
`production.branch` contains the actual branch object that is
considered to be the `production` branch. `production.branch` will
not be present if it does not exist.
3. Always has a `branch_types` array which contains all enabled branch
types.
*/
export async function main(
auth: Bitbucket,
repo_slug: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/branching-model`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 935 days ago