UNPKG

2.45 kBPlain TextView Raw
1export interface Meta {
2 api_version: string;
3 query: {
4 representation: string;
5 };
6 data_returned: number;
7 data_available: number;
8 more_data_available: boolean;
9 implementation?: {
10 maintainer: {
11 email: string;
12 };
13 name: string;
14 source_url: string;
15 version: string;
16 };
17 provider?: {
18 name: string;
19 description: string;
20 prefix: string;
21 },
22 pages?: number;
23 limits?: number[];
24}
25
26export interface Links {
27 base_url: string;
28 first?: {
29 href: string;
30 };
31 next?: {
32 href: string;
33 };
34}
35
36export interface ApiVer {
37 url?: string;
38 version?: string;
39 [key: string]: string;
40}
41
42export interface Api {
43 id: string;
44 type: string;
45 attributes: {
46 api_version: string;
47 available_api_versions: ApiVer | ApiVer[];
48 available_endpoints: string[];
49 entry_types_by_format: Record<string, unknown>;
50 formats: string[];
51 };
52}
53
54export interface Provider {
55 type: string;
56 id: string;
57 attributes: {
58 name: string;
59 description: string;
60 base_url: string | null;
61 homepage?: string | null;
62 link_type?: string;
63 query_limits?: number[];
64 api_version?: string;
65 };
66}
67
68export interface Structure {
69 type: string;
70 id: string;
71 attributes: {
72 chemical_formula_hill?: string;
73 chemical_formula_reduced?: string;
74 _tcod_unreduced_formula?: string;
75 chemical_formula_descriptive?: string;
76 [key: string]: any;
77 };
78}
79
80export interface ProvidersResponse {
81 data: Provider[];
82 meta?: Meta;
83}
84
85export interface InfoResponse {
86 data: Api | Api[];
87 links?: Links;
88 meta?: Meta;
89
90 [key: string]: any;
91}
92
93export interface StructuresResponse {
94 data?: Structure[];
95 links?: Links;
96 meta?: Meta;
97}
98
99export interface LinksResponse {
100 data: Structure[];
101 links?: Links;
102 meta?: Meta;
103}
104
105export interface ResponseError extends Error {
106 response?: any;
107}
108
109export interface ErrorObject {
110 status: string;
111 title: string;
112 detail?: string;
113 length?: string;
114}
115export interface ErrorResponse {
116 errors: ErrorObject;
117 meta: any;
118}
119
120export type ProvidersMap = { [key: string]: Provider; };
121export type ApisMap = { [key: string]: Api[]; };
122
123export type StructuresResult = [Promise<StructuresResponse[]>, Promise<Provider>][];