type Bitbucket = {
username: string;
password: string;
};
/**
* Import issues
* A POST request to this endpoint will import the zip file given by the archive parameter into the repository. All
existing issues will be deleted and replaced by the contents of the imported zip file.
Imports are done through a multipart/form-data POST. There is one valid and required form field, with the name
"archive," which needs to be a file field:
```
$ curl -u -X POST -F archive=@/path/to/file.zip https://api.bitbucket.org/2.0/repositories///issues/import
```
*/
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}/issues/import`
);
const response = await fetch(url, {
method: "POST",
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 154 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Import issues
* A POST request to this endpoint will import the zip file given by the archive parameter into 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}/issues/import`
);
const response = await fetch(url, {
method: "POST",
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 208 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Import issues
* A POST request to this endpoint will import the zip file given by the archive parameter into the repository. All
existing issues will be deleted and replaced by the contents of the imported zip file.
Imports are done through a multipart/form-data POST. There is one valid and required form field, with the name
"archive," which needs to be a file field:
```
$ curl -u <username> -X POST -F archive=@/path/to/file.zip https://api.bitbucket.org/2.0/repositories/<owner_username>/<repo_slug>/issues/import
```
*/
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}/issues/import`
);
const response = await fetch(url, {
method: "POST",
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 209 days ago