@spyglasshq/sdk 0.1.0 → 0.1.2
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 +248 -66
- package/dist/cjs/BaseClient.js +3 -3
- package/dist/cjs/Client.d.ts +4 -4
- package/dist/cjs/Client.js +3 -3
- package/dist/cjs/api/errors/BadRequestError.d.ts +3 -3
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +3 -3
- package/dist/cjs/api/errors/ForbiddenError.d.ts +3 -3
- package/dist/cjs/api/errors/InternalServerError.d.ts +3 -3
- package/dist/cjs/api/errors/MethodNotAllowedError.d.ts +3 -3
- package/dist/cjs/api/errors/NotFoundError.d.ts +3 -3
- package/dist/cjs/api/errors/PaymentRequiredError.d.ts +3 -3
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +3 -3
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +3 -3
- package/dist/cjs/api/resources/account/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/account/client/Client.js +15 -15
- package/dist/cjs/api/resources/indexing/client/Client.d.ts +19 -19
- package/dist/cjs/api/resources/indexing/client/Client.js +31 -31
- package/dist/cjs/api/resources/search/client/Client.d.ts +93 -89
- package/dist/cjs/api/resources/search/client/Client.js +153 -149
- package/dist/cjs/api/resources/search/client/requests/GetBrandLandingPagesRequest.d.ts +2 -2
- package/dist/cjs/api/resources/search/client/requests/GetBrandMediaInsightsRequest.d.ts +2 -2
- package/dist/cjs/api/resources/search/client/requests/{GetMediaV2Request.d.ts → GetMediaRequest.d.ts} +13 -13
- package/dist/cjs/api/resources/search/client/requests/{GetMediaV2Request.js → GetMediaRequest.js} +14 -14
- package/dist/{esm/api/resources/search/client/requests/SearchBrandsV2Request.d.mts → cjs/api/resources/search/client/requests/SearchBrandsRequest.d.ts} +4 -4
- package/dist/cjs/api/resources/search/client/requests/{SearchBrandsV2Request.js → SearchBrandsRequest.js} +5 -5
- package/dist/cjs/api/resources/search/client/requests/index.d.ts +2 -2
- package/dist/cjs/api/resources/search/client/requests/index.js +5 -5
- package/dist/cjs/api/resources/search/types/GetAccountResponse.d.ts +2 -2
- package/dist/cjs/api/resources/search/types/{GetMediaV2Response.d.ts → GetMediaResponse.d.ts} +3 -3
- package/dist/cjs/api/resources/search/types/{GetMediaV2Response.js → GetMediaResponse.js} +5 -5
- package/dist/{esm/api/resources/search/types/SearchBrandsV2Response.d.mts → cjs/api/resources/search/types/SearchBrandsResponse.d.ts} +3 -3
- package/dist/cjs/api/resources/search/types/{SearchBrandsV2Response.js → SearchBrandsResponse.js} +5 -5
- package/dist/cjs/api/resources/search/types/index.d.ts +2 -2
- package/dist/cjs/api/resources/search/types/index.js +2 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +3 -3
- package/dist/esm/Client.d.mts +4 -4
- package/dist/esm/Client.mjs +1 -1
- package/dist/esm/api/errors/BadRequestError.d.mts +3 -3
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +3 -3
- package/dist/esm/api/errors/ForbiddenError.d.mts +3 -3
- package/dist/esm/api/errors/InternalServerError.d.mts +3 -3
- package/dist/esm/api/errors/MethodNotAllowedError.d.mts +3 -3
- package/dist/esm/api/errors/NotFoundError.d.mts +3 -3
- package/dist/esm/api/errors/PaymentRequiredError.d.mts +3 -3
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +3 -3
- package/dist/esm/api/errors/UnauthorizedError.d.mts +3 -3
- package/dist/esm/api/resources/account/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/account/client/Client.mjs +15 -15
- package/dist/esm/api/resources/indexing/client/Client.d.mts +19 -19
- package/dist/esm/api/resources/indexing/client/Client.mjs +31 -31
- package/dist/esm/api/resources/search/client/Client.d.mts +93 -89
- package/dist/esm/api/resources/search/client/Client.mjs +153 -149
- package/dist/esm/api/resources/search/client/requests/GetBrandLandingPagesRequest.d.mts +2 -2
- package/dist/esm/api/resources/search/client/requests/GetBrandMediaInsightsRequest.d.mts +2 -2
- package/dist/esm/api/resources/search/client/requests/{GetMediaV2Request.d.mts → GetMediaRequest.d.mts} +13 -13
- package/dist/esm/api/resources/search/client/requests/{GetMediaV2Request.mjs → GetMediaRequest.mjs} +13 -13
- package/dist/{cjs/api/resources/search/client/requests/SearchBrandsV2Request.d.ts → esm/api/resources/search/client/requests/SearchBrandsRequest.d.mts} +4 -4
- package/dist/esm/api/resources/search/client/requests/{SearchBrandsV2Request.mjs → SearchBrandsRequest.mjs} +4 -4
- package/dist/esm/api/resources/search/client/requests/index.d.mts +2 -2
- package/dist/esm/api/resources/search/client/requests/index.mjs +2 -2
- package/dist/esm/api/resources/search/types/GetAccountResponse.d.mts +2 -2
- package/dist/esm/api/resources/search/types/{GetMediaV2Response.d.mts → GetMediaResponse.d.mts} +3 -3
- package/dist/esm/api/resources/search/types/{GetMediaV2Response.mjs → GetMediaResponse.mjs} +4 -4
- package/dist/{cjs/api/resources/search/types/SearchBrandsV2Response.d.ts → esm/api/resources/search/types/SearchBrandsResponse.d.mts} +3 -3
- package/dist/esm/api/resources/search/types/{SearchBrandsV2Response.mjs → SearchBrandsResponse.mjs} +4 -4
- package/dist/esm/api/resources/search/types/index.d.mts +2 -2
- package/dist/esm/api/resources/search/types/index.mjs +2 -2
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +17 -2
- package/reference.md +31 -27
|
@@ -51,7 +51,7 @@ const requestBody_js_1 = require("../../../../core/requestBody.js");
|
|
|
51
51
|
const environments = __importStar(require("../../../../environments.js"));
|
|
52
52
|
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
53
53
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
54
|
-
const
|
|
54
|
+
const spyglass = __importStar(require("../../../index.js"));
|
|
55
55
|
/**
|
|
56
56
|
* Search accounts, ads, and related data.
|
|
57
57
|
*/
|
|
@@ -60,7 +60,10 @@ class SearchClient {
|
|
|
60
60
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Find brands
|
|
63
|
+
* Find brands.
|
|
64
|
+
* Search semantically with `query`, or look them up by name, id, or
|
|
65
|
+
* social handle. Either way, you can also narrow the results with
|
|
66
|
+
* filters such as product taxonomy, location, and follower count.
|
|
64
67
|
*
|
|
65
68
|
* Send one search field. Each field is its own mode:
|
|
66
69
|
*
|
|
@@ -94,30 +97,30 @@ class SearchClient {
|
|
|
94
97
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
95
98
|
* row even when nothing matches.
|
|
96
99
|
*
|
|
97
|
-
* @param {
|
|
100
|
+
* @param {spyglass.SearchBrandsRequest} request
|
|
98
101
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
99
102
|
*
|
|
100
|
-
* @throws {@link
|
|
101
|
-
* @throws {@link
|
|
102
|
-
* @throws {@link
|
|
103
|
-
* @throws {@link
|
|
104
|
-
* @throws {@link
|
|
105
|
-
* @throws {@link
|
|
106
|
-
* @throws {@link
|
|
107
|
-
* @throws {@link
|
|
103
|
+
* @throws {@link spyglass.BadRequestError}
|
|
104
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
105
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
106
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
107
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
108
|
+
* @throws {@link spyglass.ContentTooLargeError}
|
|
109
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
110
|
+
* @throws {@link spyglass.InternalServerError}
|
|
108
111
|
* @throws {@link errors.SpyglassError}
|
|
109
112
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
110
113
|
*
|
|
111
114
|
* @example
|
|
112
|
-
* await client.search.
|
|
115
|
+
* await client.search.brands({
|
|
113
116
|
* names: ["Nike"],
|
|
114
117
|
* limit: 3
|
|
115
118
|
* })
|
|
116
119
|
*/
|
|
117
|
-
|
|
118
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
120
|
+
brands(request = {}, requestOptions) {
|
|
121
|
+
return core.HttpResponsePromise.fromPromise(this.__brands(request, requestOptions));
|
|
119
122
|
}
|
|
120
|
-
|
|
123
|
+
__brands() {
|
|
121
124
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
122
125
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
123
126
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -142,21 +145,21 @@ class SearchClient {
|
|
|
142
145
|
if (_response.error.reason === "status-code") {
|
|
143
146
|
switch (_response.error.statusCode) {
|
|
144
147
|
case 400:
|
|
145
|
-
throw new
|
|
148
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
146
149
|
case 401:
|
|
147
|
-
throw new
|
|
150
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
148
151
|
case 402:
|
|
149
|
-
throw new
|
|
152
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
150
153
|
case 403:
|
|
151
|
-
throw new
|
|
154
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
152
155
|
case 405:
|
|
153
|
-
throw new
|
|
156
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
154
157
|
case 413:
|
|
155
|
-
throw new
|
|
158
|
+
throw new spyglass.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
156
159
|
case 429:
|
|
157
|
-
throw new
|
|
160
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
158
161
|
case 500:
|
|
159
|
-
throw new
|
|
162
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
160
163
|
default:
|
|
161
164
|
throw new errors.SpyglassError({
|
|
162
165
|
statusCode: _response.error.statusCode,
|
|
@@ -169,9 +172,10 @@ class SearchClient {
|
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
/**
|
|
172
|
-
* Find creators
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
+
* Find creators.
|
|
176
|
+
* Search semantically with `query`, or look them up by name, id, or
|
|
177
|
+
* social handle. Either way, you can also narrow the results with
|
|
178
|
+
* filters such as audience profile, location, and follower count.
|
|
175
179
|
*
|
|
176
180
|
* Send one search field. Each field is its own mode:
|
|
177
181
|
*
|
|
@@ -205,17 +209,17 @@ class SearchClient {
|
|
|
205
209
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
206
210
|
* row even when nothing matches.
|
|
207
211
|
*
|
|
208
|
-
* @param {
|
|
212
|
+
* @param {spyglass.SearchCreatorsRequest} request
|
|
209
213
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
210
214
|
*
|
|
211
|
-
* @throws {@link
|
|
212
|
-
* @throws {@link
|
|
213
|
-
* @throws {@link
|
|
214
|
-
* @throws {@link
|
|
215
|
-
* @throws {@link
|
|
216
|
-
* @throws {@link
|
|
217
|
-
* @throws {@link
|
|
218
|
-
* @throws {@link
|
|
215
|
+
* @throws {@link spyglass.BadRequestError}
|
|
216
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
217
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
218
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
219
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
220
|
+
* @throws {@link spyglass.ContentTooLargeError}
|
|
221
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
222
|
+
* @throws {@link spyglass.InternalServerError}
|
|
219
223
|
* @throws {@link errors.SpyglassError}
|
|
220
224
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
221
225
|
*
|
|
@@ -254,21 +258,21 @@ class SearchClient {
|
|
|
254
258
|
if (_response.error.reason === "status-code") {
|
|
255
259
|
switch (_response.error.statusCode) {
|
|
256
260
|
case 400:
|
|
257
|
-
throw new
|
|
261
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
258
262
|
case 401:
|
|
259
|
-
throw new
|
|
263
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
260
264
|
case 402:
|
|
261
|
-
throw new
|
|
265
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
262
266
|
case 403:
|
|
263
|
-
throw new
|
|
267
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
264
268
|
case 405:
|
|
265
|
-
throw new
|
|
269
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
266
270
|
case 413:
|
|
267
|
-
throw new
|
|
271
|
+
throw new spyglass.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
268
272
|
case 429:
|
|
269
|
-
throw new
|
|
273
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
270
274
|
case 500:
|
|
271
|
-
throw new
|
|
275
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
272
276
|
default:
|
|
273
277
|
throw new errors.SpyglassError({
|
|
274
278
|
statusCode: _response.error.statusCode,
|
|
@@ -289,17 +293,17 @@ class SearchClient {
|
|
|
289
293
|
* Costs 2,000 microdollars ($0.0020) per account returned, charged against your plan's monthly credits.
|
|
290
294
|
* An id that matches nothing returns 404 and is free.
|
|
291
295
|
*
|
|
292
|
-
* @param {
|
|
296
|
+
* @param {spyglass.GetAccountRequest} request
|
|
293
297
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
294
298
|
*
|
|
295
|
-
* @throws {@link
|
|
296
|
-
* @throws {@link
|
|
297
|
-
* @throws {@link
|
|
298
|
-
* @throws {@link
|
|
299
|
-
* @throws {@link
|
|
300
|
-
* @throws {@link
|
|
301
|
-
* @throws {@link
|
|
302
|
-
* @throws {@link
|
|
299
|
+
* @throws {@link spyglass.BadRequestError}
|
|
300
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
301
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
302
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
303
|
+
* @throws {@link spyglass.NotFoundError}
|
|
304
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
305
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
306
|
+
* @throws {@link spyglass.InternalServerError}
|
|
303
307
|
* @throws {@link errors.SpyglassError}
|
|
304
308
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
305
309
|
*
|
|
@@ -334,21 +338,21 @@ class SearchClient {
|
|
|
334
338
|
if (_response.error.reason === "status-code") {
|
|
335
339
|
switch (_response.error.statusCode) {
|
|
336
340
|
case 400:
|
|
337
|
-
throw new
|
|
341
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
338
342
|
case 401:
|
|
339
|
-
throw new
|
|
343
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
340
344
|
case 402:
|
|
341
|
-
throw new
|
|
345
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
342
346
|
case 403:
|
|
343
|
-
throw new
|
|
347
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
344
348
|
case 404:
|
|
345
|
-
throw new
|
|
349
|
+
throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
|
|
346
350
|
case 405:
|
|
347
|
-
throw new
|
|
351
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
348
352
|
case 429:
|
|
349
|
-
throw new
|
|
353
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
350
354
|
case 500:
|
|
351
|
-
throw new
|
|
355
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
352
356
|
default:
|
|
353
357
|
throw new errors.SpyglassError({
|
|
354
358
|
statusCode: _response.error.statusCode,
|
|
@@ -368,16 +372,16 @@ class SearchClient {
|
|
|
368
372
|
* Limited to 120 requests per minute per user.
|
|
369
373
|
* This call is free and does not use credits.
|
|
370
374
|
*
|
|
371
|
-
* @param {
|
|
375
|
+
* @param {spyglass.SearchTaxonomiesRequest} request
|
|
372
376
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
373
377
|
*
|
|
374
|
-
* @throws {@link
|
|
375
|
-
* @throws {@link
|
|
376
|
-
* @throws {@link
|
|
377
|
-
* @throws {@link
|
|
378
|
-
* @throws {@link
|
|
379
|
-
* @throws {@link
|
|
380
|
-
* @throws {@link
|
|
378
|
+
* @throws {@link spyglass.BadRequestError}
|
|
379
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
380
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
381
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
382
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
383
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
384
|
+
* @throws {@link spyglass.InternalServerError}
|
|
381
385
|
* @throws {@link errors.SpyglassError}
|
|
382
386
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
383
387
|
*
|
|
@@ -420,19 +424,19 @@ class SearchClient {
|
|
|
420
424
|
if (_response.error.reason === "status-code") {
|
|
421
425
|
switch (_response.error.statusCode) {
|
|
422
426
|
case 400:
|
|
423
|
-
throw new
|
|
427
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
424
428
|
case 401:
|
|
425
|
-
throw new
|
|
429
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
426
430
|
case 402:
|
|
427
|
-
throw new
|
|
431
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
428
432
|
case 403:
|
|
429
|
-
throw new
|
|
433
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
430
434
|
case 405:
|
|
431
|
-
throw new
|
|
435
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
432
436
|
case 429:
|
|
433
|
-
throw new
|
|
437
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
434
438
|
case 500:
|
|
435
|
-
throw new
|
|
439
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
436
440
|
default:
|
|
437
441
|
throw new errors.SpyglassError({
|
|
438
442
|
statusCode: _response.error.statusCode,
|
|
@@ -454,31 +458,31 @@ class SearchClient {
|
|
|
454
458
|
* The call bills a minimum of one row even when nothing matches. In that
|
|
455
459
|
* case `count` is 0 but you are charged for one row.
|
|
456
460
|
*
|
|
457
|
-
* @param {
|
|
461
|
+
* @param {spyglass.GetMediaRequest} request
|
|
458
462
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
459
463
|
*
|
|
460
|
-
* @throws {@link
|
|
461
|
-
* @throws {@link
|
|
462
|
-
* @throws {@link
|
|
463
|
-
* @throws {@link
|
|
464
|
-
* @throws {@link
|
|
465
|
-
* @throws {@link
|
|
466
|
-
* @throws {@link
|
|
467
|
-
* @throws {@link
|
|
468
|
-
* @throws {@link
|
|
464
|
+
* @throws {@link spyglass.BadRequestError}
|
|
465
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
466
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
467
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
468
|
+
* @throws {@link spyglass.NotFoundError}
|
|
469
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
470
|
+
* @throws {@link spyglass.ContentTooLargeError}
|
|
471
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
472
|
+
* @throws {@link spyglass.InternalServerError}
|
|
469
473
|
* @throws {@link errors.SpyglassError}
|
|
470
474
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
471
475
|
*
|
|
472
476
|
* @example
|
|
473
|
-
* await client.search.
|
|
477
|
+
* await client.search.getMedia({
|
|
474
478
|
* query: "comfort-focused video ads",
|
|
475
479
|
* limit: 20
|
|
476
480
|
* })
|
|
477
481
|
*/
|
|
478
|
-
|
|
479
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
482
|
+
getMedia(request = {}, requestOptions) {
|
|
483
|
+
return core.HttpResponsePromise.fromPromise(this.__getMedia(request, requestOptions));
|
|
480
484
|
}
|
|
481
|
-
|
|
485
|
+
__getMedia() {
|
|
482
486
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
483
487
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
484
488
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -503,23 +507,23 @@ class SearchClient {
|
|
|
503
507
|
if (_response.error.reason === "status-code") {
|
|
504
508
|
switch (_response.error.statusCode) {
|
|
505
509
|
case 400:
|
|
506
|
-
throw new
|
|
510
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
507
511
|
case 401:
|
|
508
|
-
throw new
|
|
512
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
509
513
|
case 402:
|
|
510
|
-
throw new
|
|
514
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
511
515
|
case 403:
|
|
512
|
-
throw new
|
|
516
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
513
517
|
case 404:
|
|
514
|
-
throw new
|
|
518
|
+
throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
|
|
515
519
|
case 405:
|
|
516
|
-
throw new
|
|
520
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
517
521
|
case 413:
|
|
518
|
-
throw new
|
|
522
|
+
throw new spyglass.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
519
523
|
case 429:
|
|
520
|
-
throw new
|
|
524
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
521
525
|
case 500:
|
|
522
|
-
throw new
|
|
526
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
523
527
|
default:
|
|
524
528
|
throw new errors.SpyglassError({
|
|
525
529
|
statusCode: _response.error.statusCode,
|
|
@@ -542,17 +546,17 @@ class SearchClient {
|
|
|
542
546
|
* Limited to 120 requests per minute per user.
|
|
543
547
|
* Costs 1,000 microdollars ($0.0010) per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
544
548
|
*
|
|
545
|
-
* @param {
|
|
549
|
+
* @param {spyglass.GetBrandMediaInsightsRequest} request
|
|
546
550
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
547
551
|
*
|
|
548
|
-
* @throws {@link
|
|
549
|
-
* @throws {@link
|
|
550
|
-
* @throws {@link
|
|
551
|
-
* @throws {@link
|
|
552
|
-
* @throws {@link
|
|
553
|
-
* @throws {@link
|
|
554
|
-
* @throws {@link
|
|
555
|
-
* @throws {@link
|
|
552
|
+
* @throws {@link spyglass.BadRequestError}
|
|
553
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
554
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
555
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
556
|
+
* @throws {@link spyglass.NotFoundError}
|
|
557
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
558
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
559
|
+
* @throws {@link spyglass.InternalServerError}
|
|
556
560
|
* @throws {@link errors.SpyglassError}
|
|
557
561
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
558
562
|
*
|
|
@@ -600,21 +604,21 @@ class SearchClient {
|
|
|
600
604
|
if (_response.error.reason === "status-code") {
|
|
601
605
|
switch (_response.error.statusCode) {
|
|
602
606
|
case 400:
|
|
603
|
-
throw new
|
|
607
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
604
608
|
case 401:
|
|
605
|
-
throw new
|
|
609
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
606
610
|
case 402:
|
|
607
|
-
throw new
|
|
611
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
608
612
|
case 403:
|
|
609
|
-
throw new
|
|
613
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
610
614
|
case 404:
|
|
611
|
-
throw new
|
|
615
|
+
throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
|
|
612
616
|
case 405:
|
|
613
|
-
throw new
|
|
617
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
614
618
|
case 429:
|
|
615
|
-
throw new
|
|
619
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
616
620
|
case 500:
|
|
617
|
-
throw new
|
|
621
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
618
622
|
default:
|
|
619
623
|
throw new errors.SpyglassError({
|
|
620
624
|
statusCode: _response.error.statusCode,
|
|
@@ -633,17 +637,17 @@ class SearchClient {
|
|
|
633
637
|
* Limited to 120 requests per minute per user.
|
|
634
638
|
* Costs 5,000 microdollars ($0.0050) per landing page returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
635
639
|
*
|
|
636
|
-
* @param {
|
|
640
|
+
* @param {spyglass.GetBrandLandingPagesRequest} request
|
|
637
641
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
638
642
|
*
|
|
639
|
-
* @throws {@link
|
|
640
|
-
* @throws {@link
|
|
641
|
-
* @throws {@link
|
|
642
|
-
* @throws {@link
|
|
643
|
-
* @throws {@link
|
|
644
|
-
* @throws {@link
|
|
645
|
-
* @throws {@link
|
|
646
|
-
* @throws {@link
|
|
643
|
+
* @throws {@link spyglass.BadRequestError}
|
|
644
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
645
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
646
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
647
|
+
* @throws {@link spyglass.NotFoundError}
|
|
648
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
649
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
650
|
+
* @throws {@link spyglass.InternalServerError}
|
|
647
651
|
* @throws {@link errors.SpyglassError}
|
|
648
652
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
649
653
|
*
|
|
@@ -689,21 +693,21 @@ class SearchClient {
|
|
|
689
693
|
if (_response.error.reason === "status-code") {
|
|
690
694
|
switch (_response.error.statusCode) {
|
|
691
695
|
case 400:
|
|
692
|
-
throw new
|
|
696
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
693
697
|
case 401:
|
|
694
|
-
throw new
|
|
698
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
695
699
|
case 402:
|
|
696
|
-
throw new
|
|
700
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
697
701
|
case 403:
|
|
698
|
-
throw new
|
|
702
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
699
703
|
case 404:
|
|
700
|
-
throw new
|
|
704
|
+
throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
|
|
701
705
|
case 405:
|
|
702
|
-
throw new
|
|
706
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
703
707
|
case 429:
|
|
704
|
-
throw new
|
|
708
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
705
709
|
case 500:
|
|
706
|
-
throw new
|
|
710
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
707
711
|
default:
|
|
708
712
|
throw new errors.SpyglassError({
|
|
709
713
|
statusCode: _response.error.statusCode,
|
|
@@ -740,17 +744,17 @@ class SearchClient {
|
|
|
740
744
|
* Each comment page fetched live (`limit`, default 1) is one billed
|
|
741
745
|
* unit. Cached posts do not scrape and are not billed.
|
|
742
746
|
*
|
|
743
|
-
* @param {
|
|
747
|
+
* @param {spyglass.GetCommentsRequest} request
|
|
744
748
|
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
745
749
|
*
|
|
746
|
-
* @throws {@link
|
|
747
|
-
* @throws {@link
|
|
748
|
-
* @throws {@link
|
|
749
|
-
* @throws {@link
|
|
750
|
-
* @throws {@link
|
|
751
|
-
* @throws {@link
|
|
752
|
-
* @throws {@link
|
|
753
|
-
* @throws {@link
|
|
750
|
+
* @throws {@link spyglass.BadRequestError}
|
|
751
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
752
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
753
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
754
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
755
|
+
* @throws {@link spyglass.ContentTooLargeError}
|
|
756
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
757
|
+
* @throws {@link spyglass.InternalServerError}
|
|
754
758
|
* @throws {@link errors.SpyglassError}
|
|
755
759
|
* @throws {@link errors.SpyglassTimeoutError}
|
|
756
760
|
*
|
|
@@ -789,21 +793,21 @@ class SearchClient {
|
|
|
789
793
|
if (_response.error.reason === "status-code") {
|
|
790
794
|
switch (_response.error.statusCode) {
|
|
791
795
|
case 400:
|
|
792
|
-
throw new
|
|
796
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
793
797
|
case 401:
|
|
794
|
-
throw new
|
|
798
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
795
799
|
case 402:
|
|
796
|
-
throw new
|
|
800
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
797
801
|
case 403:
|
|
798
|
-
throw new
|
|
802
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
799
803
|
case 405:
|
|
800
|
-
throw new
|
|
804
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
801
805
|
case 413:
|
|
802
|
-
throw new
|
|
806
|
+
throw new spyglass.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
803
807
|
case 429:
|
|
804
|
-
throw new
|
|
808
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
805
809
|
case 500:
|
|
806
|
-
throw new
|
|
810
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
807
811
|
default:
|
|
808
812
|
throw new errors.SpyglassError({
|
|
809
813
|
statusCode: _response.error.statusCode,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as spyglass from "../../../../index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
@@ -8,6 +8,6 @@ import type * as Spyglass from "../../../../index.js";
|
|
|
8
8
|
export interface GetBrandLandingPagesRequest {
|
|
9
9
|
/** Brand or creator id returned by POST /brands or POST /creators. */
|
|
10
10
|
id: string;
|
|
11
|
-
showInactive?:
|
|
11
|
+
showInactive?: spyglass.GetBrandLandingPagesRequestShowInactive;
|
|
12
12
|
limit?: number;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as spyglass from "../../../../index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
@@ -9,7 +9,7 @@ import type * as Spyglass from "../../../../index.js";
|
|
|
9
9
|
export interface GetBrandMediaInsightsRequest {
|
|
10
10
|
/** Brand or creator id returned by POST /brands or POST /creators. */
|
|
11
11
|
id: string;
|
|
12
|
-
type:
|
|
12
|
+
type: spyglass.GetBrandMediaInsightsRequestType;
|
|
13
13
|
maxDaysBack?: number;
|
|
14
14
|
limit?: number;
|
|
15
15
|
}
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
* limit: 20
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface GetMediaRequest {
|
|
9
9
|
/** Brand id given as a platform string or uuid */
|
|
10
|
-
brandId?:
|
|
10
|
+
brandId?: GetMediaRequest.BrandId;
|
|
11
11
|
query?: string;
|
|
12
|
-
channel?:
|
|
13
|
-
format?:
|
|
14
|
-
duration?:
|
|
15
|
-
status?:
|
|
16
|
-
categories?:
|
|
12
|
+
channel?: GetMediaRequest.Channel.Item[];
|
|
13
|
+
format?: GetMediaRequest.Format.Item[];
|
|
14
|
+
duration?: GetMediaRequest.Duration.Item[];
|
|
15
|
+
status?: GetMediaRequest.Status;
|
|
16
|
+
categories?: GetMediaRequest.Categories.Item[];
|
|
17
17
|
taxonomy?: string[];
|
|
18
|
-
funnelStage?:
|
|
19
|
-
language?:
|
|
18
|
+
funnelStage?: GetMediaRequest.FunnelStage.Item[];
|
|
19
|
+
language?: GetMediaRequest.Language.Item[];
|
|
20
20
|
location?: string[];
|
|
21
|
-
datePreset?:
|
|
21
|
+
datePreset?: GetMediaRequest.DatePreset;
|
|
22
22
|
startDate?: string;
|
|
23
23
|
endDate?: string;
|
|
24
24
|
minDaysRun?: number;
|
|
@@ -26,15 +26,15 @@ export interface GetMediaV2Request {
|
|
|
26
26
|
minViewCount?: number;
|
|
27
27
|
maxViewCount?: number;
|
|
28
28
|
landingPage?: string;
|
|
29
|
-
landingPageMatch?:
|
|
29
|
+
landingPageMatch?: GetMediaRequest.LandingPageMatch;
|
|
30
30
|
lowImpressions?: boolean;
|
|
31
31
|
partnershipAd?: boolean;
|
|
32
32
|
crossposted?: boolean;
|
|
33
|
-
sortBy?:
|
|
33
|
+
sortBy?: GetMediaRequest.SortBy;
|
|
34
34
|
limit?: number;
|
|
35
35
|
offset?: number;
|
|
36
36
|
}
|
|
37
|
-
export declare namespace
|
|
37
|
+
export declare namespace GetMediaRequest {
|
|
38
38
|
/**
|
|
39
39
|
* Brand id given as a platform string or uuid
|
|
40
40
|
*/
|