-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.ts
More file actions
116 lines (101 loc) · 3.23 KB
/
Copy pathutility.ts
File metadata and controls
116 lines (101 loc) · 3.23 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
// 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 {
/**
* Signal that you may fetch brand data soon to improve latency. The type field
* selects what to prefetch (currently only 'brand') and identifier carries exactly
* one lookup key: a domain, or an email whose domain is extracted and validated
* (free email providers and disposable email addresses are not allowed).
*/
prefetch(body: UtilityPrefetchParams, options?: RequestOptions): APIPromise<UtilityPrefetchResponse> {
return this._client.post('/utility/prefetch', { body, ...options });
}
}
export interface UtilityPrefetchResponse {
/**
* The domain that was queued for prefetching
*/
domain?: string;
/**
* Metadata about the API key used for the request. Included in every response
* whenever a valid API key is provided, even when the response status is not 200.
*/
key_metadata?: UtilityPrefetchResponse.KeyMetadata;
/**
* Success message
*/
message?: string;
/**
* Status of the response, e.g., 'ok'
*/
status?: string;
/**
* The type of prefetch that was queued, echoed from the request (currently always
* 'brand')
*/
type?: 'brand';
}
export namespace UtilityPrefetchResponse {
/**
* Metadata about the API key used for the request. Included in every response
* whenever a valid API key is provided, even when the response status is not 200.
*/
export interface KeyMetadata {
/**
* The number of credits consumed by this request.
*/
credits_consumed: number;
/**
* The number of credits remaining for your organization after this request.
*/
credits_remaining: number;
}
}
export interface UtilityPrefetchParams {
/**
* Identifier of the brand to prefetch. Provide exactly one of domain or email.
*/
identifier:
| UtilityPrefetchParams.UtilityPrefetchDomainIdentifier
| UtilityPrefetchParams.UtilityPrefetchEmailIdentifier;
/**
* What to prefetch. Currently only 'brand' is supported.
*/
type: 'brand';
/**
* Optional timeout in milliseconds for the request. If the request takes longer
* than this value, it will be aborted with a 408 status code. Maximum allowed
* value is 300000ms (5 minutes).
*/
timeoutMS?: number;
}
export namespace UtilityPrefetchParams {
/**
* Prefetch brand data by domain.
*/
export interface UtilityPrefetchDomainIdentifier {
/**
* Domain name to prefetch brand data for
*/
domain: string;
}
/**
* Prefetch brand data by email. The domain will be extracted and validated.
*/
export interface UtilityPrefetchEmailIdentifier {
/**
* Email address to prefetch brand 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;
}
}
export declare namespace Utility {
export {
type UtilityPrefetchResponse as UtilityPrefetchResponse,
type UtilityPrefetchParams as UtilityPrefetchParams,
};
}