From 17f58d4ab0ec7166cfc4adad2484f4c5633ded75 Mon Sep 17 00:00:00 2001 From: Irene Oppo Date: Wed, 30 Aug 2023 12:10:34 +0200 Subject: [PATCH] Update schema - Destroy Org --- packages/dashboard-client/resources.json | 9 ++++++++ .../src/generated/SchemaTypes.ts | 23 +++++++++++++++++++ .../src/generated/SimpleSchemaTypes.ts | 19 +++++++++++++++ .../src/generated/resources/Organization.ts | 16 +++++++++++-- 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/packages/dashboard-client/resources.json b/packages/dashboard-client/resources.json index 34ed222..01d408e 100644 --- a/packages/dashboard-client/resources.json +++ b/packages/dashboard-client/resources.json @@ -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", diff --git a/packages/dashboard-client/src/generated/SchemaTypes.ts b/packages/dashboard-client/src/generated/SchemaTypes.ts index a930244..d048d68 100644 --- a/packages/dashboard-client/src/generated/SchemaTypes.ts +++ b/packages/dashboard-client/src/generated/SchemaTypes.ts @@ -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. diff --git a/packages/dashboard-client/src/generated/SimpleSchemaTypes.ts b/packages/dashboard-client/src/generated/SimpleSchemaTypes.ts index 192ff41..c166edf 100644 --- a/packages/dashboard-client/src/generated/SimpleSchemaTypes.ts +++ b/packages/dashboard-client/src/generated/SimpleSchemaTypes.ts @@ -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 * diff --git a/packages/dashboard-client/src/generated/resources/Organization.ts b/packages/dashboard-client/src/generated/resources/Organization.ts index 74b68f3..293a07d 100644 --- a/packages/dashboard-client/src/generated/resources/Organization.ts +++ b/packages/dashboard-client/src/generated/resources/Organization.ts @@ -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(body, { + type: 'organization_destroy_request', + attributes: ['otp_code', 'password'], + relationships: [], + }), + ).then((body) => Utils.deserializeResponseBody( body, ), @@ -170,10 +180,12 @@ export default class Organization extends BaseResource { */ rawDestroy( siteId: string, + body: SchemaTypes.OrganizationDestroySchema, ): Promise { return this.client.request({ method: 'DELETE', url: `/organizations/${siteId}`, + body, }); } }