Repository navigation
Expand file tree
/
Copy pathutility.ts
More file actions
147 lines (127 loc) · 3.29 KB
/
Copy pathutility.ts
File metadata and controls
147 lines (127 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { RequestOptions } from '../internal/request-options';
export class Utility extends APIResource {
/**
* Queue brand or styleguide data so a later lookup can return sooner.
*
* @example
* ```ts
* const response = await client.utility.prefetch({
* identifier: { domain: 'stripe.com' },
* type: 'brand',
* });
* ```
*/
prefetch(body: UtilityPrefetchParams, options?: RequestOptions): APIPromise<UtilityPrefetchResponse> {
return this._client.post('/utility/prefetch', { body, ...options });
}
}
export interface UtilityPrefetchResponse {
/**
* Unique ID of this request, also in `X-Request-Id`. Include it when contacting
* support.
*/
request_id: string;
/**
* The domain that was queued for prefetching
*/
domain?: string;
/**
* Credits this request used and your remaining balance.
*/
key_metadata?: UtilityPrefetchResponse.KeyMetadata;
/**
* Success message
*/
message?: string;
/**
* Always `ok` on success.
*/
status?: string;
/**
* The type of prefetch that was queued, echoed from the request
*/
type?: 'brand' | 'styleguide';
}
export namespace UtilityPrefetchResponse {
/**
* Credits this request used and your remaining balance.
*/
export interface KeyMetadata {
/**
* Credits charged for this request.
*/
credits_consumed: number;
/**
* Credits remaining for your organization.
*/
credits_remaining: number;
}
}
export interface UtilityPrefetchParams {
/**
* Identifier of the target to prefetch. Provide exactly one of domain or email.
*/
identifier:
| UtilityPrefetchParams.UtilityPrefetchDomainIdentifier
| UtilityPrefetchParams.UtilityPrefetchEmailIdentifier;
/**
* Data to prefetch.
*/
type: 'brand' | 'styleguide';
/**
* Access policy IDs to apply. A URL must pass every policy.
*/
policies?: Array<string>;
/**
* Labels for filtering usage in the dashboard.
*/
tags?: Array<string>;
/**
* Request deadline and what to return when it passes.
*/
timeoutOpts?: UtilityPrefetchParams.TimeoutOpts;
}
export namespace UtilityPrefetchParams {
/**
* Prefetch by domain.
*/
export interface UtilityPrefetchDomainIdentifier {
/**
* Domain, e.g. `stripe.com`.
*/
domain: string;
}
/**
* Prefetch by email. The domain will be extracted and validated.
*/
export interface UtilityPrefetchEmailIdentifier {
/**
* Email address to prefetch data for. The domain will be extracted from the email.
* Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses
* are not allowed.
*/
email: string;
}
/**
* Request deadline and what to return when it passes.
*/
export interface TimeoutOpts {
/**
* Deadline in milliseconds.
*/
milliseconds: number;
/**
* Only "fail" is supported: return 408 at the deadline.
*/
behavior?: 'fail';
}
}
export declare namespace Utility {
export {
type UtilityPrefetchResponse as UtilityPrefetchResponse,
type UtilityPrefetchParams as UtilityPrefetchParams,
};
}