Skip to content

Commit 876bf75

Browse files
authored
feat(tem): add support for UpdateDomain (#1412)
1 parent 43cf8b0 commit 876bf75

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

packages/clients/src/api/tem/v1alpha1/api.gen.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
marshalCreateDomainRequest,
1717
marshalCreateEmailRequest,
1818
marshalCreateWebhookRequest,
19+
marshalUpdateDomainRequest,
1920
marshalUpdateWebhookRequest,
2021
unmarshalCreateEmailResponse,
2122
unmarshalDomain,
@@ -54,6 +55,7 @@ import type {
5455
ListWebhooksResponse,
5556
RevokeDomainRequest,
5657
Statistics,
58+
UpdateDomainRequest,
5759
UpdateWebhookRequest,
5860
Webhook,
5961
} from './types.gen'
@@ -355,6 +357,25 @@ export class API extends ParentAPI {
355357
unmarshalDomainLastStatus,
356358
)
357359

360+
/**
361+
* Update a domain. Update a domain auto-configuration.
362+
*
363+
* @param request - The request {@link UpdateDomainRequest}
364+
* @returns A Promise of Domain
365+
*/
366+
updateDomain = (request: Readonly<UpdateDomainRequest>) =>
367+
this.client.fetch<Domain>(
368+
{
369+
body: JSON.stringify(
370+
marshalUpdateDomainRequest(request, this.client.settings),
371+
),
372+
headers: jsonContentHeaders,
373+
method: 'PATCH',
374+
path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}`,
375+
},
376+
unmarshalDomain,
377+
)
378+
358379
/**
359380
* Create a Webhook. Create a new Webhook triggered by a list of event types
360381
* and pushed to a Scaleway SNS ARN.

packages/clients/src/api/tem/v1alpha1/index.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type {
4848
ListWebhooksResponse,
4949
RevokeDomainRequest,
5050
Statistics,
51+
UpdateDomainRequest,
5152
UpdateWebhookRequest,
5253
Webhook,
5354
WebhookEvent,

packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import type {
3030
ListWebhookEventsResponse,
3131
ListWebhooksResponse,
3232
Statistics,
33+
UpdateDomainRequest,
3334
UpdateWebhookRequest,
3435
Webhook,
3536
WebhookEvent,
@@ -453,6 +454,13 @@ export const marshalCreateWebhookRequest = (
453454
sns_arn: request.snsArn,
454455
})
455456

457+
export const marshalUpdateDomainRequest = (
458+
request: UpdateDomainRequest,
459+
defaults: DefaultValues,
460+
): Record<string, unknown> => ({
461+
autoconfig: request.autoconfig,
462+
})
463+
456464
export const marshalUpdateWebhookRequest = (
457465
request: UpdateWebhookRequest,
458466
defaults: DefaultValues,

packages/clients/src/api/tem/v1alpha1/types.gen.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,21 @@ export interface Statistics {
652652
canceledCount: number
653653
}
654654

655+
export type UpdateDomainRequest = {
656+
/**
657+
* Region to target. If none is passed will use default region from the
658+
* config.
659+
*/
660+
region?: Region
661+
/** ID of the domain to update. */
662+
domainId: string
663+
/**
664+
* (Optional) If set to true, activate auto-configuration of the domain's DNS
665+
* zone.
666+
*/
667+
autoconfig?: boolean
668+
}
669+
655670
export type UpdateWebhookRequest = {
656671
/**
657672
* Region to target. If none is passed will use default region from the

0 commit comments

Comments
 (0)