Skip to content

Commit 11cd4d2

Browse files
authored
Merge branch 'main' into v1.6065.0
2 parents e3fa93e + 5215582 commit 11cd4d2

File tree

7 files changed

+2300
-5466
lines changed

7 files changed

+2300
-5466
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"cross-fetch": "4.1.0",
5858
"cz-conventional-changelog": "3.3.0",
5959
"esbuild-plugin-browserslist": "0.15.0",
60-
"eslint": "9.18.0",
60+
"eslint": "9.19.0",
6161
"eslint-plugin-tsdoc": "0.4.0",
6262
"husky": "9.1.7",
6363
"jsdom": "25.0.1",

packages/clients/src/api/webhosting/v1/api.gen.ts

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
waitForResource,
99
} from '../../../bridge'
1010
import type { Region as ScwRegion, WaitForOptions } from '../../../bridge'
11-
import { HOSTING_TRANSIENT_STATUSES } from './content.gen'
11+
import {
12+
DOMAIN_TRANSIENT_STATUSES,
13+
HOSTING_TRANSIENT_STATUSES,
14+
} from './content.gen'
1215
import {
1316
marshalDatabaseApiAssignDatabaseUserRequest,
1417
marshalDatabaseApiChangeDatabaseUserPasswordRequest,
@@ -28,6 +31,7 @@ import {
2831
unmarshalDatabase,
2932
unmarshalDatabaseUser,
3033
unmarshalDnsRecords,
34+
unmarshalDomain,
3135
unmarshalFtpAccount,
3236
unmarshalHosting,
3337
unmarshalListControlPanelsResponse,
@@ -41,6 +45,7 @@ import {
4145
unmarshalMailAccount,
4246
unmarshalResetHostingPasswordResponse,
4347
unmarshalResourceSummary,
48+
unmarshalSearchDomainsResponse,
4449
unmarshalSession,
4550
} from './marshalling.gen'
4651
import type {
@@ -61,8 +66,11 @@ import type {
6166
DatabaseUser,
6267
DnsApiCheckUserOwnsDomainRequest,
6368
DnsApiGetDomainDnsRecordsRequest,
69+
DnsApiGetDomainRequest,
70+
DnsApiSearchDomainsRequest,
6471
DnsApiSyncDomainDnsRecordsRequest,
6572
DnsRecords,
73+
Domain,
6674
FtpAccount,
6775
FtpAccountApiChangeFtpAccountPasswordRequest,
6876
FtpAccountApiCreateFtpAccountRequest,
@@ -93,6 +101,7 @@ import type {
93101
OfferApiListOffersRequest,
94102
ResetHostingPasswordResponse,
95103
ResourceSummary,
104+
SearchDomainsResponse,
96105
Session,
97106
WebsiteApiListWebsitesRequest,
98107
} from './types.gen'
@@ -427,7 +436,8 @@ export class DnsAPI extends ParentAPI {
427436
)
428437

429438
/**
430-
* "Check whether you own this domain or not.".
439+
* Check whether you own this domain or not.. Check whether you own this
440+
* domain or not.
431441
*
432442
* @param request - The request {@link DnsApiCheckUserOwnsDomainRequest}
433443
* @returns A Promise of CheckUserOwnsDomainResponse
@@ -449,7 +459,8 @@ export class DnsAPI extends ParentAPI {
449459
)
450460

451461
/**
452-
* "Synchronize your DNS records on the Elements Console and on cPanel.".
462+
* Synchronize your DNS records on the Elements Console and on cPanel..
463+
* Synchronize your DNS records on the Elements Console and on cPanel.
453464
*
454465
* @param request - The request {@link DnsApiSyncDomainDnsRecordsRequest}
455466
* @returns A Promise of DnsRecords
@@ -471,6 +482,71 @@ export class DnsAPI extends ParentAPI {
471482
},
472483
unmarshalDnsRecords,
473484
)
485+
486+
/**
487+
* Search for available domains based on domain name.. Search for available
488+
* domains based on domain name.
489+
*
490+
* @param request - The request {@link DnsApiSearchDomainsRequest}
491+
* @returns A Promise of SearchDomainsResponse
492+
*/
493+
searchDomains = (request: Readonly<DnsApiSearchDomainsRequest>) =>
494+
this.client.fetch<SearchDomainsResponse>(
495+
{
496+
method: 'GET',
497+
path: `/webhosting/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/search-domains`,
498+
urlParams: urlParams(
499+
['domain_name', request.domainName],
500+
[
501+
'project_id',
502+
request.projectId ?? this.client.settings.defaultProjectId,
503+
],
504+
),
505+
},
506+
unmarshalSearchDomainsResponse,
507+
)
508+
509+
/**
510+
* Retrieve detailed information about a specific domain, including its
511+
* status, DNS configuration, and ownership.. Retrieve detailed information
512+
* about a specific domain, including its status, DNS configuration, and
513+
* ownership.
514+
*
515+
* @param request - The request {@link DnsApiGetDomainRequest}
516+
* @returns A Promise of Domain
517+
*/
518+
getDomain = (request: Readonly<DnsApiGetDomainRequest>) =>
519+
this.client.fetch<Domain>(
520+
{
521+
method: 'GET',
522+
path: `/webhosting/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainName', request.domainName)}`,
523+
urlParams: urlParams([
524+
'project_id',
525+
request.projectId ?? this.client.settings.defaultProjectId,
526+
]),
527+
},
528+
unmarshalDomain,
529+
)
530+
531+
/**
532+
* Waits for {@link Domain} to be in a final state.
533+
*
534+
* @param request - The request {@link DnsApiGetDomainRequest}
535+
* @param options - The waiting options
536+
* @returns A Promise of Domain
537+
*/
538+
waitForDomain = (
539+
request: Readonly<DnsApiGetDomainRequest>,
540+
options?: Readonly<WaitForOptions<Domain>>,
541+
) =>
542+
waitForResource(
543+
options?.stop ??
544+
(res =>
545+
Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))),
546+
this.getDomain,
547+
request,
548+
options,
549+
)
474550
}
475551

476552
/**

packages/clients/src/api/webhosting/v1/content.gen.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
3-
import type { HostingStatus, HostingSummaryStatus } from './types.gen'
3+
import type {
4+
DomainAvailabilityStatus,
5+
DomainStatus,
6+
HostingStatus,
7+
HostingSummaryStatus,
8+
} from './types.gen'
9+
10+
/** Lists transient statutes of the enum {@link DomainAvailabilityStatus}. */
11+
export const DOMAIN_AVAILABILITY_TRANSIENT_STATUSES: DomainAvailabilityStatus[] =
12+
['validating']
13+
14+
/** Lists transient statutes of the enum {@link DomainStatus}. */
15+
export const DOMAIN_TRANSIENT_STATUSES: DomainStatus[] = ['validating']
416

517
/** Lists transient statutes of the enum {@link HostingStatus}. */
618
export const HOSTING_TRANSIENT_STATUSES: HostingStatus[] = [

packages/clients/src/api/webhosting/v1/marshalling.gen.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import type {
2424
DnsApiSyncDomainDnsRecordsRequest,
2525
DnsRecord,
2626
DnsRecords,
27+
Domain,
28+
DomainAvailability,
2729
FtpAccount,
2830
FtpAccountApiChangeFtpAccountPasswordRequest,
2931
FtpAccountApiCreateFtpAccountRequest,
@@ -53,6 +55,7 @@ import type {
5355
PlatformControlPanelUrls,
5456
ResetHostingPasswordResponse,
5557
ResourceSummary,
58+
SearchDomainsResponse,
5659
Session,
5760
SyncDomainDnsRecordsRequestRecord,
5861
Website,
@@ -170,6 +173,22 @@ export const unmarshalDnsRecords = (data: unknown): DnsRecords => {
170173
} as DnsRecords
171174
}
172175

176+
export const unmarshalDomain = (data: unknown): Domain => {
177+
if (!isJSONObject(data)) {
178+
throw new TypeError(
179+
`Unmarshalling the type 'Domain' failed as data isn't a dictionary.`,
180+
)
181+
}
182+
183+
return {
184+
availableActions: data.available_actions,
185+
availableDnsActions: data.available_dns_actions,
186+
name: data.name,
187+
owner: data.owner,
188+
status: data.status,
189+
} as Domain
190+
}
191+
173192
const unmarshalPlatformControlPanelUrls = (
174193
data: unknown,
175194
): PlatformControlPanelUrls => {
@@ -500,6 +519,40 @@ export const unmarshalResourceSummary = (data: unknown): ResourceSummary => {
500519
} as ResourceSummary
501520
}
502521

522+
const unmarshalDomainAvailability = (data: unknown): DomainAvailability => {
523+
if (!isJSONObject(data)) {
524+
throw new TypeError(
525+
`Unmarshalling the type 'DomainAvailability' failed as data isn't a dictionary.`,
526+
)
527+
}
528+
529+
return {
530+
availableActions: data.available_actions,
531+
canCreateHosting: data.can_create_hosting,
532+
name: data.name,
533+
price: data.price ? unmarshalMoney(data.price) : undefined,
534+
status: data.status,
535+
zoneName: data.zone_name,
536+
} as DomainAvailability
537+
}
538+
539+
export const unmarshalSearchDomainsResponse = (
540+
data: unknown,
541+
): SearchDomainsResponse => {
542+
if (!isJSONObject(data)) {
543+
throw new TypeError(
544+
`Unmarshalling the type 'SearchDomainsResponse' failed as data isn't a dictionary.`,
545+
)
546+
}
547+
548+
return {
549+
domainsAvailable: unmarshalArrayOfObject(
550+
data.domains_available,
551+
unmarshalDomainAvailability,
552+
),
553+
} as SearchDomainsResponse
554+
}
555+
503556
export const unmarshalSession = (data: unknown): Session => {
504557
if (!isJSONObject(data)) {
505558
throw new TypeError(
@@ -593,6 +646,7 @@ export const marshalDnsApiSyncDomainDnsRecordsRequest = (
593646
: undefined,
594647
update_all_records: request.updateAllRecords,
595648
update_mail_records: request.updateMailRecords,
649+
update_nameservers: request.updateNameservers,
596650
update_web_records: request.updateWebRecords,
597651
})
598652

0 commit comments

Comments
 (0)