89 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-07-25 02:09:49 +02:00
import axios, {AxiosRequestConfig, AxiosResponse} from "axios";
2024-07-27 13:42:46 +02:00
type EventAction =
'registration'
| 'reregistration'
| 'last changed'
| 'expiration'
| 'deletion'
| 'reinstantiation'
| 'transfer'
| 'locked'
| 'unlocked'
| 'last update of RDAP database'
| 'registrar expiration'
| 'enum validation expiration'
| string
2024-07-25 02:09:49 +02:00
export interface Event {
2024-07-27 13:42:46 +02:00
action: EventAction
2024-07-25 02:09:49 +02:00
date: string
}
export interface Entity {
handle: string
events: Event[]
roles: string[]
}
export interface Nameserver {
ldhName: string
entities: Entity[]
}
export interface Tld {
tld: string
contractTerminated: boolean
dateOfContractSignature: string
registryOperator: string
delegationDate: string
removalDate: string
specification13: boolean
type: string
}
export interface Domain {
ldhName: string
handle: string
status: string[]
events: Event[]
2024-07-27 15:45:04 +02:00
entities: {
entity: Entity
events: Event[]
roles: string[]
}[]
2024-07-25 02:09:49 +02:00
nameservers: Nameserver[]
tld: Tld
}
export interface User {
email: string
roles: string[]
}
export interface Watchlist {
domains: string[]
triggers: Event[]
}
export async function request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig): Promise<R> {
const axiosConfig: AxiosRequestConfig = {
...config,
baseURL: '/api',
withCredentials: true,
headers: {
...config.headers,
2024-07-26 23:55:12 +02:00
Accept: 'application/ld+json'
2024-07-25 02:09:49 +02:00
}
}
return await axios.request<T, R, D>(axiosConfig)
}
export * from './domain'
export * from './tld'
export * from './user'
export * from './watchlist'