Skip to content

Commit

Permalink
Update schema - Destroy Org
Browse files Browse the repository at this point in the history
  • Loading branch information
souljuse committed Aug 30, 2023
1 parent bfa48ab commit 17f58d4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
9 changes: 9 additions & 0 deletions packages/dashboard-client/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,16 @@
"isEntityId": false,
"relType": "SiteData"
},
"requestBodyType": "OrganizationDestroySchema",
"optionalRequestBody": false,
"requestStructure": {
"type": "organization_destroy_request",
"attributes": [
"otp_code",
"password"
],
"relationships": []
},
"queryParamsRequired": false,
"responseType": "OrganizationDestroyJobSchema",
"name": "destroy",
Expand Down
23 changes: 23 additions & 0 deletions packages/dashboard-client/src/generated/SchemaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,29 @@ export type OrganizationUpdateTargetSchema = {
data: Organization;
};

/**
* This interface was referenced by `Organization`'s JSON-Schema
* via the `destroy.schema` link.
*/
export type OrganizationDestroySchema = {
data: {
/**
* JSON API type field
*/
type: 'organization_destroy_request';
attributes: {
/**
* OTP code
*/
otp_code: string;
/**
* Current password
*/
password: string;
};
};
};

/**
* This interface was referenced by `Organization`'s JSON-Schema
* via the `destroy.targetSchema` link.
Expand Down
19 changes: 19 additions & 0 deletions packages/dashboard-client/src/generated/SimpleSchemaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,25 @@ export type OrganizationUpdateSchema = {
name?: string;
};

/**
* This interface was referenced by `Organization`'s JSON-Schema
* via the `destroy.schema` link.
*/
export type OrganizationDestroySchema = {
/**
* JSON API type field
*/
type?: 'organization_destroy_request';
/**
* OTP code
*/
otp_code: string;
/**
* Current password
*/
password: string;
};

/**
* A project represents a specific DatoCMS administrative area
*
Expand Down
16 changes: 14 additions & 2 deletions packages/dashboard-client/src/generated/resources/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,18 @@ export default class Organization extends BaseResource {
* @throws {ApiError}
* @throws {TimeoutError}
*/
destroy(siteId: string | SimpleSchemaTypes.SiteData) {
return this.rawDestroy(Utils.toId(siteId)).then((body) =>
destroy(
siteId: string | SimpleSchemaTypes.SiteData,
body: SimpleSchemaTypes.OrganizationDestroySchema,
) {
return this.rawDestroy(
Utils.toId(siteId),
Utils.serializeRequestBody<SchemaTypes.OrganizationDestroySchema>(body, {
type: 'organization_destroy_request',
attributes: ['otp_code', 'password'],
relationships: [],
}),
).then((body) =>
Utils.deserializeResponseBody<SimpleSchemaTypes.OrganizationDestroyJobSchema>(
body,
),
Expand All @@ -170,10 +180,12 @@ export default class Organization extends BaseResource {
*/
rawDestroy(
siteId: string,
body: SchemaTypes.OrganizationDestroySchema,
): Promise<SchemaTypes.OrganizationDestroyJobSchema> {
return this.client.request<SchemaTypes.OrganizationDestroyJobSchema>({
method: 'DELETE',
url: `/organizations/${siteId}`,
body,
});
}
}

0 comments on commit 17f58d4

Please sign in to comment.