type Bitbucket = {
username: string;
password: string;
};
/**
* Check issue export status
* This endpoint is used to poll for the progress of an issue export
job and return the zip file after the job is complete.
*/
export async function main(
auth: Bitbucket,
repo_name: string,
repo_slug: string,
task_id: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/issues/export/${repo_name}-issues-${task_id}.zip`
);
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;
};
/**
* Check issue export status
* This endpoint is used to poll for the progress of an issue export
job and return the zip file after the job is complete.
*/
export async function main(
auth: Bitbucket,
repo_name: string,
repo_slug: string,
task_id: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/issues/export/${repo_name}-issues-${task_id}.zip`
);
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;
};
/**
* Check issue export status
* This endpoint is used to poll for the progress of an issue export
job and return the zip file after the job is complete.
As long as the job is running, this will return a 202 response
with in the response body a description of the current status.
After the job has been scheduled, but before it starts executing, the endpoint
returns a 202 response with status `ACCEPTED`.
Once it starts running, it is a 202 response with status `STARTED` and progress filled.
After it is finished, it becomes a 200 response with status `SUCCESS` or `FAILURE`.
*/
export async function main(
auth: Bitbucket,
repo_name: string,
repo_slug: string,
task_id: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/issues/export/${repo_name}-issues-${task_id}.zip`
);
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