-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from zicklag/patch-1
feat: add typescript definition file.
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
declare module 'namedrop-js' { | ||
export const SCOPE_HOSTS: string; | ||
export const SCOPE_MAIL: string; | ||
export const SCOPE_ACME: string; | ||
export const SCOPE_ATPROTO_HANDLE: string; | ||
export const validScopes: string[]; | ||
|
||
export class Client { | ||
constructor(params: { token: string; permission: string; domain: string; host: string }); | ||
|
||
get domain(): string; | ||
get host(): string; | ||
get token(): string; | ||
get permissions(): string; | ||
|
||
getRecords(opt?: { | ||
domain?: string; | ||
host?: string; | ||
records: []; | ||
}): Promise<NamedropRecord[]>; | ||
createRecords(opt: { | ||
domain: string; | ||
host: string; | ||
records: NamedropRecord[]; | ||
}): Promise<void>; | ||
setRecords(opt: { | ||
domain: string; | ||
host: string; | ||
records: NamedropRecord[]; | ||
}): Promise<void>; | ||
deleteRecords(opt: { | ||
domain: string; | ||
host: string; | ||
records: NamedropRecord[]; | ||
}): Promise<void>; | ||
} | ||
|
||
export function setApiUri(uri: string): void; | ||
export function checkAuthFlow(): Promise<Client>; | ||
export function startAuthFlow(req: { scopes: string[] }): Promise<void>; | ||
|
||
export type NamedropScope = | ||
| 'namedrop-hosts' | ||
| 'namedrop-mail' | ||
| 'namedrop-acme' | ||
| 'namedrop-atproto-handle'; | ||
|
||
export type NamedropRecord = { | ||
type: 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'MX' | 'NS' | 'SRV' | 'ANAME'; | ||
value?: string; | ||
domain?: string; | ||
/** | ||
* May contain the `{{host}}` placeholder to substitute for the domain host. | ||
* | ||
* For example you can set a subdomain host with: | ||
* | ||
* example.{{host}} | ||
*/ | ||
host?: string; | ||
ttl?: number; | ||
priority?: number; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters