type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model config for a project
* Return the branching model configuration for a project.
*/
export async function main(
auth: Bitbucket,
project_key: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model/settings`
);
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 186 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model config for a project
* Return the branching model configuration for a project. The returned
object:
1. Always has a `development` property for the development branch.
2. Always a `production` property for the production branch. The
production branch can be disabled.
3. The `branch_types` contains all the branch types.
This is the raw configuration for the branching model. A client
wishing to see the branching model with its actual current branches may find the
active model API
more useful.
*/
export async function main(
auth: Bitbucket,
project_key: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model/settings`
);
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 265 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model config for a project
* Return the branching model configuration for a project.
*/
export async function main(
auth: Bitbucket,
project_key: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model/settings`
);
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 319 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Get the branching model config for a project
* Return the branching model configuration for a project. The returned
object:
1. Always has a `development` property for the development branch.
2. Always a `production` property for the production branch. The
production branch can be disabled.
3. The `branch_types` contains all the branch types.
This is the raw configuration for the branching model. A client
wishing to see the branching model with its actual current branches may find the
[active model API](#api-workspaces-workspace-projects-project-key-branching-model-get)
more useful.
*/
export async function main(
auth: Bitbucket,
project_key: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model/settings`
);
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 320 days ago