//native
type Vercel = {
token: string;
};
/**
* Push data into a user-provided Edge Config
* When the user enabled Edge Config syncing, then this endpoint can be used by the partner to push their configuration data into the relevant Edge Config.
*/
export async function main(
auth: Vercel,
integrationConfigurationId: string,
resourceId: string,
body: { data: {} },
) {
const url = new URL(
`https://api.vercel.com/v1/installations/${integrationConfigurationId}/resources/${resourceId}/experimentation/edge-config`,
);
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.json();
}
Submitted by hugo697 428 days ago