@clickup/rest-client 2.10.292

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.eslintrc.base.js +412 -0
  2. package/.eslintrc.js +5 -0
  3. package/LICENSE +22 -0
  4. package/README.md +121 -0
  5. package/dist/RestClient.d.ts +154 -0
  6. package/dist/RestClient.d.ts.map +1 -0
  7. package/dist/RestClient.js +361 -0
  8. package/dist/RestClient.js.map +1 -0
  9. package/dist/RestOptions.d.ts +143 -0
  10. package/dist/RestOptions.d.ts.map +1 -0
  11. package/dist/RestOptions.js +63 -0
  12. package/dist/RestOptions.js.map +1 -0
  13. package/dist/RestRequest.d.ts +81 -0
  14. package/dist/RestRequest.d.ts.map +1 -0
  15. package/dist/RestRequest.js +367 -0
  16. package/dist/RestRequest.js.map +1 -0
  17. package/dist/RestResponse.d.ts +37 -0
  18. package/dist/RestResponse.d.ts.map +1 -0
  19. package/dist/RestResponse.js +56 -0
  20. package/dist/RestResponse.js.map +1 -0
  21. package/dist/RestStream.d.ts +29 -0
  22. package/dist/RestStream.d.ts.map +1 -0
  23. package/dist/RestStream.js +85 -0
  24. package/dist/RestStream.js.map +1 -0
  25. package/dist/errors/RestContentSizeOverLimitError.d.ts +4 -0
  26. package/dist/errors/RestContentSizeOverLimitError.d.ts.map +1 -0
  27. package/dist/errors/RestContentSizeOverLimitError.js +10 -0
  28. package/dist/errors/RestContentSizeOverLimitError.js.map +1 -0
  29. package/dist/errors/RestError.d.ts +4 -0
  30. package/dist/errors/RestError.d.ts.map +1 -0
  31. package/dist/errors/RestError.js +10 -0
  32. package/dist/errors/RestError.js.map +1 -0
  33. package/dist/errors/RestRateLimitError.d.ts +7 -0
  34. package/dist/errors/RestRateLimitError.d.ts.map +1 -0
  35. package/dist/errors/RestRateLimitError.js +14 -0
  36. package/dist/errors/RestRateLimitError.js.map +1 -0
  37. package/dist/errors/RestResponseError.d.ts +13 -0
  38. package/dist/errors/RestResponseError.d.ts.map +1 -0
  39. package/dist/errors/RestResponseError.js +32 -0
  40. package/dist/errors/RestResponseError.js.map +1 -0
  41. package/dist/errors/RestRetriableError.d.ts +7 -0
  42. package/dist/errors/RestRetriableError.d.ts.map +1 -0
  43. package/dist/errors/RestRetriableError.js +14 -0
  44. package/dist/errors/RestRetriableError.js.map +1 -0
  45. package/dist/errors/RestTimeoutError.d.ts +4 -0
  46. package/dist/errors/RestTimeoutError.d.ts.map +1 -0
  47. package/dist/errors/RestTimeoutError.js +10 -0
  48. package/dist/errors/RestTimeoutError.js.map +1 -0
  49. package/dist/errors/RestTokenInvalidError.d.ts +7 -0
  50. package/dist/errors/RestTokenInvalidError.d.ts.map +1 -0
  51. package/dist/errors/RestTokenInvalidError.js +14 -0
  52. package/dist/errors/RestTokenInvalidError.js.map +1 -0
  53. package/dist/helpers/depaginate.d.ts +10 -0
  54. package/dist/helpers/depaginate.d.ts.map +1 -0
  55. package/dist/helpers/depaginate.js +32 -0
  56. package/dist/helpers/depaginate.js.map +1 -0
  57. package/dist/index.d.ts +20 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +42 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/internal/RestFetchReader.d.ts +72 -0
  62. package/dist/internal/RestFetchReader.d.ts.map +1 -0
  63. package/dist/internal/RestFetchReader.js +192 -0
  64. package/dist/internal/RestFetchReader.js.map +1 -0
  65. package/dist/internal/RestRangeUploader.d.ts +24 -0
  66. package/dist/internal/RestRangeUploader.d.ts.map +1 -0
  67. package/dist/internal/RestRangeUploader.js +54 -0
  68. package/dist/internal/RestRangeUploader.js.map +1 -0
  69. package/dist/internal/calcRetryDelay.d.ts +8 -0
  70. package/dist/internal/calcRetryDelay.d.ts.map +1 -0
  71. package/dist/internal/calcRetryDelay.js +44 -0
  72. package/dist/internal/calcRetryDelay.js.map +1 -0
  73. package/dist/internal/inspectPossibleJSON.d.ts +6 -0
  74. package/dist/internal/inspectPossibleJSON.d.ts.map +1 -0
  75. package/dist/internal/inspectPossibleJSON.js +53 -0
  76. package/dist/internal/inspectPossibleJSON.js.map +1 -0
  77. package/dist/internal/prependNewlineIfMultiline.d.ts +2 -0
  78. package/dist/internal/prependNewlineIfMultiline.d.ts.map +1 -0
  79. package/dist/internal/prependNewlineIfMultiline.js +7 -0
  80. package/dist/internal/prependNewlineIfMultiline.js.map +1 -0
  81. package/dist/internal/substituteParams.d.ts +7 -0
  82. package/dist/internal/substituteParams.d.ts.map +1 -0
  83. package/dist/internal/substituteParams.js +24 -0
  84. package/dist/internal/substituteParams.js.map +1 -0
  85. package/dist/internal/throwIfErrorResponse.d.ts +11 -0
  86. package/dist/internal/throwIfErrorResponse.d.ts.map +1 -0
  87. package/dist/internal/throwIfErrorResponse.js +60 -0
  88. package/dist/internal/throwIfErrorResponse.js.map +1 -0
  89. package/dist/internal/toFloatMs.d.ts +2 -0
  90. package/dist/internal/toFloatMs.d.ts.map +1 -0
  91. package/dist/internal/toFloatMs.js +7 -0
  92. package/dist/internal/toFloatMs.js.map +1 -0
  93. package/dist/middlewares/paceRequests.d.ts +9 -0
  94. package/dist/middlewares/paceRequests.d.ts.map +1 -0
  95. package/dist/middlewares/paceRequests.js +36 -0
  96. package/dist/middlewares/paceRequests.js.map +1 -0
  97. package/dist/pacers/Pacer.d.ts +21 -0
  98. package/dist/pacers/Pacer.d.ts.map +1 -0
  99. package/dist/pacers/Pacer.js +3 -0
  100. package/dist/pacers/Pacer.js.map +1 -0
  101. package/dist/pacers/PacerComposite.d.ts +14 -0
  102. package/dist/pacers/PacerComposite.d.ts.map +1 -0
  103. package/dist/pacers/PacerComposite.js +32 -0
  104. package/dist/pacers/PacerComposite.js.map +1 -0
  105. package/dist/pacers/PacerQPS.d.ts +53 -0
  106. package/dist/pacers/PacerQPS.d.ts.map +1 -0
  107. package/dist/pacers/PacerQPS.js +105 -0
  108. package/dist/pacers/PacerQPS.js.map +1 -0
  109. package/dist/tsconfig.tsbuildinfo +1 -0
  110. package/docs/.nojekyll +1 -0
  111. package/docs/README.md +123 -0
  112. package/docs/classes/PacerComposite.md +62 -0
  113. package/docs/classes/PacerQPS.md +75 -0
  114. package/docs/classes/RestClient.md +424 -0
  115. package/docs/classes/RestContentSizeOverLimitError.md +128 -0
  116. package/docs/classes/RestError.md +31 -0
  117. package/docs/classes/RestRateLimitError.md +139 -0
  118. package/docs/classes/RestRequest.md +257 -0
  119. package/docs/classes/RestResponse.md +110 -0
  120. package/docs/classes/RestResponseError.md +110 -0
  121. package/docs/classes/RestRetriableError.md +139 -0
  122. package/docs/classes/RestStream.md +92 -0
  123. package/docs/classes/RestTimeoutError.md +128 -0
  124. package/docs/classes/RestTokenInvalidError.md +138 -0
  125. package/docs/interfaces/Middleware.md +27 -0
  126. package/docs/interfaces/Pacer.md +40 -0
  127. package/docs/interfaces/PacerDelay.md +25 -0
  128. package/docs/interfaces/PacerQPSBackend.md +44 -0
  129. package/docs/interfaces/PacerQPSOptions.md +40 -0
  130. package/docs/interfaces/RestLogEvent.md +95 -0
  131. package/docs/interfaces/RestOptions.md +351 -0
  132. package/docs/interfaces/TokenGetter.md +34 -0
  133. package/docs/modules.md +87 -0
  134. package/jest.config.js +8 -0
  135. package/package.json +42 -0
  136. package/tsconfig.json +39 -0
  137. package/typedoc.json +17 -0
@@ -0,0 +1,75 @@
1
+ [@clickup/rest-client](../README.md) / [Exports](../modules.md) / PacerQPS
2
+
3
+ # Class: PacerQPS
4
+
5
+ Implements a very simple heuristic:
6
+ - increase the delay if we're above the QPS within the rolling window;
7
+ - decrease the delay if we're below the desired QPS.
8
+
9
+ Each worker keeps (and grows/shrinks) its delay individually; this way, we
10
+ don't need to elect, who's the "source of truth" for the delay.
11
+
12
+ Backend is a concrete (and minimal) implementation of the storage logic for
13
+ the pacing algorithm.
14
+
15
+ ## Implements
16
+
17
+ - [`Pacer`](../interfaces/Pacer.md)
18
+
19
+ ## Constructors
20
+
21
+ ### constructor
22
+
23
+ • **new PacerQPS**(`_options`, `_backend`)
24
+
25
+ #### Parameters
26
+
27
+ | Name | Type |
28
+ | :------ | :------ |
29
+ | `_options` | [`PacerQPSOptions`](../interfaces/PacerQPSOptions.md) |
30
+ | `_backend` | [`PacerQPSBackend`](../interfaces/PacerQPSBackend.md) |
31
+
32
+ #### Defined in
33
+
34
+ [src/pacers/PacerQPS.ts:74](https://github.com/clickup/rest-client/blob/master/src/pacers/PacerQPS.ts#L74)
35
+
36
+ ## Accessors
37
+
38
+ ### name
39
+
40
+ • `get` **name**(): `string`
41
+
42
+ Human readable name of the pacer, used when composing multiple pacers.
43
+
44
+ #### Returns
45
+
46
+ `string`
47
+
48
+ #### Implementation of
49
+
50
+ [Pacer](../interfaces/Pacer.md).[name](../interfaces/Pacer.md#name)
51
+
52
+ #### Defined in
53
+
54
+ [src/pacers/PacerQPS.ts:79](https://github.com/clickup/rest-client/blob/master/src/pacers/PacerQPS.ts#L79)
55
+
56
+ ## Methods
57
+
58
+ ### touch
59
+
60
+ ▸ **touch**(): `Promise`<[`PacerDelay`](../interfaces/PacerDelay.md)\>
61
+
62
+ Signals that we're about to send a request. Returns the delay we need to
63
+ wait for before actually sending.
64
+
65
+ #### Returns
66
+
67
+ `Promise`<[`PacerDelay`](../interfaces/PacerDelay.md)\>
68
+
69
+ #### Implementation of
70
+
71
+ [Pacer](../interfaces/Pacer.md).[touch](../interfaces/Pacer.md#touch)
72
+
73
+ #### Defined in
74
+
75
+ [src/pacers/PacerQPS.ts:83](https://github.com/clickup/rest-client/blob/master/src/pacers/PacerQPS.ts#L83)
@@ -0,0 +1,424 @@
1
+ [@clickup/rest-client](../README.md) / [Exports](../modules.md) / RestClient
2
+
3
+ # Class: RestClient
4
+
5
+ RestClient is an immutable object which allows to:
6
+ 1. Send remote requests in different formats, in a caller-friendly manner.
7
+ 2. Create a new RestClient objects deriving the current set of options and
8
+ adding new ones.
9
+
10
+ ## Constructors
11
+
12
+ ### constructor
13
+
14
+ • **new RestClient**(`options?`)
15
+
16
+ #### Parameters
17
+
18
+ | Name | Type |
19
+ | :------ | :------ |
20
+ | `options` | `Partial`<[`RestOptions`](../interfaces/RestOptions.md)\> |
21
+
22
+ #### Defined in
23
+
24
+ [src/RestClient.ts:33](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L33)
25
+
26
+ ## Methods
27
+
28
+ ### withOptions
29
+
30
+ ▸ **withOptions**(`options`): [`RestClient`](RestClient.md)
31
+
32
+ Returns a new RestClient with some options updated with the passed ones.
33
+
34
+ #### Parameters
35
+
36
+ | Name | Type |
37
+ | :------ | :------ |
38
+ | `options` | `Partial`<[`RestOptions`](../interfaces/RestOptions.md)\> |
39
+
40
+ #### Returns
41
+
42
+ [`RestClient`](RestClient.md)
43
+
44
+ #### Defined in
45
+
46
+ [src/RestClient.ts:45](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L45)
47
+
48
+ ___
49
+
50
+ ### withMiddleware
51
+
52
+ ▸ **withMiddleware**(`middleware`, `method?`): [`RestClient`](RestClient.md)
53
+
54
+ Returns a new RestClient with added middleware.
55
+
56
+ #### Parameters
57
+
58
+ | Name | Type | Default value |
59
+ | :------ | :------ | :------ |
60
+ | `middleware` | [`Middleware`](../interfaces/Middleware.md) | `undefined` |
61
+ | `method` | ``"push"`` \| ``"unshift"`` | `"push"` |
62
+
63
+ #### Returns
64
+
65
+ [`RestClient`](RestClient.md)
66
+
67
+ #### Defined in
68
+
69
+ [src/RestClient.ts:55](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L55)
70
+
71
+ ___
72
+
73
+ ### withBase
74
+
75
+ ▸ **withBase**(`base`): [`RestClient`](RestClient.md)
76
+
77
+ Returns a new RestClient with the base URL which will be prepended to all
78
+ relative paths in get(), writeForm() etc. Allows to defer resolution of
79
+ this base URL to the very late per-request moment. The complicated piece
80
+ here is that, if we want base URL to be resolved asynchronously, we often
81
+ times want to reuse the same RestClient object (to e.g. fetch some part of
82
+ the base URL using already authenticated client). And a re-enterable call
83
+ appears here which we must protect against in the code below.
84
+
85
+ #### Parameters
86
+
87
+ | Name | Type |
88
+ | :------ | :------ |
89
+ | `base` | `string` \| () => `Promise`<`string`\> |
90
+
91
+ #### Returns
92
+
93
+ [`RestClient`](RestClient.md)
94
+
95
+ #### Defined in
96
+
97
+ [src/RestClient.ts:73](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L73)
98
+
99
+ ___
100
+
101
+ ### withHeader
102
+
103
+ ▸ **withHeader**(`name`, `value`): [`RestClient`](RestClient.md)
104
+
105
+ Returns a new RestClient with a custom header.
106
+
107
+ #### Parameters
108
+
109
+ | Name | Type |
110
+ | :------ | :------ |
111
+ | `name` | `string` |
112
+ | `value` | `string` \| () => `Promise`<`string`\> |
113
+
114
+ #### Returns
115
+
116
+ [`RestClient`](RestClient.md)
117
+
118
+ #### Defined in
119
+
120
+ [src/RestClient.ts:106](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L106)
121
+
122
+ ___
123
+
124
+ ### withBearer
125
+
126
+ ▸ **withBearer**(`token`, `bearerPrefix?`): [`RestClient`](RestClient.md)
127
+
128
+ Returns a new RestClient with a bearer token authentication workflow.
129
+ - RestClient supports interception of options.isTokenInvalid() signal and
130
+ conversion it into RestTokenInvalidError exception.
131
+ - If a token() is a lambda with 1 argument, it may be called the 2nd time
132
+ when we get an isTokenInvalid() signal. In this case, the request is
133
+ retried.
134
+ - If token() is a lambda with 0 arguments, that means it doesn't want to
135
+ watch for the isTokenInvalid() signal, so there is no sense in retrying
136
+ the request either.
137
+
138
+ From the first sight, it looks like options.isTokenInvalid() signal is
139
+ coupled to setBearer() auth method only. But it's not true:
140
+ isTokenInvalid() makes sense for ALL authentication methods actually (even
141
+ for basic auth), and setBearer() is just one of "clients" which implements
142
+ refreshing/retries on top of isTokenInvalid().
143
+
144
+ Passing the token as lambda allows the caller to implement some complex
145
+ logic, e.g.:
146
+ - oauth2 tokens refreshing
147
+ - marking the token as "revoked" in the database in case the refresh fails
148
+ - marking the token as "revoked" after a failed request if refresh-token is
149
+ not supported
150
+
151
+ #### Parameters
152
+
153
+ | Name | Type | Default value |
154
+ | :------ | :------ | :------ |
155
+ | `token` | [`TokenGetter`](../interfaces/TokenGetter.md)<`string`\> | `undefined` |
156
+ | `bearerPrefix` | `string` | `"Bearer "` |
157
+
158
+ #### Returns
159
+
160
+ [`RestClient`](RestClient.md)
161
+
162
+ #### Defined in
163
+
164
+ [src/RestClient.ts:137](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L137)
165
+
166
+ ___
167
+
168
+ ### withOAuth1
169
+
170
+ ▸ **withOAuth1**(`consumer`, `token`): [`RestClient`](RestClient.md)
171
+
172
+ Returns a new RestClient with oauth1 authentication workflow.
173
+ - In case we get an options.isTokenInvalid() signal, the token() lambda is
174
+ called the 2nd time with the error object, then the request is retries.
175
+ This gives the lambda a chance to recover or update something in the
176
+ database.
177
+
178
+ We use a separate and small oauth-1.0a node library here, because the more
179
+ popular one (https://www.npmjs.com/package/oauth) doesn't support signing
180
+ of arbitrary requests, it can only send its own requests.
181
+
182
+ #### Parameters
183
+
184
+ | Name | Type |
185
+ | :------ | :------ |
186
+ | `consumer` | `Object` |
187
+ | `consumer.consumerKey` | `string` |
188
+ | `consumer.consumerSecret` | `string` |
189
+ | `token` | [`TokenGetter`](../interfaces/TokenGetter.md)<{ `token`: `string` ; `tokenSecret`: `string` }\> |
190
+
191
+ #### Returns
192
+
193
+ [`RestClient`](RestClient.md)
194
+
195
+ #### Defined in
196
+
197
+ [src/RestClient.ts:157](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L157)
198
+
199
+ ___
200
+
201
+ ### withBasic
202
+
203
+ ▸ **withBasic**(`token`): [`RestClient`](RestClient.md)
204
+
205
+ Returns a new RestClient with basic authorization workflow.
206
+
207
+ #### Parameters
208
+
209
+ | Name | Type |
210
+ | :------ | :------ |
211
+ | `token` | [`TokenGetter`](../interfaces/TokenGetter.md)<{ `name`: `string` ; `password`: `string` }\> |
212
+
213
+ #### Returns
214
+
215
+ [`RestClient`](RestClient.md)
216
+
217
+ #### Defined in
218
+
219
+ [src/RestClient.ts:193](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L193)
220
+
221
+ ___
222
+
223
+ ### get
224
+
225
+ ▸ **get**(`path`, `args?`, `accept?`): [`RestRequest`](RestRequest.md)<`any`\>
226
+
227
+ Sends a plain GET request without body.
228
+
229
+ NOTE, all args will be passed through `encodeURIComponent`.
230
+
231
+ #### Parameters
232
+
233
+ | Name | Type | Default value |
234
+ | :------ | :------ | :------ |
235
+ | `path` | `string` | `undefined` |
236
+ | `args` | `Partial`<`Record`<`string`, `string` \| `number` \| `string`[]\>\> | `{}` |
237
+ | `accept` | `string` | `"application/json"` |
238
+
239
+ #### Returns
240
+
241
+ [`RestRequest`](RestRequest.md)<`any`\>
242
+
243
+ #### Defined in
244
+
245
+ [src/RestClient.ts:211](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L211)
246
+
247
+ ___
248
+
249
+ ### writeRaw
250
+
251
+ ▸ **writeRaw**(`path`, `body`, `contentType`, `method?`, `accept?`): [`RestRequest`](RestRequest.md)<`any`\>
252
+
253
+ Writes some raw string, buffer or a stream.
254
+
255
+ #### Parameters
256
+
257
+ | Name | Type | Default value |
258
+ | :------ | :------ | :------ |
259
+ | `path` | `string` | `undefined` |
260
+ | `body` | `string` \| `Buffer` \| `ReadableStream` | `undefined` |
261
+ | `contentType` | `string` | `undefined` |
262
+ | `method` | ``"POST"`` \| ``"PUT"`` \| ``"PATCH"`` | `"POST"` |
263
+ | `accept?` | `string` | `undefined` |
264
+
265
+ #### Returns
266
+
267
+ [`RestRequest`](RestRequest.md)<`any`\>
268
+
269
+ #### Defined in
270
+
271
+ [src/RestClient.ts:222](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L222)
272
+
273
+ ___
274
+
275
+ ### writeJson
276
+
277
+ ▸ **writeJson**(`path`, `body`, `method?`, `accept?`): [`RestRequest`](RestRequest.md)<`any`\>
278
+
279
+ A shortcut method to write JSON body.
280
+
281
+ #### Parameters
282
+
283
+ | Name | Type | Default value |
284
+ | :------ | :------ | :------ |
285
+ | `path` | `string` | `undefined` |
286
+ | `body` | `any` | `undefined` |
287
+ | `method` | ``"POST"`` \| ``"PUT"`` \| ``"PATCH"`` \| ``"DELETE"`` | `"POST"` |
288
+ | `accept` | `string` | `"application/json"` |
289
+
290
+ #### Returns
291
+
292
+ [`RestRequest`](RestRequest.md)<`any`\>
293
+
294
+ #### Defined in
295
+
296
+ [src/RestClient.ts:246](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L246)
297
+
298
+ ___
299
+
300
+ ### writeForm
301
+
302
+ ▸ **writeForm**(`path`, `body`, `method?`, `accept?`): [`RestRequest`](RestRequest.md)<`any`\>
303
+
304
+ A shortcut method to write "application/x-www-form-urlencoded" data.
305
+
306
+ #### Parameters
307
+
308
+ | Name | Type | Default value |
309
+ | :------ | :------ | :------ |
310
+ | `path` | `string` | `undefined` |
311
+ | `body` | `string` \| `Partial`<`Record`<`string`, `string`\>\> | `undefined` |
312
+ | `method` | ``"POST"`` \| ``"PUT"`` \| ``"PATCH"`` | `"POST"` |
313
+ | `accept` | `string` | `"application/json"` |
314
+
315
+ #### Returns
316
+
317
+ [`RestRequest`](RestRequest.md)<`any`\>
318
+
319
+ #### Defined in
320
+
321
+ [src/RestClient.ts:270](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L270)
322
+
323
+ ___
324
+
325
+ ### writeDelete
326
+
327
+ ▸ **writeDelete**(`path`, `args?`, `accept?`): [`RestRequest`](RestRequest.md)<`any`\>
328
+
329
+ A shortcut method to write DELETE request.
330
+
331
+ #### Parameters
332
+
333
+ | Name | Type | Default value |
334
+ | :------ | :------ | :------ |
335
+ | `path` | `string` | `undefined` |
336
+ | `args` | `Partial`<`Record`<`string`, `string`\>\> | `{}` |
337
+ | `accept` | `string` | `"application/json"` |
338
+
339
+ #### Returns
340
+
341
+ [`RestRequest`](RestRequest.md)<`any`\>
342
+
343
+ #### Defined in
344
+
345
+ [src/RestClient.ts:298](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L298)
346
+
347
+ ___
348
+
349
+ ### writeGraphQLX
350
+
351
+ ▸ **writeGraphQLX**(`query`, `variables?`): [`RestRequest`](RestRequest.md)<`any`\>
352
+
353
+ Returns a RestRequest prepared for sending GraphQL operation.
354
+ - Expects the response to contain no errors; throws otherwise.
355
+ - In case of success, returns just the content of `data` field (this is
356
+ different with writeGraphQLNullable() which returns `data` as a separate
357
+ fields along with `error` and `errors`).
358
+
359
+ #### Parameters
360
+
361
+ | Name | Type |
362
+ | :------ | :------ |
363
+ | `query` | `string` |
364
+ | `variables` | `any` |
365
+
366
+ #### Returns
367
+
368
+ [`RestRequest`](RestRequest.md)<`any`\>
369
+
370
+ #### Defined in
371
+
372
+ [src/RestClient.ts:313](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L313)
373
+
374
+ ___
375
+
376
+ ### writeGraphQLNullable
377
+
378
+ ▸ **writeGraphQLNullable**(`query`, `variables?`): [`RestRequest`](RestRequest.md)<`undefined` \| ``null`` \| { `data?`: `any` ; `error?`: `any` ; `errors?`: `any`[] }\>
379
+
380
+ Same as writeGraphQLX(), but doesn't throw if GraphQL response contains
381
+ non-empty `error` or `errors` fields and instead returns the full response.
382
+ I.e. allows the caller to process these errors.
383
+
384
+ #### Parameters
385
+
386
+ | Name | Type |
387
+ | :------ | :------ |
388
+ | `query` | `string` |
389
+ | `variables` | `any` |
390
+
391
+ #### Returns
392
+
393
+ [`RestRequest`](RestRequest.md)<`undefined` \| ``null`` \| { `data?`: `any` ; `error?`: `any` ; `errors?`: `any`[] }\>
394
+
395
+ #### Defined in
396
+
397
+ [src/RestClient.ts:343](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L343)
398
+
399
+ ___
400
+
401
+ ### rangeUpload
402
+
403
+ ▸ **rangeUpload**(`path`, `mimeType`, `stream`, `method?`, `chunkSize`): `Promise`<``null`` \| `string`\>
404
+
405
+ Performs a series of Content-Range requests with content from a sequence of
406
+ Buffers.
407
+
408
+ #### Parameters
409
+
410
+ | Name | Type | Default value |
411
+ | :------ | :------ | :------ |
412
+ | `path` | `string` | `undefined` |
413
+ | `mimeType` | `string` | `undefined` |
414
+ | `stream` | `AsyncIterable`<`Buffer`\> | `undefined` |
415
+ | `method` | ``"POST"`` \| ``"PUT"`` | `"POST"` |
416
+ | `chunkSize` | `number` | `undefined` |
417
+
418
+ #### Returns
419
+
420
+ `Promise`<``null`` \| `string`\>
421
+
422
+ #### Defined in
423
+
424
+ [src/RestClient.ts:353](https://github.com/clickup/rest-client/blob/master/src/RestClient.ts#L353)
@@ -0,0 +1,128 @@
1
+ [@clickup/rest-client](../README.md) / [Exports](../modules.md) / RestContentSizeOverLimitError
2
+
3
+ # Class: RestContentSizeOverLimitError
4
+
5
+ ## Hierarchy
6
+
7
+ - [`RestResponseError`](RestResponseError.md)
8
+
9
+ ↳ **`RestContentSizeOverLimitError`**
10
+
11
+ ## Constructors
12
+
13
+ ### constructor
14
+
15
+ • **new RestContentSizeOverLimitError**(`message`, `res`)
16
+
17
+ #### Parameters
18
+
19
+ | Name | Type |
20
+ | :------ | :------ |
21
+ | `message` | `string` |
22
+ | `res` | [`RestResponse`](RestResponse.md) |
23
+
24
+ #### Inherited from
25
+
26
+ [RestResponseError](RestResponseError.md).[constructor](RestResponseError.md#constructor)
27
+
28
+ #### Defined in
29
+
30
+ [src/errors/RestResponseError.ts:19](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L19)
31
+
32
+ ## Properties
33
+
34
+ ### res
35
+
36
+ • `Readonly` **res**: [`RestResponse`](RestResponse.md)
37
+
38
+ #### Inherited from
39
+
40
+ [RestResponseError](RestResponseError.md).[res](RestResponseError.md#res)
41
+
42
+ #### Defined in
43
+
44
+ [src/errors/RestResponseError.ts:10](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L10)
45
+
46
+ ___
47
+
48
+ ### method
49
+
50
+ • `Readonly` **method**: `string`
51
+
52
+ #### Inherited from
53
+
54
+ [RestResponseError](RestResponseError.md).[method](RestResponseError.md#method)
55
+
56
+ #### Defined in
57
+
58
+ [src/errors/RestResponseError.ts:12](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L12)
59
+
60
+ ___
61
+
62
+ ### host
63
+
64
+ • `Readonly` **host**: `string`
65
+
66
+ #### Inherited from
67
+
68
+ [RestResponseError](RestResponseError.md).[host](RestResponseError.md#host)
69
+
70
+ #### Defined in
71
+
72
+ [src/errors/RestResponseError.ts:13](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L13)
73
+
74
+ ___
75
+
76
+ ### pathname
77
+
78
+ • `Readonly` **pathname**: `string`
79
+
80
+ #### Inherited from
81
+
82
+ [RestResponseError](RestResponseError.md).[pathname](RestResponseError.md#pathname)
83
+
84
+ #### Defined in
85
+
86
+ [src/errors/RestResponseError.ts:14](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L14)
87
+
88
+ ___
89
+
90
+ ### requestArgs
91
+
92
+ • `Readonly` **requestArgs**: `string`
93
+
94
+ #### Inherited from
95
+
96
+ [RestResponseError](RestResponseError.md).[requestArgs](RestResponseError.md#requestargs)
97
+
98
+ #### Defined in
99
+
100
+ [src/errors/RestResponseError.ts:15](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L15)
101
+
102
+ ___
103
+
104
+ ### requestBody
105
+
106
+ • `Readonly` **requestBody**: `string`
107
+
108
+ #### Inherited from
109
+
110
+ [RestResponseError](RestResponseError.md).[requestBody](RestResponseError.md#requestbody)
111
+
112
+ #### Defined in
113
+
114
+ [src/errors/RestResponseError.ts:16](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L16)
115
+
116
+ ___
117
+
118
+ ### responseHeaders
119
+
120
+ • `Readonly` **responseHeaders**: `string`
121
+
122
+ #### Inherited from
123
+
124
+ [RestResponseError](RestResponseError.md).[responseHeaders](RestResponseError.md#responseheaders)
125
+
126
+ #### Defined in
127
+
128
+ [src/errors/RestResponseError.ts:17](https://github.com/clickup/rest-client/blob/master/src/errors/RestResponseError.ts#L17)
@@ -0,0 +1,31 @@
1
+ [@clickup/rest-client](../README.md) / [Exports](../modules.md) / RestError
2
+
3
+ # Class: RestError
4
+
5
+ ## Hierarchy
6
+
7
+ - `Error`
8
+
9
+ ↳ **`RestError`**
10
+
11
+ ↳↳ [`RestResponseError`](RestResponseError.md)
12
+
13
+ ## Constructors
14
+
15
+ ### constructor
16
+
17
+ • **new RestError**(`message`)
18
+
19
+ #### Parameters
20
+
21
+ | Name | Type |
22
+ | :------ | :------ |
23
+ | `message` | `string` |
24
+
25
+ #### Overrides
26
+
27
+ Error.constructor
28
+
29
+ #### Defined in
30
+
31
+ [src/errors/RestError.ts:2](https://github.com/clickup/rest-client/blob/master/src/errors/RestError.ts#L2)