//native
type Replicate = {
token: string;
};
/**
* Delete a deployment
* Delete a deployment
Deployment deletion has some restrictions:
- You can only delete deployments that have been offline and unused for at least 15 minutes.
Example cURL request:
```command
curl -s -X DELETE \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
https://api.replicate.com/v1/deployments/acme/my-app-image-generator
```
The response will be an empty 204, indicating the deployment has been deleted.
*/
export async function main(
auth: Replicate,
deployment_owner: string,
deployment_name: string,
) {
const url = new URL(
`https://api.replicate.com/v1/deployments/${deployment_owner}/${deployment_name}`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 235 days ago