type Bitbucket = {
username: string;
password: string;
};
/**
* List subscribable webhook types
* Returns a paginated list of all valid webhook events for the
specified entity.
*/
export async function main(
auth: Bitbucket,
subject_type: "repository" | "workspace"
) {
const url = new URL(
`https://api.bitbucket.org/2.0/hook_events/${subject_type}`
);
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;
};
/**
* List subscribable webhook types
* Returns a paginated list of all valid webhook events for the
specified entity.
*/
export async function main(
auth: Bitbucket,
subject_type: "repository" | "workspace"
) {
const url = new URL(
`https://api.bitbucket.org/2.0/hook_events/${subject_type}`
);
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;
};
/**
* List subscribable webhook types
* Returns a paginated list of all valid webhook events for the
specified entity.
**The team and user webhooks are deprecated, and you should use workspace instead.
For more information, see [the announcement](https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-teams-deprecation/).**
This is public data that does not require any scopes or authentication.
NOTE: The example response is a truncated response object for the `workspace` `subject_type`.
We return the same structure for the other `subject_type` objects.
*/
export async function main(
auth: Bitbucket,
subject_type: "repository" | "workspace"
) {
const url = new URL(
`https://api.bitbucket.org/2.0/hook_events/${subject_type}`
);
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