@short.io/client-node 1.1.0 → 2.0.0
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.
- package/README.md +29 -39
- package/package.json +21 -11
- package/src/index.ts +3 -830
- package/src/sdk.gen.ts +688 -0
- package/src/types.gen.ts +4560 -0
- package/tsconfig.json +4 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -3
- package/dist/index.d.ts +0 -54
- package/dist/index.js +0 -438
- package/dist/index.js.map +0 -1
- package/dist/types/common.d.ts +0 -9
- package/dist/types/common.js +0 -2
- package/dist/types/common.js.map +0 -1
- package/dist/types/domain.d.ts +0 -43
- package/dist/types/domain.js +0 -2
- package/dist/types/domain.js.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.js +0 -5
- package/dist/types/index.js.map +0 -1
- package/dist/types/link.d.ts +0 -131
- package/dist/types/link.js +0 -2
- package/dist/types/link.js.map +0 -1
- package/dist/types/statistics.d.ts +0 -199
- package/dist/types/statistics.js +0 -2
- package/dist/types/statistics.js.map +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/types/common.ts +0 -11
- package/src/types/domain.ts +0 -44
- package/src/types/index.ts +0 -4
- package/src/types/link.ts +0 -159
- package/src/types/statistics.ts +0 -242
package/src/sdk.gen.ts
ADDED
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import { createClient, createConfig, type Options } from "@hey-api/client-fetch";
|
|
4
|
+
import type {
|
|
5
|
+
GetLinksOpengraphByDomainIdByLinkIdData,
|
|
6
|
+
PutLinksOpengraphByDomainIdByLinkIdData,
|
|
7
|
+
GetLinkCountryByLinkIdData,
|
|
8
|
+
PostLinkCountryByLinkIdData,
|
|
9
|
+
PostLinkCountryBulkByLinkIdData,
|
|
10
|
+
DeleteLinkCountryByLinkIdByCountryData,
|
|
11
|
+
GetLinkRegionByLinkIdData,
|
|
12
|
+
PostLinkRegionByLinkIdData,
|
|
13
|
+
GetLinkRegionListByCountryData,
|
|
14
|
+
PostLinkRegionBulkByLinkIdData,
|
|
15
|
+
DeleteLinkRegionByLinkIdByCountryByRegionData,
|
|
16
|
+
GetLinksPermissionsByDomainIdByLinkIdData,
|
|
17
|
+
GetLinksPermissionsByDomainIdByLinkIdError,
|
|
18
|
+
GetLinksPermissionsByDomainIdByLinkIdResponse,
|
|
19
|
+
DeleteLinksPermissionsByDomainIdByLinkIdByUserIdData,
|
|
20
|
+
DeleteLinksPermissionsByDomainIdByLinkIdByUserIdError,
|
|
21
|
+
DeleteLinksPermissionsByDomainIdByLinkIdByUserIdResponse,
|
|
22
|
+
PostLinksPermissionsByDomainIdByLinkIdByUserIdData,
|
|
23
|
+
PostLinksPermissionsByDomainIdByLinkIdByUserIdError,
|
|
24
|
+
PostLinksPermissionsByDomainIdByLinkIdByUserIdResponse,
|
|
25
|
+
GetApiLinksData,
|
|
26
|
+
GetApiLinksError,
|
|
27
|
+
GetApiLinksResponse,
|
|
28
|
+
PostLinksQrByLinkIdStringData,
|
|
29
|
+
PostLinksQrBulkData,
|
|
30
|
+
PostLinksQrBulkResponse,
|
|
31
|
+
DeleteLinksByLinkIdData,
|
|
32
|
+
DeleteLinksByLinkIdResponse,
|
|
33
|
+
DeleteLinksDeleteBulkData,
|
|
34
|
+
DeleteLinksDeleteBulkResponse,
|
|
35
|
+
PostLinksArchiveData,
|
|
36
|
+
PostLinksArchiveError,
|
|
37
|
+
PostLinksArchiveResponse,
|
|
38
|
+
PostLinksArchiveBulkData,
|
|
39
|
+
PostLinksArchiveBulkError,
|
|
40
|
+
PostLinksArchiveBulkResponse,
|
|
41
|
+
PostLinksUnarchiveData,
|
|
42
|
+
PostLinksUnarchiveError,
|
|
43
|
+
PostLinksUnarchiveResponse,
|
|
44
|
+
PostLinksUnarchiveBulkData,
|
|
45
|
+
PostLinksUnarchiveBulkError,
|
|
46
|
+
PostLinksUnarchiveBulkResponse,
|
|
47
|
+
GetLinksByLinkIdData,
|
|
48
|
+
GetLinksByLinkIdError,
|
|
49
|
+
GetLinksByLinkIdResponse,
|
|
50
|
+
PostLinksByLinkIdData,
|
|
51
|
+
PostLinksByLinkIdError,
|
|
52
|
+
PostLinksByLinkIdResponse,
|
|
53
|
+
GetLinksExpandData,
|
|
54
|
+
GetLinksExpandError,
|
|
55
|
+
GetLinksExpandResponse,
|
|
56
|
+
GetLinksByOriginalUrlData,
|
|
57
|
+
GetLinksMultipleByUrlData,
|
|
58
|
+
PostLinksData,
|
|
59
|
+
PostLinksError,
|
|
60
|
+
PostLinksResponse,
|
|
61
|
+
GetLinksTweetbotData,
|
|
62
|
+
PostLinksPublicData,
|
|
63
|
+
PostLinksPublicError,
|
|
64
|
+
PostLinksPublicResponse,
|
|
65
|
+
PostLinksBulkData,
|
|
66
|
+
GetApiDomainsData,
|
|
67
|
+
GetApiDomainsResponse,
|
|
68
|
+
GetDomainsByDomainIdData,
|
|
69
|
+
GetDomainsByDomainIdError,
|
|
70
|
+
GetDomainsByDomainIdResponse,
|
|
71
|
+
PostDomainsData,
|
|
72
|
+
PostDomainsError,
|
|
73
|
+
PostDomainsResponse,
|
|
74
|
+
PostDomainsSettingsByDomainIdData,
|
|
75
|
+
PostTagsBulkData,
|
|
76
|
+
GetLinksFoldersByDomainIdData,
|
|
77
|
+
GetLinksFoldersByDomainIdByFolderIdData,
|
|
78
|
+
PostLinksFoldersData,
|
|
79
|
+
} from "./types.gen";
|
|
80
|
+
|
|
81
|
+
export const client = createClient(createConfig());
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get link opengraph properties
|
|
85
|
+
*/
|
|
86
|
+
export const getLinksOpengraphByDomainIdByLinkId = <ThrowOnError extends boolean = false>(
|
|
87
|
+
options: Options<GetLinksOpengraphByDomainIdByLinkIdData, ThrowOnError>,
|
|
88
|
+
) => {
|
|
89
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
90
|
+
...options,
|
|
91
|
+
url: "/links/opengraph/{domainId}/{linkId}",
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Set link opengraph properties
|
|
97
|
+
*/
|
|
98
|
+
export const putLinksOpengraphByDomainIdByLinkId = <ThrowOnError extends boolean = false>(
|
|
99
|
+
options: Options<PutLinksOpengraphByDomainIdByLinkIdData, ThrowOnError>,
|
|
100
|
+
) => {
|
|
101
|
+
return (options?.client ?? client).put<unknown, unknown, ThrowOnError>({
|
|
102
|
+
...options,
|
|
103
|
+
headers: {
|
|
104
|
+
"Content-Type": "application/json",
|
|
105
|
+
...options?.headers,
|
|
106
|
+
},
|
|
107
|
+
url: "/links/opengraph/{domainId}/{linkId}",
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get link countries
|
|
113
|
+
*/
|
|
114
|
+
export const getLinkCountryByLinkId = <ThrowOnError extends boolean = false>(
|
|
115
|
+
options: Options<GetLinkCountryByLinkIdData, ThrowOnError>,
|
|
116
|
+
) => {
|
|
117
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
118
|
+
...options,
|
|
119
|
+
url: "/link_country/{linkId}",
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Create link country
|
|
125
|
+
*/
|
|
126
|
+
export const postLinkCountryByLinkId = <ThrowOnError extends boolean = false>(
|
|
127
|
+
options: Options<PostLinkCountryByLinkIdData, ThrowOnError>,
|
|
128
|
+
) => {
|
|
129
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
130
|
+
...options,
|
|
131
|
+
headers: {
|
|
132
|
+
"Content-Type": "application/json",
|
|
133
|
+
...options?.headers,
|
|
134
|
+
},
|
|
135
|
+
url: "/link_country/{linkId}",
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Create link countries in bulk
|
|
141
|
+
*/
|
|
142
|
+
export const postLinkCountryBulkByLinkId = <ThrowOnError extends boolean = false>(
|
|
143
|
+
options: Options<PostLinkCountryBulkByLinkIdData, ThrowOnError>,
|
|
144
|
+
) => {
|
|
145
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
146
|
+
...options,
|
|
147
|
+
headers: {
|
|
148
|
+
"Content-Type": "application/json",
|
|
149
|
+
...options?.headers,
|
|
150
|
+
},
|
|
151
|
+
url: "/link_country/bulk/{linkId}",
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Delete link country
|
|
157
|
+
*/
|
|
158
|
+
export const deleteLinkCountryByLinkIdByCountry = <ThrowOnError extends boolean = false>(
|
|
159
|
+
options: Options<DeleteLinkCountryByLinkIdByCountryData, ThrowOnError>,
|
|
160
|
+
) => {
|
|
161
|
+
return (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({
|
|
162
|
+
...options,
|
|
163
|
+
url: "/link_country/{linkId}/{country}",
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get link regions
|
|
169
|
+
*/
|
|
170
|
+
export const getLinkRegionByLinkId = <ThrowOnError extends boolean = false>(
|
|
171
|
+
options: Options<GetLinkRegionByLinkIdData, ThrowOnError>,
|
|
172
|
+
) => {
|
|
173
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
174
|
+
...options,
|
|
175
|
+
url: "/link_region/{linkId}",
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Add region targeting to link
|
|
181
|
+
* Add region targeting to link
|
|
182
|
+
*/
|
|
183
|
+
export const postLinkRegionByLinkId = <ThrowOnError extends boolean = false>(
|
|
184
|
+
options: Options<PostLinkRegionByLinkIdData, ThrowOnError>,
|
|
185
|
+
) => {
|
|
186
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
187
|
+
...options,
|
|
188
|
+
headers: {
|
|
189
|
+
"Content-Type": "application/json",
|
|
190
|
+
...options?.headers,
|
|
191
|
+
},
|
|
192
|
+
url: "/link_region/{linkId}",
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get all regions by country
|
|
198
|
+
*/
|
|
199
|
+
export const getLinkRegionListByCountry = <ThrowOnError extends boolean = false>(
|
|
200
|
+
options: Options<GetLinkRegionListByCountryData, ThrowOnError>,
|
|
201
|
+
) => {
|
|
202
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
203
|
+
...options,
|
|
204
|
+
url: "/link_region/list/{country}",
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Create link regions in bulk
|
|
210
|
+
*/
|
|
211
|
+
export const postLinkRegionBulkByLinkId = <ThrowOnError extends boolean = false>(
|
|
212
|
+
options: Options<PostLinkRegionBulkByLinkIdData, ThrowOnError>,
|
|
213
|
+
) => {
|
|
214
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
215
|
+
...options,
|
|
216
|
+
headers: {
|
|
217
|
+
"Content-Type": "application/json",
|
|
218
|
+
...options?.headers,
|
|
219
|
+
},
|
|
220
|
+
url: "/link_region/bulk/{linkId}",
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Delete link region by country
|
|
226
|
+
*/
|
|
227
|
+
export const deleteLinkRegionByLinkIdByCountryByRegion = <ThrowOnError extends boolean = false>(
|
|
228
|
+
options: Options<DeleteLinkRegionByLinkIdByCountryByRegionData, ThrowOnError>,
|
|
229
|
+
) => {
|
|
230
|
+
return (options?.client ?? client).delete<unknown, unknown, ThrowOnError>({
|
|
231
|
+
...options,
|
|
232
|
+
url: "/link_region/{linkId}/{country}/{region}",
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Get link permissions
|
|
238
|
+
*/
|
|
239
|
+
export const getLinksPermissionsByDomainIdByLinkId = <ThrowOnError extends boolean = false>(
|
|
240
|
+
options: Options<GetLinksPermissionsByDomainIdByLinkIdData, ThrowOnError>,
|
|
241
|
+
) => {
|
|
242
|
+
return (options?.client ?? client).get<
|
|
243
|
+
GetLinksPermissionsByDomainIdByLinkIdResponse,
|
|
244
|
+
GetLinksPermissionsByDomainIdByLinkIdError,
|
|
245
|
+
ThrowOnError
|
|
246
|
+
>({
|
|
247
|
+
...options,
|
|
248
|
+
url: "/links/permissions/{domainId}/{linkId}",
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Delete link permissions
|
|
254
|
+
*/
|
|
255
|
+
export const deleteLinksPermissionsByDomainIdByLinkIdByUserId = <ThrowOnError extends boolean = false>(
|
|
256
|
+
options: Options<DeleteLinksPermissionsByDomainIdByLinkIdByUserIdData, ThrowOnError>,
|
|
257
|
+
) => {
|
|
258
|
+
return (options?.client ?? client).delete<
|
|
259
|
+
DeleteLinksPermissionsByDomainIdByLinkIdByUserIdResponse,
|
|
260
|
+
DeleteLinksPermissionsByDomainIdByLinkIdByUserIdError,
|
|
261
|
+
ThrowOnError
|
|
262
|
+
>({
|
|
263
|
+
...options,
|
|
264
|
+
url: "/links/permissions/{domainId}/{linkId}/{userId}",
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Add link permission
|
|
270
|
+
*/
|
|
271
|
+
export const postLinksPermissionsByDomainIdByLinkIdByUserId = <ThrowOnError extends boolean = false>(
|
|
272
|
+
options: Options<PostLinksPermissionsByDomainIdByLinkIdByUserIdData, ThrowOnError>,
|
|
273
|
+
) => {
|
|
274
|
+
return (options?.client ?? client).post<
|
|
275
|
+
PostLinksPermissionsByDomainIdByLinkIdByUserIdResponse,
|
|
276
|
+
PostLinksPermissionsByDomainIdByLinkIdByUserIdError,
|
|
277
|
+
ThrowOnError
|
|
278
|
+
>({
|
|
279
|
+
...options,
|
|
280
|
+
url: "/links/permissions/{domainId}/{linkId}/{userId}",
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Link list
|
|
286
|
+
* Get domain links
|
|
287
|
+
*/
|
|
288
|
+
export const getApiLinks = <ThrowOnError extends boolean = false>(options: Options<GetApiLinksData, ThrowOnError>) => {
|
|
289
|
+
return (options?.client ?? client).get<GetApiLinksResponse, GetApiLinksError, ThrowOnError>({
|
|
290
|
+
...options,
|
|
291
|
+
url: "/api/links",
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Generate QR code for the link
|
|
297
|
+
*/
|
|
298
|
+
export const postLinksQrByLinkIdString = <ThrowOnError extends boolean = false>(
|
|
299
|
+
options: Options<PostLinksQrByLinkIdStringData, ThrowOnError>,
|
|
300
|
+
) => {
|
|
301
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
302
|
+
...options,
|
|
303
|
+
headers: {
|
|
304
|
+
"Content-Type": "application/json",
|
|
305
|
+
...options?.headers,
|
|
306
|
+
},
|
|
307
|
+
url: "/links/qr/{linkIdString}",
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Generate QR codes for the link in bulk
|
|
313
|
+
* Generate QR codes for the link in bulk. Rate limit - 1 request per minute
|
|
314
|
+
*/
|
|
315
|
+
export const postLinksQrBulk = <ThrowOnError extends boolean = false>(
|
|
316
|
+
options: Options<PostLinksQrBulkData, ThrowOnError>,
|
|
317
|
+
) => {
|
|
318
|
+
return (options?.client ?? client).post<PostLinksQrBulkResponse, unknown, ThrowOnError>({
|
|
319
|
+
...options,
|
|
320
|
+
headers: {
|
|
321
|
+
"Content-Type": "application/json",
|
|
322
|
+
...options?.headers,
|
|
323
|
+
},
|
|
324
|
+
url: "/links/qr/bulk",
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Delete link
|
|
330
|
+
* Delete link by id
|
|
331
|
+
*
|
|
332
|
+
* **Rate limit**: 20/s
|
|
333
|
+
*/
|
|
334
|
+
export const deleteLinksByLinkId = <ThrowOnError extends boolean = false>(
|
|
335
|
+
options: Options<DeleteLinksByLinkIdData, ThrowOnError>,
|
|
336
|
+
) => {
|
|
337
|
+
return (options?.client ?? client).delete<DeleteLinksByLinkIdResponse, unknown, ThrowOnError>({
|
|
338
|
+
...options,
|
|
339
|
+
url: "/links/{link_id}",
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Delete links in bulk
|
|
345
|
+
* Delete links in bulk by ids
|
|
346
|
+
*
|
|
347
|
+
* **Rate limit**: 1/s
|
|
348
|
+
*/
|
|
349
|
+
export const deleteLinksDeleteBulk = <ThrowOnError extends boolean = false>(
|
|
350
|
+
options: Options<DeleteLinksDeleteBulkData, ThrowOnError>,
|
|
351
|
+
) => {
|
|
352
|
+
return (options?.client ?? client).delete<DeleteLinksDeleteBulkResponse, unknown, ThrowOnError>({
|
|
353
|
+
...options,
|
|
354
|
+
headers: {
|
|
355
|
+
"Content-Type": "application/json",
|
|
356
|
+
...options?.headers,
|
|
357
|
+
},
|
|
358
|
+
url: "/links/delete_bulk",
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Archive link
|
|
364
|
+
*/
|
|
365
|
+
export const postLinksArchive = <ThrowOnError extends boolean = false>(
|
|
366
|
+
options: Options<PostLinksArchiveData, ThrowOnError>,
|
|
367
|
+
) => {
|
|
368
|
+
return (options?.client ?? client).post<PostLinksArchiveResponse, PostLinksArchiveError, ThrowOnError>({
|
|
369
|
+
...options,
|
|
370
|
+
headers: {
|
|
371
|
+
"Content-Type": "application/json",
|
|
372
|
+
...options?.headers,
|
|
373
|
+
},
|
|
374
|
+
url: "/links/archive",
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Archive links in bulk
|
|
380
|
+
*/
|
|
381
|
+
export const postLinksArchiveBulk = <ThrowOnError extends boolean = false>(
|
|
382
|
+
options: Options<PostLinksArchiveBulkData, ThrowOnError>,
|
|
383
|
+
) => {
|
|
384
|
+
return (options?.client ?? client).post<PostLinksArchiveBulkResponse, PostLinksArchiveBulkError, ThrowOnError>({
|
|
385
|
+
...options,
|
|
386
|
+
headers: {
|
|
387
|
+
"Content-Type": "application/json",
|
|
388
|
+
...options?.headers,
|
|
389
|
+
},
|
|
390
|
+
url: "/links/archive_bulk",
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Unarchive link
|
|
396
|
+
*/
|
|
397
|
+
export const postLinksUnarchive = <ThrowOnError extends boolean = false>(
|
|
398
|
+
options: Options<PostLinksUnarchiveData, ThrowOnError>,
|
|
399
|
+
) => {
|
|
400
|
+
return (options?.client ?? client).post<PostLinksUnarchiveResponse, PostLinksUnarchiveError, ThrowOnError>({
|
|
401
|
+
...options,
|
|
402
|
+
headers: {
|
|
403
|
+
"Content-Type": "application/json",
|
|
404
|
+
...options?.headers,
|
|
405
|
+
},
|
|
406
|
+
url: "/links/unarchive",
|
|
407
|
+
});
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Unarchive links in bulk
|
|
412
|
+
*/
|
|
413
|
+
export const postLinksUnarchiveBulk = <ThrowOnError extends boolean = false>(
|
|
414
|
+
options: Options<PostLinksUnarchiveBulkData, ThrowOnError>,
|
|
415
|
+
) => {
|
|
416
|
+
return (options?.client ?? client).post<PostLinksUnarchiveBulkResponse, PostLinksUnarchiveBulkError, ThrowOnError>({
|
|
417
|
+
...options,
|
|
418
|
+
headers: {
|
|
419
|
+
"Content-Type": "application/json",
|
|
420
|
+
...options?.headers,
|
|
421
|
+
},
|
|
422
|
+
url: "/links/unarchive_bulk",
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Get link info by link id
|
|
428
|
+
* Get link info by link id. Rate limit: 20/s
|
|
429
|
+
*/
|
|
430
|
+
export const getLinksByLinkId = <ThrowOnError extends boolean = false>(
|
|
431
|
+
options: Options<GetLinksByLinkIdData, ThrowOnError>,
|
|
432
|
+
) => {
|
|
433
|
+
return (options?.client ?? client).get<GetLinksByLinkIdResponse, GetLinksByLinkIdError, ThrowOnError>({
|
|
434
|
+
...options,
|
|
435
|
+
url: "/links/{linkId}",
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Update existing URL
|
|
441
|
+
* Update original url, title or path for existing URL by id
|
|
442
|
+
*
|
|
443
|
+
* **Rate limit**: 20/s
|
|
444
|
+
*/
|
|
445
|
+
export const postLinksByLinkId = <ThrowOnError extends boolean = false>(
|
|
446
|
+
options: Options<PostLinksByLinkIdData, ThrowOnError>,
|
|
447
|
+
) => {
|
|
448
|
+
return (options?.client ?? client).post<PostLinksByLinkIdResponse, PostLinksByLinkIdError, ThrowOnError>({
|
|
449
|
+
...options,
|
|
450
|
+
headers: {
|
|
451
|
+
"Content-Type": "application/json",
|
|
452
|
+
...options?.headers,
|
|
453
|
+
},
|
|
454
|
+
url: "/links/{linkId}",
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Get link info by path
|
|
460
|
+
* Get link info by path. Rate limit: 20/s
|
|
461
|
+
*/
|
|
462
|
+
export const getLinksExpand = <ThrowOnError extends boolean = false>(
|
|
463
|
+
options: Options<GetLinksExpandData, ThrowOnError>,
|
|
464
|
+
) => {
|
|
465
|
+
return (options?.client ?? client).get<GetLinksExpandResponse, GetLinksExpandError, ThrowOnError>({
|
|
466
|
+
...options,
|
|
467
|
+
url: "/links/expand",
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Get link info by original URL
|
|
473
|
+
* **DEPRECATED** Get link info by original URL. Rate limit: 20/s
|
|
474
|
+
*/
|
|
475
|
+
export const getLinksByOriginalUrl = <ThrowOnError extends boolean = false>(
|
|
476
|
+
options: Options<GetLinksByOriginalUrlData, ThrowOnError>,
|
|
477
|
+
) => {
|
|
478
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
479
|
+
...options,
|
|
480
|
+
url: "/links/by-original-url",
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Get links info by original URL
|
|
486
|
+
* Returns all links with the same original URL
|
|
487
|
+
*/
|
|
488
|
+
export const getLinksMultipleByUrl = <ThrowOnError extends boolean = false>(
|
|
489
|
+
options: Options<GetLinksMultipleByUrlData, ThrowOnError>,
|
|
490
|
+
) => {
|
|
491
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
492
|
+
...options,
|
|
493
|
+
url: "/links/multiple-by-url",
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Create a new link
|
|
499
|
+
* This method creates a new link. If parameter "path" is omitted, it
|
|
500
|
+
* generates path by algorithm, chosen in domain settings.
|
|
501
|
+
*
|
|
502
|
+
* Notes:
|
|
503
|
+
*
|
|
504
|
+
* 1. If URL with a given path already exists and originalURL of the URL in database is equal to originalURL argument, it returns information about existing URL
|
|
505
|
+
* 2. If URL with a given path already exists and originalURL is different from originalURL in database, it returns error with a status `409`
|
|
506
|
+
* 3. If URL with a given originalURL exists, and no path is given, it returns information about existing URL and does not create anything
|
|
507
|
+
* 4. If URL with a given originalURL exists, and custom path is given, it creates a new short URL
|
|
508
|
+
*
|
|
509
|
+
* **Rate limit**: 50/s
|
|
510
|
+
*/
|
|
511
|
+
export const postLinks = <ThrowOnError extends boolean = false>(options: Options<PostLinksData, ThrowOnError>) => {
|
|
512
|
+
return (options?.client ?? client).post<PostLinksResponse, PostLinksError, ThrowOnError>({
|
|
513
|
+
...options,
|
|
514
|
+
headers: {
|
|
515
|
+
"Content-Type": "application/json",
|
|
516
|
+
...options?.headers,
|
|
517
|
+
},
|
|
518
|
+
url: "/links",
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Create a new link (simple version)
|
|
524
|
+
*
|
|
525
|
+
* Simple version of link create endpoint. You can use it if you can not use POST method
|
|
526
|
+
* **Rate limit**: 50/s
|
|
527
|
+
*
|
|
528
|
+
*/
|
|
529
|
+
export const getLinksTweetbot = <ThrowOnError extends boolean = false>(
|
|
530
|
+
options: Options<GetLinksTweetbotData, ThrowOnError>,
|
|
531
|
+
) => {
|
|
532
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
533
|
+
...options,
|
|
534
|
+
url: "/links/tweetbot",
|
|
535
|
+
});
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Create a new link using public API key
|
|
540
|
+
* This method creates a new link. Only this method should be used in client-side applications
|
|
541
|
+
*
|
|
542
|
+
* If parameter "path" is omitted, it generates path by algorithm, chosen in domain settings.
|
|
543
|
+
*
|
|
544
|
+
* You can use it with public API key in your frontend applications (client-side javascript, Android & iPhone apps)
|
|
545
|
+
* **Rate limit**: 20/s
|
|
546
|
+
*/
|
|
547
|
+
export const postLinksPublic = <ThrowOnError extends boolean = false>(
|
|
548
|
+
options: Options<PostLinksPublicData, ThrowOnError>,
|
|
549
|
+
) => {
|
|
550
|
+
return (options?.client ?? client).post<PostLinksPublicResponse, PostLinksPublicError, ThrowOnError>({
|
|
551
|
+
...options,
|
|
552
|
+
headers: {
|
|
553
|
+
"Content-Type": "application/json",
|
|
554
|
+
...options?.headers,
|
|
555
|
+
},
|
|
556
|
+
url: "/links/public",
|
|
557
|
+
});
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Create up to 1000 links in one call
|
|
562
|
+
* Please use this method if you need to create big packs of links. It
|
|
563
|
+
* accepts up to 1000 links in one API call.
|
|
564
|
+
*
|
|
565
|
+
* It works almost the same as single link creation endpoint, but accepts
|
|
566
|
+
* an array of URLs and returns an array of responses.
|
|
567
|
+
*
|
|
568
|
+
* Returns list of Link objects. If any URL is failed to insert, it returns
|
|
569
|
+
* error object instead as array element. Method is not transactional – it
|
|
570
|
+
* can insert some links from the list and return an error for others.
|
|
571
|
+
*
|
|
572
|
+
* **Rate limit**: 5 queries in 10 seconds
|
|
573
|
+
*/
|
|
574
|
+
export const postLinksBulk = <ThrowOnError extends boolean = false>(
|
|
575
|
+
options: Options<PostLinksBulkData, ThrowOnError>,
|
|
576
|
+
) => {
|
|
577
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
578
|
+
...options,
|
|
579
|
+
headers: {
|
|
580
|
+
"Content-Type": "application/json",
|
|
581
|
+
...options?.headers,
|
|
582
|
+
},
|
|
583
|
+
url: "/links/bulk",
|
|
584
|
+
});
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* List domains
|
|
589
|
+
* Shows all domains of current user
|
|
590
|
+
*/
|
|
591
|
+
export const getApiDomains = <ThrowOnError extends boolean = false>(
|
|
592
|
+
options?: Options<GetApiDomainsData, ThrowOnError>,
|
|
593
|
+
) => {
|
|
594
|
+
return (options?.client ?? client).get<GetApiDomainsResponse, unknown, ThrowOnError>({
|
|
595
|
+
...options,
|
|
596
|
+
url: "/api/domains",
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Get domain details by id
|
|
602
|
+
*/
|
|
603
|
+
export const getDomainsByDomainId = <ThrowOnError extends boolean = false>(
|
|
604
|
+
options: Options<GetDomainsByDomainIdData, ThrowOnError>,
|
|
605
|
+
) => {
|
|
606
|
+
return (options?.client ?? client).get<GetDomainsByDomainIdResponse, GetDomainsByDomainIdError, ThrowOnError>({
|
|
607
|
+
...options,
|
|
608
|
+
url: "/domains/{domainId}",
|
|
609
|
+
});
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Create a domain
|
|
614
|
+
*/
|
|
615
|
+
export const postDomains = <ThrowOnError extends boolean = false>(options: Options<PostDomainsData, ThrowOnError>) => {
|
|
616
|
+
return (options?.client ?? client).post<PostDomainsResponse, PostDomainsError, ThrowOnError>({
|
|
617
|
+
...options,
|
|
618
|
+
headers: {
|
|
619
|
+
"Content-Type": "application/json",
|
|
620
|
+
...options?.headers,
|
|
621
|
+
},
|
|
622
|
+
url: "/domains",
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Update domain settings
|
|
628
|
+
* Update domain settings
|
|
629
|
+
*/
|
|
630
|
+
export const postDomainsSettingsByDomainId = <ThrowOnError extends boolean = false>(
|
|
631
|
+
options: Options<PostDomainsSettingsByDomainIdData, ThrowOnError>,
|
|
632
|
+
) => {
|
|
633
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
634
|
+
...options,
|
|
635
|
+
headers: {
|
|
636
|
+
"Content-Type": "application/json",
|
|
637
|
+
...options?.headers,
|
|
638
|
+
},
|
|
639
|
+
url: "/domains/settings/{domainId}",
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Append a single tag to the links in bulk
|
|
645
|
+
*/
|
|
646
|
+
export const postTagsBulk = <ThrowOnError extends boolean = false>(
|
|
647
|
+
options: Options<PostTagsBulkData, ThrowOnError>,
|
|
648
|
+
) => {
|
|
649
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
650
|
+
...options,
|
|
651
|
+
headers: {
|
|
652
|
+
"Content-Type": "application/json",
|
|
653
|
+
...options?.headers,
|
|
654
|
+
},
|
|
655
|
+
url: "/tags/bulk",
|
|
656
|
+
});
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
export const getLinksFoldersByDomainId = <ThrowOnError extends boolean = false>(
|
|
660
|
+
options: Options<GetLinksFoldersByDomainIdData, ThrowOnError>,
|
|
661
|
+
) => {
|
|
662
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
663
|
+
...options,
|
|
664
|
+
url: "/links/folders/{domainId}",
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
export const getLinksFoldersByDomainIdByFolderId = <ThrowOnError extends boolean = false>(
|
|
669
|
+
options: Options<GetLinksFoldersByDomainIdByFolderIdData, ThrowOnError>,
|
|
670
|
+
) => {
|
|
671
|
+
return (options?.client ?? client).get<unknown, unknown, ThrowOnError>({
|
|
672
|
+
...options,
|
|
673
|
+
url: "/links/folders/{domainId}/{folderId}",
|
|
674
|
+
});
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
export const postLinksFolders = <ThrowOnError extends boolean = false>(
|
|
678
|
+
options: Options<PostLinksFoldersData, ThrowOnError>,
|
|
679
|
+
) => {
|
|
680
|
+
return (options?.client ?? client).post<unknown, unknown, ThrowOnError>({
|
|
681
|
+
...options,
|
|
682
|
+
headers: {
|
|
683
|
+
"Content-Type": "application/json",
|
|
684
|
+
...options?.headers,
|
|
685
|
+
},
|
|
686
|
+
url: "/links/folders",
|
|
687
|
+
});
|
|
688
|
+
};
|