From 0e6499d46f1b4a84df5f01c2b175328b5c8592e1 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 1 Dec 2022 16:55:15 +0000 Subject: [PATCH] feat: update generated APIs --- .../src/api/tem/v1alpha1/marshalling.gen.ts | 50 ++++++++++++------- .../clients/src/api/tem/v1alpha1/types.gen.ts | 9 +++- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts b/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts index cb50dbd90..cce926710 100644 --- a/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts +++ b/packages/clients/src/api/tem/v1alpha1/marshalling.gen.ts @@ -13,6 +13,7 @@ import type { CreateEmailRequestAttachment, CreateEmailResponse, Domain, + DomainStatistics, Email, EmailTry, ListDomainsResponse, @@ -20,36 +21,34 @@ import type { Statistics, } from './types.gen' -const unmarshalEmailTry = (data: unknown) => { +const unmarshalDomainStatistics = (data: unknown) => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'EmailTry' failed as data isn't a dictionary.`, + `Unmarshalling the type 'DomainStatistics' failed as data isn't a dictionary.`, ) } return { - code: data.code, - message: data.message, - rank: data.rank, - triedAt: unmarshalDate(data.tried_at), - } as EmailTry + canceledCount: data.canceled_count, + failedCount: data.failed_count, + sentCount: data.sent_count, + totalCount: data.total_count, + } as DomainStatistics } -export const unmarshalStatistics = (data: unknown) => { +const unmarshalEmailTry = (data: unknown) => { if (!isJSONObject(data)) { throw new TypeError( - `Unmarshalling the type 'Statistics' failed as data isn't a dictionary.`, + `Unmarshalling the type 'EmailTry' failed as data isn't a dictionary.`, ) } return { - canceledCount: data.canceled_count, - failedCount: data.failed_count, - newCount: data.new_count, - sendingCount: data.sending_count, - sentCount: data.sent_count, - totalCount: data.total_count, - } as Statistics + code: data.code, + message: data.message, + rank: data.rank, + triedAt: unmarshalDate(data.tried_at), + } as EmailTry } export const unmarshalDomain = (data: unknown) => { @@ -73,7 +72,7 @@ export const unmarshalDomain = (data: unknown) => { revokedAt: unmarshalDate(data.revoked_at), spfConfig: data.spf_config, statistics: data.statistics - ? unmarshalStatistics(data.statistics) + ? unmarshalDomainStatistics(data.statistics) : undefined, status: data.status, } as Domain @@ -140,6 +139,23 @@ export const unmarshalListEmailsResponse = (data: unknown) => { } as ListEmailsResponse } +export const unmarshalStatistics = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Statistics' failed as data isn't a dictionary.`, + ) + } + + return { + canceledCount: data.canceled_count, + failedCount: data.failed_count, + newCount: data.new_count, + sendingCount: data.sending_count, + sentCount: data.sent_count, + totalCount: data.total_count, + } as Statistics +} + const marshalCreateEmailRequestAddress = ( request: CreateEmailRequestAddress, defaults: DefaultValues, diff --git a/packages/clients/src/api/tem/v1alpha1/types.gen.ts b/packages/clients/src/api/tem/v1alpha1/types.gen.ts index b78500840..92f5b8277 100644 --- a/packages/clients/src/api/tem/v1alpha1/types.gen.ts +++ b/packages/clients/src/api/tem/v1alpha1/types.gen.ts @@ -75,10 +75,17 @@ export interface Domain { /** DKIM public key, as should be recorded in the DNS zone */ dkimConfig: string /** Domain's statistics */ - statistics?: Statistics + statistics?: DomainStatistics region: Region } +export interface DomainStatistics { + totalCount: number + sentCount: number + failedCount: number + canceledCount: number +} + /** Email */ export interface Email { /** Technical ID of the email */