initial
This commit is contained in:
108
ts/peeringdb.types.ts
Normal file
108
ts/peeringdb.types.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Core types for PeeringDB API client
|
||||
*/
|
||||
|
||||
/**
|
||||
* HTTP methods supported by the API
|
||||
*/
|
||||
export type THttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
||||
|
||||
/**
|
||||
* Depth levels for nested object expansion
|
||||
* - 0: No expansion (IDs only)
|
||||
* - 1: Expand to IDs for related objects
|
||||
* - 2: Full object expansion for related objects
|
||||
*/
|
||||
export type TDepth = 0 | 1 | 2;
|
||||
|
||||
/**
|
||||
* Meta information returned by the PeeringDB API
|
||||
*/
|
||||
export interface IPeeringDbMeta {
|
||||
status: 'ok' | 'error';
|
||||
message?: string;
|
||||
generated?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard API response wrapper from PeeringDB
|
||||
*/
|
||||
export interface IPeeringDbResponse<T> {
|
||||
meta: IPeeringDbMeta;
|
||||
data: T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Query options for API requests
|
||||
*/
|
||||
export interface IQueryOptions {
|
||||
/** Limit the number of results */
|
||||
limit?: number;
|
||||
|
||||
/** Skip/offset for pagination */
|
||||
skip?: number;
|
||||
|
||||
/** Comma-separated list of fields to return */
|
||||
fields?: string;
|
||||
|
||||
/** Depth of nested object expansion (0, 1, or 2) */
|
||||
depth?: TDepth;
|
||||
|
||||
/** Unix timestamp - only return objects updated since this time */
|
||||
since?: number;
|
||||
|
||||
/** Auto-paginate through all results (default: false) */
|
||||
autoPaginate?: boolean;
|
||||
|
||||
/** Additional query parameters (field filters, etc.) */
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Field filter operators for string fields
|
||||
*/
|
||||
export interface IStringFilters {
|
||||
/** Field contains value */
|
||||
__contains?: string;
|
||||
|
||||
/** Field starts with value */
|
||||
__startswith?: string;
|
||||
|
||||
/** Field is in list of values */
|
||||
__in?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Field filter operators for number fields
|
||||
*/
|
||||
export interface INumberFilters {
|
||||
/** Field is less than value */
|
||||
__lt?: number;
|
||||
|
||||
/** Field is less than or equal to value */
|
||||
__lte?: number;
|
||||
|
||||
/** Field is greater than value */
|
||||
__gt?: number;
|
||||
|
||||
/** Field is greater than or equal to value */
|
||||
__gte?: number;
|
||||
|
||||
/** Field is in list of values */
|
||||
__in?: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Base fields present in all PeeringDB objects
|
||||
*/
|
||||
export interface IPeeringDbBaseObject {
|
||||
id: number;
|
||||
status: string;
|
||||
created: string;
|
||||
updated: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common status values for PeeringDB objects
|
||||
*/
|
||||
export type TStatus = 'ok' | 'pending' | 'deleted';
|
||||
Reference in New Issue
Block a user