Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/dashboard-client/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,27 @@
"responseType": "AccountConvertToOrganizationJobSchema",
"name": "convertToOrganization",
"rawName": "rawConvertToOrganization"
},
{
"returnsItem": false,
"requestBodyRequiresItem": false,
"offersNestedItemsOptionInQueryParams": false,
"rel": "confirm_email_change",
"urlTemplate": "/account/confirm-email-change",
"method": "POST",
"comment": "Confirm email change",
"urlPlaceholders": [],
"requestBodyType": "AccountConfirmEmailChangeSchema",
"optionalRequestBody": false,
"requestStructure": {
"type": "account",
"attributes": ["token"],
"relationships": []
},
"queryParamsRequired": false,
"responseType": "AccountConfirmEmailChangeTargetSchema",
"name": "confirmEmailChange",
"rawName": "rawConfirmEmailChange"
}
],
"namespace": "account",
Expand Down
20 changes: 20 additions & 0 deletions packages/dashboard-client/src/generated/ApiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,13 +946,18 @@ export type Account = {
* Whether 2-factor authentication is active for this account or not
*/
is_2fa_active: boolean;
/**
* Pending email address awaiting confirmation (only present if confirmation token hasn't expired)
*/
pending_email?: string | null;
active_subscription: null | PerOwnerPricingSubscriptionData;
billing_profile: null | PerOwnerPricingBillingProfileData;
default_organization: null | OrganizationData;
};
export type AccountDestroyJobSchema = Account;
export type AccountSelfTargetSchema = Account;
export type AccountDeactivate_2FaTargetSchema = Account;
export type AccountConfirmEmailChangeTargetSchema = Account;
/**
* JSON API data
*
Expand Down Expand Up @@ -1014,6 +1019,10 @@ export type AccountAttributes = {
* Whether 2-factor authentication is active for this account or not
*/
is_2fa_active: boolean;
/**
* Pending email address awaiting confirmation (only present if confirmation token hasn't expired)
*/
pending_email?: string | null;
};
/**
* JSON API links
Expand Down Expand Up @@ -1347,6 +1356,17 @@ export type OrganizationDestroySchema = {
*/
password: string;
};
/**
* This interface was referenced by `Account`'s JSON-Schema
* via the `confirm_email_change.schema` link.
*/
export type AccountConfirmEmailChangeSchema = {
type?: AccountType;
/**
* Email confirmation token
*/
token: string;
};
/**
* A project represents a specific DatoCMS administrative area
*
Expand Down
26 changes: 26 additions & 0 deletions packages/dashboard-client/src/generated/RawApiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,10 @@ export type AccountAttributes = {
* Whether 2-factor authentication is active for this account or not
*/
is_2fa_active: boolean;
/**
* Pending email address awaiting confirmation (only present if confirmation token hasn't expired)
*/
pending_email?: string | null;
};
/**
* JSON API links
Expand Down Expand Up @@ -2182,6 +2186,28 @@ export type OrganizationDestroyTargetSchema = {
export type OrganizationDestroyJobSchema = {
data: Organization;
};
/**
* This interface was referenced by `Account`'s JSON-Schema
* via the `confirm_email_change.schema` link.
*/
export type AccountConfirmEmailChangeSchema = {
data: {
type: AccountType;
attributes: {
/**
* Email confirmation token
*/
token: string;
};
};
};
/**
* This interface was referenced by `Account`'s JSON-Schema
* via the `confirm_email_change.targetSchema` link.
*/
export type AccountConfirmEmailChangeTargetSchema = {
data: Account;
};
/**
* A per-project subscription record
*
Expand Down
41 changes: 41 additions & 0 deletions packages/dashboard-client/src/generated/resources/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,45 @@ export default class Account extends BaseResource {
},
);
}

/**
* Confirm email change
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
confirmEmailChange(body: ApiTypes.AccountConfirmEmailChangeSchema) {
return this.rawConfirmEmailChange(
Utils.serializeRequestBody<RawApiTypes.AccountConfirmEmailChangeSchema>(
body,
{
type: 'account',
attributes: ['token'],
relationships: [],
},
),
).then((body) =>
Utils.deserializeResponseBody<ApiTypes.AccountConfirmEmailChangeTargetSchema>(
body,
),
);
}

/**
* Confirm email change
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
rawConfirmEmailChange(
body: RawApiTypes.AccountConfirmEmailChangeSchema,
): Promise<RawApiTypes.AccountConfirmEmailChangeTargetSchema> {
return this.client.request<RawApiTypes.AccountConfirmEmailChangeTargetSchema>(
{
method: 'POST',
url: '/account/confirm-email-change',
body,
},
);
}
}