//native
type Vercel = {
token: string;
};
/**
* Update Resource Secrets
* This endpoint updates the secrets of a resource.
*/
export async function main(
auth: Vercel,
integrationConfigurationId: string,
resourceId: string,
body: {
secrets: { name: string; value: string; prefix?: string }[];
partial?: false | true;
},
) {
const url = new URL(
`https://api.vercel.com/v1/installations/${integrationConfigurationId}/resources/${resourceId}/secrets`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago