Skip to content

Commit 40ba092

Browse files
Merge branch 'master' into feat/ciba_rar
2 parents ccab7c2 + dd87d80 commit 40ba092

File tree

3 files changed

+69
-18
lines changed

3 files changed

+69
-18
lines changed

src/management/__generated/managers/custom-domains-manager.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import * as runtime from '../../../lib/runtime.js';
22
import type { InitOverride, ApiResponse } from '../../../lib/runtime.js';
33
import type {
44
CustomDomain,
5+
GetCustomDomains200Response,
56
PatchCustomDomainsByIdRequest,
67
PostCustomDomains201Response,
78
PostCustomDomainsRequest,
89
PostVerify200Response,
910
DeleteCustomDomainsByIdRequest,
11+
GetCustomDomainsRequest,
1012
GetCustomDomainsByIdRequest,
1113
PatchCustomDomainsByIdOperationRequest,
1214
PostVerifyRequest,
@@ -50,11 +52,26 @@ export class CustomDomainsManager extends BaseAPI {
5052
*
5153
* @throws {RequiredError}
5254
*/
53-
async getAll(initOverrides?: InitOverride): Promise<ApiResponse<Array<CustomDomain>>> {
55+
async getAll(
56+
requestParameters: GetCustomDomainsRequest = {},
57+
initOverrides?: InitOverride
58+
): Promise<ApiResponse<GetCustomDomains200Response>> {
59+
const queryParameters = runtime.applyQueryParams(requestParameters, [
60+
{
61+
key: 'take',
62+
config: {},
63+
},
64+
{
65+
key: 'from',
66+
config: {},
67+
},
68+
]);
69+
5470
const response = await this.request(
5571
{
5672
path: `/custom-domains`,
5773
method: 'GET',
74+
query: queryParameters,
5875
},
5976
initOverrides
6077
);

src/management/__generated/models/index.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5386,6 +5386,23 @@ export const GetCredentials200ResponseInnerAlgEnum = {
53865386
export type GetCredentials200ResponseInnerAlgEnum =
53875387
(typeof GetCredentials200ResponseInnerAlgEnum)[keyof typeof GetCredentials200ResponseInnerAlgEnum];
53885388

5389+
/**
5390+
*
5391+
*/
5392+
export type GetCustomDomains200Response = Array<CustomDomain> | GetCustomDomains200ResponseOneOf;
5393+
/**
5394+
*
5395+
*/
5396+
export interface GetCustomDomains200ResponseOneOf {
5397+
/**
5398+
*/
5399+
custom_domains: Array<CustomDomain>;
5400+
/**
5401+
* A cursor to be used as the "from" query parameter for the next page of results.
5402+
*
5403+
*/
5404+
next?: string;
5405+
}
53895406
/**
53905407
*
53915408
*/
@@ -17621,6 +17638,21 @@ export interface DeleteCustomDomainsByIdRequest {
1762117638
*/
1762217639
id: string;
1762317640
}
17641+
/**
17642+
*
17643+
*/
17644+
export interface GetCustomDomainsRequest {
17645+
/**
17646+
* Number of results per page. Defaults to 50.
17647+
*
17648+
*/
17649+
take?: number;
17650+
/**
17651+
* Optional Id from which to start selection.
17652+
*
17653+
*/
17654+
from?: string;
17655+
}
1762417656
/**
1762517657
*
1762617658
*/

test/management/custom-domains.test.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
CustomDomainsManager,
88
PostCustomDomainsRequestTypeEnum,
99
ManagementClient,
10+
ApiResponse,
11+
GetCustomDomains200Response,
1012
} from '../../src/index.js';
1113

1214
describe('CustomDomainsManager', () => {
@@ -49,7 +51,7 @@ describe('CustomDomainsManager', () => {
4951

5052
describe('#getAll', () => {
5153
let request: nock.Scope;
52-
const response: CustomDomain[] = [
54+
const response: Array<CustomDomain> = [
5355
{
5456
custom_domain_id: 'test_domain',
5557
domain: 'Test Domain',
@@ -91,29 +93,29 @@ describe('CustomDomainsManager', () => {
9193
});
9294

9395
it('should pass the body of the response to the "then" handler', (done) => {
94-
customDomains.getAll().then((customDomains) => {
96+
customDomains.getAll().then((customDomains: ApiResponse<GetCustomDomains200Response>) => {
9597
expect(customDomains.data).toBeInstanceOf(Array);
96-
expect(customDomains.data.length).toBe(response.length);
97-
98-
expect(customDomains.data[0].custom_domain_id).toBe(response[0].custom_domain_id);
99-
expect(customDomains.data[0].domain).toBe(response[0].domain);
100-
expect(customDomains.data[0].primary).toBe(response[0].primary);
101-
expect(customDomains.data[0].status).toBe(response[0].status);
102-
expect(customDomains.data[0].type).toBe(response[0].type);
103-
expect(customDomains.data[0].origin_domain_name).toBe(response[0].origin_domain_name);
104-
expect(customDomains.data[0].verification?.methods?.[0].name).toBe(
98+
expect((customDomains.data as Array<CustomDomain>).length).toBe(response.length);
99+
100+
const customDomainData: CustomDomain = (customDomains.data as Array<CustomDomain>)[0];
101+
102+
expect(customDomainData.custom_domain_id).toBe(response[0].custom_domain_id);
103+
expect(customDomainData.domain).toBe(response[0].domain);
104+
expect(customDomainData.primary).toBe(response[0].primary);
105+
expect(customDomainData.status).toBe(response[0].status);
106+
expect(customDomainData.type).toBe(response[0].type);
107+
expect(customDomainData.origin_domain_name).toBe(response[0].origin_domain_name);
108+
expect(customDomainData.verification?.methods?.[0].name).toBe(
105109
response[0].verification?.methods?.[0].name
106110
);
107-
expect(customDomains.data[0].verification?.methods?.[0].record).toBe(
111+
expect(customDomainData.verification?.methods?.[0].record).toBe(
108112
response[0].verification?.methods?.[0].record
109113
);
110-
expect(customDomains.data[0].verification?.methods?.[0].domain).toBe(
114+
expect(customDomainData.verification?.methods?.[0].domain).toBe(
111115
response[0].verification?.methods?.[0].domain
112116
);
113-
expect(customDomains.data[0].custom_client_ip_header).toBe(
114-
response[0].custom_client_ip_header
115-
);
116-
expect(customDomains.data[0].tls_policy).toBe(response[0].tls_policy);
117+
expect(customDomainData.custom_client_ip_header).toBe(response[0].custom_client_ip_header);
118+
expect(customDomainData.tls_policy).toBe(response[0].tls_policy);
117119

118120
done();
119121
});

0 commit comments

Comments
 (0)