@spyglasshq/sdk 0.1.9 → 0.1.10
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +8 -8
- package/dist/cjs/Client.js +8 -8
- package/dist/cjs/api/client/requests/SearchBrandsRequest.d.ts +4 -4
- package/dist/cjs/api/client/requests/SearchCreatorsRequest.d.ts +4 -4
- package/dist/cjs/api/client/requests/SearchMediaRequest.d.ts +2 -2
- package/dist/cjs/api/resources/account/client/Client.d.ts +63 -3
- package/dist/cjs/api/resources/account/client/Client.js +191 -4
- package/dist/cjs/api/resources/account/client/requests/CampaignsAccountRequest.d.ts +18 -0
- package/dist/cjs/api/resources/account/client/requests/CampaignsAccountRequest.js +3 -0
- package/dist/cjs/api/resources/account/client/requests/CollabsAccountRequest.d.ts +12 -0
- package/dist/cjs/api/resources/account/client/requests/CollabsAccountRequest.js +3 -0
- package/dist/cjs/api/resources/account/client/requests/LandingPagesAccountRequest.d.ts +1 -0
- package/dist/cjs/api/resources/account/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestDatePreset.d.ts +17 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestDatePreset.js +20 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestSortBy.d.ts +5 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestSortBy.js +8 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestType.d.ts +5 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestType.js +8 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountResponse.d.ts +20 -0
- package/dist/cjs/api/resources/account/types/CampaignsAccountResponse.js +3 -0
- package/dist/cjs/api/resources/account/types/CollabsAccountResponse.d.ts +14 -0
- package/dist/cjs/api/resources/account/types/CollabsAccountResponse.js +3 -0
- package/dist/cjs/api/resources/account/types/InsightsAccountResponse.d.ts +0 -10
- package/dist/cjs/api/resources/account/types/index.d.ts +5 -0
- package/dist/cjs/api/resources/account/types/index.js +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +8 -8
- package/dist/esm/Client.mjs +8 -8
- package/dist/esm/api/client/requests/SearchBrandsRequest.d.mts +4 -4
- package/dist/esm/api/client/requests/SearchCreatorsRequest.d.mts +4 -4
- package/dist/esm/api/client/requests/SearchMediaRequest.d.mts +2 -2
- package/dist/esm/api/resources/account/client/Client.d.mts +63 -3
- package/dist/esm/api/resources/account/client/Client.mjs +191 -4
- package/dist/esm/api/resources/account/client/requests/CampaignsAccountRequest.d.mts +18 -0
- package/dist/esm/api/resources/account/client/requests/CampaignsAccountRequest.mjs +2 -0
- package/dist/esm/api/resources/account/client/requests/CollabsAccountRequest.d.mts +12 -0
- package/dist/esm/api/resources/account/client/requests/CollabsAccountRequest.mjs +2 -0
- package/dist/esm/api/resources/account/client/requests/LandingPagesAccountRequest.d.mts +1 -0
- package/dist/esm/api/resources/account/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestDatePreset.d.mts +17 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestDatePreset.mjs +17 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestSortBy.d.mts +5 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestSortBy.mjs +5 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestType.d.mts +5 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestType.mjs +5 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountResponse.d.mts +20 -0
- package/dist/esm/api/resources/account/types/CampaignsAccountResponse.mjs +2 -0
- package/dist/esm/api/resources/account/types/CollabsAccountResponse.d.mts +14 -0
- package/dist/esm/api/resources/account/types/CollabsAccountResponse.mjs +2 -0
- package/dist/esm/api/resources/account/types/InsightsAccountResponse.d.mts +0 -10
- package/dist/esm/api/resources/account/types/index.d.mts +5 -0
- package/dist/esm/api/resources/account/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +153 -11
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
'X-Fern-Language': 'JavaScript',
|
|
45
45
|
'X-Fern-SDK-Name': '@spyglasshq/sdk',
|
|
46
|
-
'X-Fern-SDK-Version': '0.1.
|
|
47
|
-
'User-Agent': '@spyglasshq/sdk/0.1.
|
|
46
|
+
'X-Fern-SDK-Version': '0.1.10',
|
|
47
|
+
'User-Agent': '@spyglasshq/sdk/0.1.10',
|
|
48
48
|
'X-Fern-Runtime': core.RUNTIME.type,
|
|
49
49
|
'X-Fern-Runtime-Version': core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class Spyglass {
|
|
|
26
26
|
* when nothing matches.
|
|
27
27
|
* - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
|
|
28
28
|
* match). Pass every name in one array.
|
|
29
|
-
* - **ID** (`
|
|
29
|
+
* - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
|
|
30
30
|
* in `unmatchedIds`. `limit` and `offset` are ignored.
|
|
31
31
|
* - **Instagram** (`igUsername`). Case-insensitive contains match on the
|
|
32
32
|
* handle. A leading `@` is ignored.
|
|
@@ -35,7 +35,7 @@ export declare class Spyglass {
|
|
|
35
35
|
* If a request includes more than one of these fields, only the highest
|
|
36
36
|
* priority field is used. The rest are ignored:
|
|
37
37
|
*
|
|
38
|
-
* 1. `
|
|
38
|
+
* 1. `ids`
|
|
39
39
|
* 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
|
|
40
40
|
* 3. `names`
|
|
41
41
|
* 4. `query`
|
|
@@ -47,7 +47,7 @@ export declare class Spyglass {
|
|
|
47
47
|
* every mode except ID.
|
|
48
48
|
*
|
|
49
49
|
* Limited to 120 requests per minute per user.
|
|
50
|
-
* Costs
|
|
50
|
+
* Costs $0.0010 per brand returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
51
51
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
52
52
|
* row even when nothing matches.
|
|
53
53
|
*
|
|
@@ -86,7 +86,7 @@ export declare class Spyglass {
|
|
|
86
86
|
* when nothing matches.
|
|
87
87
|
* - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
|
|
88
88
|
* match). Pass every name in one array.
|
|
89
|
-
* - **ID** (`
|
|
89
|
+
* - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
|
|
90
90
|
* in `unmatchedIds`. `limit` and `offset` are ignored.
|
|
91
91
|
* - **Instagram** (`igUsername`). Case-insensitive contains match on the
|
|
92
92
|
* handle. A leading `@` is ignored.
|
|
@@ -95,7 +95,7 @@ export declare class Spyglass {
|
|
|
95
95
|
* If a request includes more than one of these fields, only the highest
|
|
96
96
|
* priority field is used. The rest are ignored:
|
|
97
97
|
*
|
|
98
|
-
* 1. `
|
|
98
|
+
* 1. `ids`
|
|
99
99
|
* 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
|
|
100
100
|
* 3. `names`
|
|
101
101
|
* 4. `query`
|
|
@@ -107,7 +107,7 @@ export declare class Spyglass {
|
|
|
107
107
|
* every mode except ID.
|
|
108
108
|
*
|
|
109
109
|
* Limited to 120 requests per minute per user.
|
|
110
|
-
* Costs
|
|
110
|
+
* Costs $0.0010 per creator returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
111
111
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
112
112
|
* row even when nothing matches.
|
|
113
113
|
*
|
|
@@ -168,7 +168,7 @@ export declare class Spyglass {
|
|
|
168
168
|
* `query` is required.
|
|
169
169
|
*
|
|
170
170
|
* Limited to 120 requests per minute per user.
|
|
171
|
-
* Costs
|
|
171
|
+
* Costs $0.0005 per creative returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
172
172
|
* The call bills a minimum of one row even when nothing matches. In that
|
|
173
173
|
* case `count` is 0 but you are charged for one row.
|
|
174
174
|
*
|
|
@@ -242,7 +242,7 @@ export declare class Spyglass {
|
|
|
242
242
|
* are served from cache.
|
|
243
243
|
*
|
|
244
244
|
* Limited to 20 requests per minute per user.
|
|
245
|
-
* Costs
|
|
245
|
+
* Costs $0.0050 per successful page of comments returned, charged against your plan's monthly credits.
|
|
246
246
|
* Each comment page fetched live (`limit`, default 1) is one billed
|
|
247
247
|
* unit. Cached posts do not scrape and are not billed.
|
|
248
248
|
*
|
package/dist/cjs/Client.js
CHANGED
|
@@ -74,7 +74,7 @@ class Spyglass {
|
|
|
74
74
|
* when nothing matches.
|
|
75
75
|
* - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
|
|
76
76
|
* match). Pass every name in one array.
|
|
77
|
-
* - **ID** (`
|
|
77
|
+
* - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
|
|
78
78
|
* in `unmatchedIds`. `limit` and `offset` are ignored.
|
|
79
79
|
* - **Instagram** (`igUsername`). Case-insensitive contains match on the
|
|
80
80
|
* handle. A leading `@` is ignored.
|
|
@@ -83,7 +83,7 @@ class Spyglass {
|
|
|
83
83
|
* If a request includes more than one of these fields, only the highest
|
|
84
84
|
* priority field is used. The rest are ignored:
|
|
85
85
|
*
|
|
86
|
-
* 1. `
|
|
86
|
+
* 1. `ids`
|
|
87
87
|
* 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
|
|
88
88
|
* 3. `names`
|
|
89
89
|
* 4. `query`
|
|
@@ -95,7 +95,7 @@ class Spyglass {
|
|
|
95
95
|
* every mode except ID.
|
|
96
96
|
*
|
|
97
97
|
* Limited to 120 requests per minute per user.
|
|
98
|
-
* Costs
|
|
98
|
+
* Costs $0.0010 per brand returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
99
99
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
100
100
|
* row even when nothing matches.
|
|
101
101
|
*
|
|
@@ -189,7 +189,7 @@ class Spyglass {
|
|
|
189
189
|
* when nothing matches.
|
|
190
190
|
* - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
|
|
191
191
|
* match). Pass every name in one array.
|
|
192
|
-
* - **ID** (`
|
|
192
|
+
* - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
|
|
193
193
|
* in `unmatchedIds`. `limit` and `offset` are ignored.
|
|
194
194
|
* - **Instagram** (`igUsername`). Case-insensitive contains match on the
|
|
195
195
|
* handle. A leading `@` is ignored.
|
|
@@ -198,7 +198,7 @@ class Spyglass {
|
|
|
198
198
|
* If a request includes more than one of these fields, only the highest
|
|
199
199
|
* priority field is used. The rest are ignored:
|
|
200
200
|
*
|
|
201
|
-
* 1. `
|
|
201
|
+
* 1. `ids`
|
|
202
202
|
* 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
|
|
203
203
|
* 3. `names`
|
|
204
204
|
* 4. `query`
|
|
@@ -210,7 +210,7 @@ class Spyglass {
|
|
|
210
210
|
* every mode except ID.
|
|
211
211
|
*
|
|
212
212
|
* Limited to 120 requests per minute per user.
|
|
213
|
-
* Costs
|
|
213
|
+
* Costs $0.0010 per creator returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
214
214
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
215
215
|
* row even when nothing matches.
|
|
216
216
|
*
|
|
@@ -385,7 +385,7 @@ class Spyglass {
|
|
|
385
385
|
* `query` is required.
|
|
386
386
|
*
|
|
387
387
|
* Limited to 120 requests per minute per user.
|
|
388
|
-
* Costs
|
|
388
|
+
* Costs $0.0005 per creative returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
389
389
|
* The call bills a minimum of one row even when nothing matches. In that
|
|
390
390
|
* case `count` is 0 but you are charged for one row.
|
|
391
391
|
*
|
|
@@ -566,7 +566,7 @@ class Spyglass {
|
|
|
566
566
|
* are served from cache.
|
|
567
567
|
*
|
|
568
568
|
* Limited to 20 requests per minute per user.
|
|
569
|
-
* Costs
|
|
569
|
+
* Costs $0.0050 per successful page of comments returned, charged against your plan's monthly credits.
|
|
570
570
|
* Each comment page fetched live (`limit`, default 1) is one billed
|
|
571
571
|
* unit. Cached posts do not scrape and are not billed.
|
|
572
572
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface SearchBrandsRequest {
|
|
9
|
-
|
|
9
|
+
ids?: SearchBrandsRequest.Ids.Item[];
|
|
10
10
|
names?: string[];
|
|
11
11
|
igUsername?: string;
|
|
12
12
|
tiktokUsername?: string;
|
|
@@ -20,10 +20,10 @@ export interface SearchBrandsRequest {
|
|
|
20
20
|
taxonomy?: string[];
|
|
21
21
|
}
|
|
22
22
|
export declare namespace SearchBrandsRequest {
|
|
23
|
-
type
|
|
24
|
-
namespace
|
|
23
|
+
type Ids = Ids.Item[];
|
|
24
|
+
namespace Ids {
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Account id given as a platform string or uuid
|
|
27
27
|
*/
|
|
28
28
|
type Item = string | number;
|
|
29
29
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* }
|
|
8
8
|
*/
|
|
9
9
|
export interface SearchCreatorsRequest {
|
|
10
|
-
|
|
10
|
+
ids?: SearchCreatorsRequest.Ids.Item[];
|
|
11
11
|
names?: string[];
|
|
12
12
|
igUsername?: string;
|
|
13
13
|
tiktokUsername?: string;
|
|
@@ -24,10 +24,10 @@ export interface SearchCreatorsRequest {
|
|
|
24
24
|
language?: SearchCreatorsRequest.Language;
|
|
25
25
|
}
|
|
26
26
|
export declare namespace SearchCreatorsRequest {
|
|
27
|
-
type
|
|
28
|
-
namespace
|
|
27
|
+
type Ids = Ids.Item[];
|
|
28
|
+
namespace Ids {
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Account id given as a platform string or uuid
|
|
31
31
|
*/
|
|
32
32
|
type Item = string | number;
|
|
33
33
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface SearchMediaRequest {
|
|
9
|
-
/**
|
|
9
|
+
/** Account id given as a platform string or uuid */
|
|
10
10
|
accountId?: SearchMediaRequest.AccountId;
|
|
11
11
|
query?: string;
|
|
12
12
|
channel?: SearchMediaRequest.Channel.Item[];
|
|
@@ -36,7 +36,7 @@ export interface SearchMediaRequest {
|
|
|
36
36
|
}
|
|
37
37
|
export declare namespace SearchMediaRequest {
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Account id given as a platform string or uuid
|
|
40
40
|
*/
|
|
41
41
|
type AccountId = string | number;
|
|
42
42
|
type Channel = Channel.Item[];
|
|
@@ -16,7 +16,7 @@ export declare class AccountClient {
|
|
|
16
16
|
* (`gender`, `ageRange`, ...) are present only on `CREATOR`.
|
|
17
17
|
*
|
|
18
18
|
* Limited to 120 requests per minute per user.
|
|
19
|
-
* Costs
|
|
19
|
+
* Costs $0.0010 per account returned, charged against your plan's monthly credits.
|
|
20
20
|
* An id that matches nothing returns 404 and is free.
|
|
21
21
|
*
|
|
22
22
|
* @param {spyglass.GetAccountRequest} request
|
|
@@ -49,7 +49,7 @@ export declare class AccountClient {
|
|
|
49
49
|
* `totals` to creatives that started within the requested window.
|
|
50
50
|
*
|
|
51
51
|
* Limited to 120 requests per minute per user.
|
|
52
|
-
* Costs
|
|
52
|
+
* Costs $0.0005 per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
53
53
|
*
|
|
54
54
|
* @param {spyglass.InsightsAccountRequest} request
|
|
55
55
|
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -73,12 +73,72 @@ export declare class AccountClient {
|
|
|
73
73
|
*/
|
|
74
74
|
insights(request: spyglass.InsightsAccountRequest, requestOptions?: AccountClient.RequestOptions): core.HttpResponsePromise<spyglass.InsightsAccountResponse>;
|
|
75
75
|
private __insights;
|
|
76
|
+
/**
|
|
77
|
+
* Return an account’s campaigns or offers, newest start date first.
|
|
78
|
+
* `datePreset`, or `startDate` and `endDate`, filter by campaign
|
|
79
|
+
* start date. Omit both for all time.
|
|
80
|
+
*
|
|
81
|
+
* Limited to 120 requests per minute per user.
|
|
82
|
+
* Costs $0.0005 per campaign returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
83
|
+
*
|
|
84
|
+
* @param {spyglass.CampaignsAccountRequest} request
|
|
85
|
+
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
86
|
+
*
|
|
87
|
+
* @throws {@link spyglass.BadRequestError}
|
|
88
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
89
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
90
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
91
|
+
* @throws {@link spyglass.NotFoundError}
|
|
92
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
93
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
94
|
+
* @throws {@link spyglass.InternalServerError}
|
|
95
|
+
* @throws {@link errors.SpyglassError}
|
|
96
|
+
* @throws {@link errors.SpyglassTimeoutError}
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* await client.account.campaigns({
|
|
100
|
+
* id: "id",
|
|
101
|
+
* type: "CAMPAIGN"
|
|
102
|
+
* })
|
|
103
|
+
*/
|
|
104
|
+
campaigns(request: spyglass.CampaignsAccountRequest, requestOptions?: AccountClient.RequestOptions): core.HttpResponsePromise<spyglass.CampaignsAccountResponse>;
|
|
105
|
+
private __campaigns;
|
|
106
|
+
/**
|
|
107
|
+
* Return the creators an account has collaborated with, ordered from
|
|
108
|
+
* most media to least. Works for both brands and creators.
|
|
109
|
+
* mediaCount is how many of that account’s media items tag the
|
|
110
|
+
* creator.
|
|
111
|
+
*
|
|
112
|
+
* Limited to 120 requests per minute per user.
|
|
113
|
+
* Costs $0.0005 per collab returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
114
|
+
*
|
|
115
|
+
* @param {spyglass.CollabsAccountRequest} request
|
|
116
|
+
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
117
|
+
*
|
|
118
|
+
* @throws {@link spyglass.BadRequestError}
|
|
119
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
120
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
121
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
122
|
+
* @throws {@link spyglass.NotFoundError}
|
|
123
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
124
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
125
|
+
* @throws {@link spyglass.InternalServerError}
|
|
126
|
+
* @throws {@link errors.SpyglassError}
|
|
127
|
+
* @throws {@link errors.SpyglassTimeoutError}
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* await client.account.collabs({
|
|
131
|
+
* id: "id"
|
|
132
|
+
* })
|
|
133
|
+
*/
|
|
134
|
+
collabs(request: spyglass.CollabsAccountRequest, requestOptions?: AccountClient.RequestOptions): core.HttpResponsePromise<spyglass.CollabsAccountResponse>;
|
|
135
|
+
private __collabs;
|
|
76
136
|
/**
|
|
77
137
|
* Return the landing-page URLs an account sends ad traffic to, ranked by
|
|
78
138
|
* how often they appear across its ads.
|
|
79
139
|
*
|
|
80
140
|
* Limited to 120 requests per minute per user.
|
|
81
|
-
* Costs
|
|
141
|
+
* Costs $0.0025 per landing page returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
82
142
|
*
|
|
83
143
|
* @param {spyglass.LandingPagesAccountRequest} request
|
|
84
144
|
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -62,7 +62,7 @@ class AccountClient {
|
|
|
62
62
|
* (`gender`, `ageRange`, ...) are present only on `CREATOR`.
|
|
63
63
|
*
|
|
64
64
|
* Limited to 120 requests per minute per user.
|
|
65
|
-
* Costs
|
|
65
|
+
* Costs $0.0010 per account returned, charged against your plan's monthly credits.
|
|
66
66
|
* An id that matches nothing returns 404 and is free.
|
|
67
67
|
*
|
|
68
68
|
* @param {spyglass.GetAccountRequest} request
|
|
@@ -148,7 +148,7 @@ class AccountClient {
|
|
|
148
148
|
* `totals` to creatives that started within the requested window.
|
|
149
149
|
*
|
|
150
150
|
* Limited to 120 requests per minute per user.
|
|
151
|
-
* Costs
|
|
151
|
+
* Costs $0.0005 per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
152
152
|
*
|
|
153
153
|
* @param {spyglass.InsightsAccountRequest} request
|
|
154
154
|
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -234,12 +234,198 @@ class AccountClient {
|
|
|
234
234
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, 'GET', '/account/{id}/insights');
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Return an account’s campaigns or offers, newest start date first.
|
|
239
|
+
* `datePreset`, or `startDate` and `endDate`, filter by campaign
|
|
240
|
+
* start date. Omit both for all time.
|
|
241
|
+
*
|
|
242
|
+
* Limited to 120 requests per minute per user.
|
|
243
|
+
* Costs $0.0005 per campaign returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
244
|
+
*
|
|
245
|
+
* @param {spyglass.CampaignsAccountRequest} request
|
|
246
|
+
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
247
|
+
*
|
|
248
|
+
* @throws {@link spyglass.BadRequestError}
|
|
249
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
250
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
251
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
252
|
+
* @throws {@link spyglass.NotFoundError}
|
|
253
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
254
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
255
|
+
* @throws {@link spyglass.InternalServerError}
|
|
256
|
+
* @throws {@link errors.SpyglassError}
|
|
257
|
+
* @throws {@link errors.SpyglassTimeoutError}
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* await client.account.campaigns({
|
|
261
|
+
* id: "id",
|
|
262
|
+
* type: "CAMPAIGN"
|
|
263
|
+
* })
|
|
264
|
+
*/
|
|
265
|
+
campaigns(request, requestOptions) {
|
|
266
|
+
return core.HttpResponsePromise.fromPromise(this.__campaigns(request, requestOptions));
|
|
267
|
+
}
|
|
268
|
+
__campaigns(request, requestOptions) {
|
|
269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
271
|
+
const { id, type: type_, sortBy, limit, datePreset, startDate, endDate } = request;
|
|
272
|
+
const _queryParams = {
|
|
273
|
+
type: type_,
|
|
274
|
+
sortBy: sortBy != null ? sortBy : undefined,
|
|
275
|
+
limit,
|
|
276
|
+
datePreset: datePreset != null ? datePreset : undefined,
|
|
277
|
+
startDate,
|
|
278
|
+
endDate,
|
|
279
|
+
};
|
|
280
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
281
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
282
|
+
const _response = yield core.fetcher({
|
|
283
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SpyglassEnvironment.Default, `account/${core.url.encodePathParam(id, errors.SpyglassError)}/campaigns`),
|
|
284
|
+
method: 'GET',
|
|
285
|
+
headers: _headers,
|
|
286
|
+
queryString: core.url
|
|
287
|
+
.queryBuilder()
|
|
288
|
+
.addMany(_queryParams)
|
|
289
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
290
|
+
.build(),
|
|
291
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
292
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
293
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
294
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
295
|
+
logging: this._options.logging,
|
|
296
|
+
});
|
|
297
|
+
if (_response.ok) {
|
|
298
|
+
return {
|
|
299
|
+
data: _response.body,
|
|
300
|
+
rawResponse: _response.rawResponse,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
if (_response.error.reason === 'status-code') {
|
|
304
|
+
switch (_response.error.statusCode) {
|
|
305
|
+
case 400:
|
|
306
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
307
|
+
case 401:
|
|
308
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
309
|
+
case 402:
|
|
310
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
311
|
+
case 403:
|
|
312
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
313
|
+
case 404:
|
|
314
|
+
throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
|
|
315
|
+
case 405:
|
|
316
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
317
|
+
case 429:
|
|
318
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
319
|
+
case 500:
|
|
320
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
321
|
+
default:
|
|
322
|
+
throw new errors.SpyglassError({
|
|
323
|
+
statusCode: _response.error.statusCode,
|
|
324
|
+
body: _response.error.body,
|
|
325
|
+
rawResponse: _response.rawResponse,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, 'GET', '/account/{id}/campaigns');
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Return the creators an account has collaborated with, ordered from
|
|
334
|
+
* most media to least. Works for both brands and creators.
|
|
335
|
+
* mediaCount is how many of that account’s media items tag the
|
|
336
|
+
* creator.
|
|
337
|
+
*
|
|
338
|
+
* Limited to 120 requests per minute per user.
|
|
339
|
+
* Costs $0.0005 per collab returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
340
|
+
*
|
|
341
|
+
* @param {spyglass.CollabsAccountRequest} request
|
|
342
|
+
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
343
|
+
*
|
|
344
|
+
* @throws {@link spyglass.BadRequestError}
|
|
345
|
+
* @throws {@link spyglass.UnauthorizedError}
|
|
346
|
+
* @throws {@link spyglass.PaymentRequiredError}
|
|
347
|
+
* @throws {@link spyglass.ForbiddenError}
|
|
348
|
+
* @throws {@link spyglass.NotFoundError}
|
|
349
|
+
* @throws {@link spyglass.MethodNotAllowedError}
|
|
350
|
+
* @throws {@link spyglass.TooManyRequestsError}
|
|
351
|
+
* @throws {@link spyglass.InternalServerError}
|
|
352
|
+
* @throws {@link errors.SpyglassError}
|
|
353
|
+
* @throws {@link errors.SpyglassTimeoutError}
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* await client.account.collabs({
|
|
357
|
+
* id: "id"
|
|
358
|
+
* })
|
|
359
|
+
*/
|
|
360
|
+
collabs(request, requestOptions) {
|
|
361
|
+
return core.HttpResponsePromise.fromPromise(this.__collabs(request, requestOptions));
|
|
362
|
+
}
|
|
363
|
+
__collabs(request, requestOptions) {
|
|
364
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
365
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
366
|
+
const { id, limit, offset } = request;
|
|
367
|
+
const _queryParams = {
|
|
368
|
+
limit,
|
|
369
|
+
offset,
|
|
370
|
+
};
|
|
371
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
372
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
373
|
+
const _response = yield core.fetcher({
|
|
374
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SpyglassEnvironment.Default, `account/${core.url.encodePathParam(id, errors.SpyglassError)}/collabs`),
|
|
375
|
+
method: 'GET',
|
|
376
|
+
headers: _headers,
|
|
377
|
+
queryString: core.url
|
|
378
|
+
.queryBuilder()
|
|
379
|
+
.addMany(_queryParams)
|
|
380
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
381
|
+
.build(),
|
|
382
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
383
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
384
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
385
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
386
|
+
logging: this._options.logging,
|
|
387
|
+
});
|
|
388
|
+
if (_response.ok) {
|
|
389
|
+
return {
|
|
390
|
+
data: _response.body,
|
|
391
|
+
rawResponse: _response.rawResponse,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
if (_response.error.reason === 'status-code') {
|
|
395
|
+
switch (_response.error.statusCode) {
|
|
396
|
+
case 400:
|
|
397
|
+
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
398
|
+
case 401:
|
|
399
|
+
throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
400
|
+
case 402:
|
|
401
|
+
throw new spyglass.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
402
|
+
case 403:
|
|
403
|
+
throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
404
|
+
case 404:
|
|
405
|
+
throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
|
|
406
|
+
case 405:
|
|
407
|
+
throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
408
|
+
case 429:
|
|
409
|
+
throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
410
|
+
case 500:
|
|
411
|
+
throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
|
|
412
|
+
default:
|
|
413
|
+
throw new errors.SpyglassError({
|
|
414
|
+
statusCode: _response.error.statusCode,
|
|
415
|
+
body: _response.error.body,
|
|
416
|
+
rawResponse: _response.rawResponse,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, 'GET', '/account/{id}/collabs');
|
|
421
|
+
});
|
|
422
|
+
}
|
|
237
423
|
/**
|
|
238
424
|
* Return the landing-page URLs an account sends ad traffic to, ranked by
|
|
239
425
|
* how often they appear across its ads.
|
|
240
426
|
*
|
|
241
427
|
* Limited to 120 requests per minute per user.
|
|
242
|
-
* Costs
|
|
428
|
+
* Costs $0.0025 per landing page returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
243
429
|
*
|
|
244
430
|
* @param {spyglass.LandingPagesAccountRequest} request
|
|
245
431
|
* @param {AccountClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -266,10 +452,11 @@ class AccountClient {
|
|
|
266
452
|
__landingPages(request, requestOptions) {
|
|
267
453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
268
454
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
269
|
-
const { id, showInactive, limit } = request;
|
|
455
|
+
const { id, showInactive, limit, offset } = request;
|
|
270
456
|
const _queryParams = {
|
|
271
457
|
showInactive: showInactive != null ? showInactive : undefined,
|
|
272
458
|
limit,
|
|
459
|
+
offset,
|
|
273
460
|
};
|
|
274
461
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
275
462
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as spyglass from '../../../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* id: "id",
|
|
6
|
+
* type: "CAMPAIGN"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface CampaignsAccountRequest {
|
|
10
|
+
/** Brand id returned by POST /brands/search. */
|
|
11
|
+
id: string;
|
|
12
|
+
type: spyglass.CampaignsAccountRequestType;
|
|
13
|
+
sortBy?: spyglass.CampaignsAccountRequestSortBy;
|
|
14
|
+
limit?: number;
|
|
15
|
+
datePreset?: spyglass.CampaignsAccountRequestDatePreset;
|
|
16
|
+
startDate?: string;
|
|
17
|
+
endDate?: string;
|
|
18
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { CampaignsAccountRequest } from './CampaignsAccountRequest.js';
|
|
2
|
+
export type { CollabsAccountRequest } from './CollabsAccountRequest.js';
|
|
1
3
|
export type { GetAccountRequest } from './GetAccountRequest.js';
|
|
2
4
|
export type { IndexAccountRequest } from './IndexAccountRequest.js';
|
|
3
5
|
export type { IndexStatusAccountRequest } from './IndexStatusAccountRequest.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const CampaignsAccountRequestDatePreset: {
|
|
2
|
+
readonly Today: "today";
|
|
3
|
+
readonly Yesterday: "yesterday";
|
|
4
|
+
readonly Last3Days: "last-3-days";
|
|
5
|
+
readonly Last7Days: "last-7-days";
|
|
6
|
+
readonly ThisWeek: "this-week";
|
|
7
|
+
readonly LastWeek: "last-week";
|
|
8
|
+
readonly Last14Days: "last-14-days";
|
|
9
|
+
readonly Last30Days: "last-30-days";
|
|
10
|
+
readonly ThisMonth: "this-month";
|
|
11
|
+
readonly LastMonth: "last-month";
|
|
12
|
+
readonly Last3Months: "last-3-months";
|
|
13
|
+
readonly Last6Months: "last-6-months";
|
|
14
|
+
readonly YearToDate: "year-to-date";
|
|
15
|
+
readonly LastYear: "last-year";
|
|
16
|
+
};
|
|
17
|
+
export type CampaignsAccountRequestDatePreset = (typeof CampaignsAccountRequestDatePreset)[keyof typeof CampaignsAccountRequestDatePreset];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CampaignsAccountRequestDatePreset = void 0;
|
|
5
|
+
exports.CampaignsAccountRequestDatePreset = {
|
|
6
|
+
Today: 'today',
|
|
7
|
+
Yesterday: 'yesterday',
|
|
8
|
+
Last3Days: 'last-3-days',
|
|
9
|
+
Last7Days: 'last-7-days',
|
|
10
|
+
ThisWeek: 'this-week',
|
|
11
|
+
LastWeek: 'last-week',
|
|
12
|
+
Last14Days: 'last-14-days',
|
|
13
|
+
Last30Days: 'last-30-days',
|
|
14
|
+
ThisMonth: 'this-month',
|
|
15
|
+
LastMonth: 'last-month',
|
|
16
|
+
Last3Months: 'last-3-months',
|
|
17
|
+
Last6Months: 'last-6-months',
|
|
18
|
+
YearToDate: 'year-to-date',
|
|
19
|
+
LastYear: 'last-year',
|
|
20
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CampaignsAccountRequestSortBy: {
|
|
2
|
+
readonly MostRecent: "MOST_RECENT";
|
|
3
|
+
readonly HighestVelocity: "HIGHEST_VELOCITY";
|
|
4
|
+
};
|
|
5
|
+
export type CampaignsAccountRequestSortBy = (typeof CampaignsAccountRequestSortBy)[keyof typeof CampaignsAccountRequestSortBy];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CampaignsAccountRequestSortBy = void 0;
|
|
5
|
+
exports.CampaignsAccountRequestSortBy = {
|
|
6
|
+
MostRecent: 'MOST_RECENT',
|
|
7
|
+
HighestVelocity: 'HIGHEST_VELOCITY',
|
|
8
|
+
};
|