-
Notifications
You must be signed in to change notification settings - Fork 74
/
shopify-node-api.d.ts
87 lines (80 loc) · 3.18 KB
/
shopify-node-api.d.ts
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
declare module "shopify-node-api" {
type UtilRequest = (
endpoint: string,
data: Record<string, string>,
callback: (
error: null | Error,
data: Record<string, unknown>,
headers?: Record<string, string>,
) => void,
) => void
type ResponseSignature = {
hmac: string
signature: string
code: string
nonce: string
}
type BaseConfig = {
shop: string
shopify_api_key: string
backoff_level?: number
verbose?: boolean
verbose_body?: boolean
verbose_status?: boolean
verbose_headers?: boolean
verbose_api_limit?: boolean
}
export type PublicAppConfig = BaseConfig & {
shopify_shared_secret: string
shopify_scope: string
redirect_uri: string
nonce: string
}
export type PrivateAppConfig = BaseConfig & {
access_token: string
}
export default class ShopifyAPI {
public config: PublicAppConfig | PrivateAppConfig
/**
* Configure this instance of the Shopify node api_
* @param {PublicAppConfig | PrivateAppConfig} config to init.
*/
constructor(config: PublicAppConfig | PrivateAppConfig)
buildAuthURL(): string
set_access_token(token: string): void
conditional_console_log(message: unknown): void
is_valid_signature(params: ResponseSignature, non_state?: boolean): boolean
exchange_temporary_token(
query_params: ResponseSignature,
callback: (
error: null | Error,
data: null | Record<"access_token", string>,
) => void,
): void
hostname(): string
port(): 443
makeRequest(
endpoint: string,
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE",
callback: (
error: null | Error,
data: Record<string, unknown>,
headers?: Record<string, string>,
) => void,
retry?: boolean,
): void
get: UtilRequest
post: UtilRequest
put: UtilRequest
delete: UtilRequest
patch: UtilRequest
graphql(
action: Record<string | symbol | number, unknown>,
callback: (
error: null | Error,
data: null | Record<string, unknown>,
) => void,
): void
has_header(response: Response, header: string): boolean
}
}