type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Set app property
* Sets the value of an app's property. Use this resource to store custom data for your app.
The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The maximum length is 32768 characters.
**[Permissions](#permissions) required:** Only a Connect app whose key matches `addonKey` can make this request.
Additionally, Forge apps can access Connect app properties (stored against the same `app.connect.key`).
*/
export async function main(
auth: Jira,
addonKey: string,
propertyKey: string,
body: { [k: string]: unknown }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/addons/${addonKey}/properties/${propertyKey}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Set app property
* Sets the value of an app's property. Use this resource to store custom data for your app.
The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The maximum length is 32768 characters.
**[Permissions](#permissions) required:** Only a Connect app whose key matches `addonKey` can make this request.
Additionally, Forge apps can access Connect app properties (stored against the same `app.connect.key`).
*/
export async function main(
auth: Jira,
addonKey: string,
propertyKey: string,
body: { [k: string]: unknown }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/addons/${addonKey}/properties/${propertyKey}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 823 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Set app property
* Sets the value of an app's property. Use this resource to store custom data for your app.
The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The maximum length is 32768 characters.
**[Permissions](#permissions) required:** Only a Connect app whose key matches `addonKey` can make this request.
*/
export async function main(
auth: Jira,
addonKey: string,
propertyKey: string,
body: { [k: string]: unknown }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/addons/${addonKey}/properties/${propertyKey}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 948 days ago