Skip to content

Commit f59381f

Browse files
authored
Merge pull request #123 from Space-DF/feat/implement-custom-domain-api-sdk
feat: implement custom domain api sdk
2 parents 2621745 + 17c9592 commit f59381f

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

api.doc.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- [Users](#users)
2727
- [Trip](#trip)
2828
- [Telemetry](#telemetry)
29+
- [Custom Domains](#custom-domains)
2930

3031
# Auth
3132

@@ -4466,3 +4467,41 @@ await client.organizations.checkSlugName('danang');
44664467
```
44674468
44684469
</details>
4470+
4471+
---
4472+
4473+
# Custom Domains
4474+
4475+
## Overview
4476+
4477+
The `CustomDomain` class provides methods for managing and resolving custom domains.
4478+
4479+
## Methods
4480+
4481+
<details>
4482+
<summary><strong>resolve</strong></summary>
4483+
4484+
Resolve a custom domain to obtain organization details.
4485+
4486+
**Signature:**
4487+
4488+
```typescript
4489+
resolve(host: string, options?: Core.RequestOptions): Core.APIPromise<ResolveResponse>
4490+
```
4491+
4492+
**Parameters:**
4493+
4494+
- `host` _(string)_: The host name of the custom domain to resolve.
4495+
- `options` _(Core.RequestOptions)_: Additional request options.
4496+
4497+
**Returns:** `Promise<ResolveResponse>`
4498+
4499+
**Example:**
4500+
4501+
```typescript
4502+
const response = await client.customDomains.resolve('custom.example.com');
4503+
console.log(response.org_slug);
4504+
console.log(response.org_name);
4505+
```
4506+
4507+
</details>

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export class SpaceDFSDK extends Core.APIClient {
150150
trip: API.Trip = new API.Trip(this);
151151
organizations: API.Organizations = new API.Organizations(this);
152152
telemetry: API.Telemetry = new API.Telemetry(this);
153+
customDomains: API.CustomDomain = new API.CustomDomain(this);
153154

154155
protected override defaultQuery(): Core.DefaultQuery | undefined {
155156
return this._options.defaultQuery;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { APIResource } from '../../resource';
2+
import * as Core from '../../core';
3+
4+
export class CustomDomain extends APIResource {
5+
resolve(host: string, options?: Core.RequestOptions): Core.APIPromise<ResolveResponse> {
6+
return this._client.get(`/custom-domains/resolve?host=${host}`, {
7+
...options,
8+
});
9+
}
10+
}
11+
12+
interface ResolveResponse {
13+
org_slug: string;
14+
org_name: string;
15+
}

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export * from './console/index';
1010
export * from './device/index';
1111
export * from './organizations/index';
1212
export * from './telemetry/index';
13+
export * from './custom-domains/index';

0 commit comments

Comments
 (0)