@spyglasshq/sdk 0.1.9 → 0.1.11
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 +30 -14
- package/dist/cjs/BaseClient.d.ts +4 -4
- package/dist/cjs/BaseClient.js +7 -7
- package/dist/cjs/Client.d.ts +13 -13
- package/dist/cjs/Client.js +46 -64
- package/dist/cjs/api/client/index.d.ts +1 -1
- package/dist/cjs/api/client/requests/SearchBrandsRequest.d.ts +4 -4
- package/dist/cjs/api/client/requests/SearchBrandsRequest.js +6 -6
- package/dist/cjs/api/client/requests/SearchCreatorsRequest.d.ts +4 -4
- package/dist/cjs/api/client/requests/SearchCreatorsRequest.js +174 -174
- package/dist/cjs/api/client/requests/SearchMediaRequest.d.ts +6 -2
- package/dist/cjs/api/client/requests/SearchMediaRequest.js +227 -223
- package/dist/cjs/api/client/requests/index.d.ts +5 -5
- package/dist/cjs/api/errors/BadRequestError.d.ts +3 -3
- package/dist/cjs/api/errors/BadRequestError.js +2 -2
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +3 -3
- package/dist/cjs/api/errors/ContentTooLargeError.js +2 -2
- package/dist/cjs/api/errors/ForbiddenError.d.ts +3 -3
- package/dist/cjs/api/errors/ForbiddenError.js +2 -2
- package/dist/cjs/api/errors/InternalServerError.d.ts +3 -3
- package/dist/cjs/api/errors/InternalServerError.js +2 -2
- package/dist/cjs/api/errors/MethodNotAllowedError.d.ts +3 -3
- package/dist/cjs/api/errors/MethodNotAllowedError.js +2 -2
- package/dist/cjs/api/errors/NotFoundError.d.ts +3 -3
- package/dist/cjs/api/errors/NotFoundError.js +2 -2
- package/dist/cjs/api/errors/PaymentRequiredError.d.ts +3 -3
- package/dist/cjs/api/errors/PaymentRequiredError.js +2 -2
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +3 -3
- package/dist/cjs/api/errors/TooManyRequestsError.js +2 -2
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +3 -3
- package/dist/cjs/api/errors/UnauthorizedError.js +2 -2
- package/dist/cjs/api/errors/index.d.ts +9 -9
- package/dist/cjs/api/index.d.ts +4 -4
- package/dist/cjs/api/resources/account/client/Client.d.ts +67 -7
- package/dist/cjs/api/resources/account/client/Client.js +208 -42
- package/dist/cjs/api/resources/account/client/index.d.ts +1 -1
- 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/InsightsAccountRequest.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/LandingPagesAccountRequest.d.ts +2 -1
- package/dist/cjs/api/resources/account/client/requests/index.d.ts +7 -5
- package/dist/cjs/api/resources/account/exports.d.ts +2 -2
- package/dist/cjs/api/resources/account/index.d.ts +2 -2
- 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/GetAccountResponse.d.ts +3 -3
- package/dist/cjs/api/resources/account/types/IndexAccountResponse.js +2 -2
- package/dist/cjs/api/resources/account/types/IndexStatusAccountResponse.js +2 -2
- package/dist/cjs/api/resources/account/types/InsightsAccountRequestType.js +4 -4
- package/dist/cjs/api/resources/account/types/InsightsAccountResponse.d.ts +2 -12
- package/dist/cjs/api/resources/account/types/LandingPagesAccountRequestShowInactive.js +2 -2
- package/dist/cjs/api/resources/account/types/index.d.ts +12 -7
- package/dist/cjs/api/resources/account/types/index.js +5 -0
- package/dist/cjs/api/resources/index.d.ts +3 -3
- package/dist/cjs/api/types/Error_.js +11 -11
- package/dist/cjs/api/types/SearchBrandsResponse.js +1 -1
- package/dist/cjs/api/types/SearchCreatorsResponse.js +1 -1
- package/dist/cjs/api/types/SearchMediaResponse.js +26 -26
- package/dist/cjs/api/types/index.d.ts +7 -7
- package/dist/cjs/auth/BearerAuthProvider.d.ts +1 -1
- package/dist/cjs/auth/BearerAuthProvider.js +2 -2
- package/dist/cjs/auth/index.d.ts +1 -1
- package/dist/cjs/core/auth/AuthProvider.d.ts +2 -2
- package/dist/cjs/core/auth/AuthProvider.js +3 -3
- package/dist/cjs/core/auth/BasicAuth.js +7 -7
- package/dist/cjs/core/auth/BearerToken.js +1 -1
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +2 -2
- package/dist/cjs/core/auth/index.d.ts +5 -5
- package/dist/cjs/core/base64.js +4 -4
- package/dist/cjs/core/exports.d.ts +1 -1
- package/dist/cjs/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +4 -4
- package/dist/cjs/core/fetcher/BinaryResponse.js +1 -1
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/EndpointSupplier.js +1 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +11 -11
- package/dist/cjs/core/fetcher/Fetcher.js +50 -56
- package/dist/cjs/core/fetcher/Headers.js +10 -10
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +2 -2
- package/dist/cjs/core/fetcher/RawResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/RawResponse.js +6 -6
- package/dist/cjs/core/fetcher/Supplier.js +1 -1
- package/dist/cjs/core/fetcher/createRequestUrl.js +1 -1
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +11 -11
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +2 -2
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -4
- package/dist/cjs/core/fetcher/getResponseBody.d.ts +2 -2
- package/dist/cjs/core/fetcher/getResponseBody.js +11 -11
- package/dist/cjs/core/fetcher/index.d.ts +13 -13
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +2 -2
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +7 -7
- package/dist/cjs/core/fetcher/makeRequest.js +3 -3
- package/dist/cjs/core/fetcher/redactUrl.js +36 -36
- package/dist/cjs/core/fetcher/requestWithRetries.js +4 -4
- package/dist/cjs/core/fetcher/signals.js +2 -2
- package/dist/cjs/core/index.d.ts +6 -6
- package/dist/cjs/core/logging/exports.d.ts +1 -1
- package/dist/cjs/core/logging/index.d.ts +1 -1
- package/dist/cjs/core/logging/logger.js +4 -4
- package/dist/cjs/core/requestBody.js +1 -1
- package/dist/cjs/core/runtime/index.d.ts +1 -1
- package/dist/cjs/core/runtime/runtime.d.ts +1 -1
- package/dist/cjs/core/runtime/runtime.js +35 -37
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +1 -1
- package/dist/cjs/core/url/QueryStringBuilder.js +3 -3
- package/dist/cjs/core/url/encodePathParam.js +8 -10
- package/dist/cjs/core/url/index.d.ts +4 -4
- package/dist/cjs/core/url/join.js +11 -11
- package/dist/cjs/core/url/qs.d.ts +1 -1
- package/dist/cjs/core/url/qs.js +14 -14
- package/dist/cjs/environments.js +1 -1
- package/dist/cjs/errors/SpyglassError.d.ts +1 -1
- package/dist/cjs/errors/SpyglassError.js +3 -3
- package/dist/cjs/errors/SpyglassTimeoutError.d.ts +1 -1
- package/dist/cjs/errors/SpyglassTimeoutError.js +1 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +1 -1
- package/dist/cjs/errors/handleNonStatusCodeError.js +5 -5
- package/dist/cjs/errors/index.d.ts +2 -2
- package/dist/cjs/exports.d.ts +1 -1
- package/dist/cjs/index.d.ts +6 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +4 -4
- package/dist/esm/BaseClient.mjs +10 -10
- package/dist/esm/Client.d.mts +13 -13
- package/dist/esm/Client.mjs +55 -73
- package/dist/esm/api/client/index.d.mts +1 -1
- package/dist/esm/api/client/index.mjs +1 -1
- package/dist/esm/api/client/requests/SearchBrandsRequest.d.mts +4 -4
- package/dist/esm/api/client/requests/SearchBrandsRequest.mjs +6 -6
- package/dist/esm/api/client/requests/SearchCreatorsRequest.d.mts +4 -4
- package/dist/esm/api/client/requests/SearchCreatorsRequest.mjs +174 -174
- package/dist/esm/api/client/requests/SearchMediaRequest.d.mts +6 -2
- package/dist/esm/api/client/requests/SearchMediaRequest.mjs +227 -223
- package/dist/esm/api/client/requests/index.d.mts +5 -5
- package/dist/esm/api/client/requests/index.mjs +3 -3
- package/dist/esm/api/errors/BadRequestError.d.mts +3 -3
- package/dist/esm/api/errors/BadRequestError.mjs +3 -3
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +3 -3
- package/dist/esm/api/errors/ContentTooLargeError.mjs +3 -3
- package/dist/esm/api/errors/ForbiddenError.d.mts +3 -3
- package/dist/esm/api/errors/ForbiddenError.mjs +3 -3
- package/dist/esm/api/errors/InternalServerError.d.mts +3 -3
- package/dist/esm/api/errors/InternalServerError.mjs +3 -3
- package/dist/esm/api/errors/MethodNotAllowedError.d.mts +3 -3
- package/dist/esm/api/errors/MethodNotAllowedError.mjs +3 -3
- package/dist/esm/api/errors/NotFoundError.d.mts +3 -3
- package/dist/esm/api/errors/NotFoundError.mjs +3 -3
- package/dist/esm/api/errors/PaymentRequiredError.d.mts +3 -3
- package/dist/esm/api/errors/PaymentRequiredError.mjs +3 -3
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +3 -3
- package/dist/esm/api/errors/TooManyRequestsError.mjs +3 -3
- package/dist/esm/api/errors/UnauthorizedError.d.mts +3 -3
- package/dist/esm/api/errors/UnauthorizedError.mjs +3 -3
- package/dist/esm/api/errors/index.d.mts +9 -9
- package/dist/esm/api/errors/index.mjs +9 -9
- package/dist/esm/api/index.d.mts +4 -4
- package/dist/esm/api/index.mjs +4 -4
- package/dist/esm/api/resources/account/client/Client.d.mts +67 -7
- package/dist/esm/api/resources/account/client/Client.mjs +216 -50
- package/dist/esm/api/resources/account/client/index.d.mts +1 -1
- package/dist/esm/api/resources/account/client/index.mjs +1 -1
- 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/InsightsAccountRequest.d.mts +1 -1
- package/dist/esm/api/resources/account/client/requests/LandingPagesAccountRequest.d.mts +2 -1
- package/dist/esm/api/resources/account/client/requests/index.d.mts +7 -5
- package/dist/esm/api/resources/account/exports.d.mts +2 -2
- package/dist/esm/api/resources/account/exports.mjs +2 -2
- package/dist/esm/api/resources/account/index.d.mts +2 -2
- package/dist/esm/api/resources/account/index.mjs +2 -2
- 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/GetAccountResponse.d.mts +3 -3
- package/dist/esm/api/resources/account/types/IndexAccountResponse.mjs +2 -2
- package/dist/esm/api/resources/account/types/IndexStatusAccountResponse.mjs +2 -2
- package/dist/esm/api/resources/account/types/InsightsAccountRequestType.mjs +4 -4
- package/dist/esm/api/resources/account/types/InsightsAccountResponse.d.mts +2 -12
- package/dist/esm/api/resources/account/types/LandingPagesAccountRequestShowInactive.mjs +2 -2
- package/dist/esm/api/resources/account/types/index.d.mts +12 -7
- package/dist/esm/api/resources/account/types/index.mjs +12 -7
- package/dist/esm/api/resources/index.d.mts +3 -3
- package/dist/esm/api/resources/index.mjs +3 -3
- package/dist/esm/api/types/Error_.mjs +11 -11
- package/dist/esm/api/types/SearchBrandsResponse.mjs +1 -1
- package/dist/esm/api/types/SearchCreatorsResponse.mjs +1 -1
- package/dist/esm/api/types/SearchMediaResponse.mjs +26 -26
- package/dist/esm/api/types/index.d.mts +7 -7
- package/dist/esm/api/types/index.mjs +7 -7
- package/dist/esm/auth/BearerAuthProvider.d.mts +1 -1
- package/dist/esm/auth/BearerAuthProvider.mjs +4 -4
- package/dist/esm/auth/index.d.mts +1 -1
- package/dist/esm/auth/index.mjs +1 -1
- package/dist/esm/core/auth/AuthProvider.d.mts +2 -2
- package/dist/esm/core/auth/AuthProvider.mjs +3 -3
- package/dist/esm/core/auth/BasicAuth.mjs +8 -8
- package/dist/esm/core/auth/BearerToken.mjs +1 -1
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +2 -2
- package/dist/esm/core/auth/index.d.mts +5 -5
- package/dist/esm/core/auth/index.mjs +4 -4
- package/dist/esm/core/base64.mjs +4 -4
- package/dist/esm/core/exports.d.mts +1 -1
- package/dist/esm/core/exports.mjs +1 -1
- package/dist/esm/core/fetcher/APIResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +4 -4
- package/dist/esm/core/fetcher/BinaryResponse.mjs +1 -1
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +1 -1
- package/dist/esm/core/fetcher/Fetcher.d.mts +11 -11
- package/dist/esm/core/fetcher/Fetcher.mjs +64 -70
- package/dist/esm/core/fetcher/Headers.mjs +10 -10
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +2 -2
- package/dist/esm/core/fetcher/RawResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/RawResponse.mjs +7 -7
- package/dist/esm/core/fetcher/Supplier.mjs +1 -1
- package/dist/esm/core/fetcher/createRequestUrl.mjs +2 -2
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +13 -13
- package/dist/esm/core/fetcher/getRequestBody.d.mts +2 -2
- package/dist/esm/core/fetcher/getRequestBody.mjs +6 -6
- package/dist/esm/core/fetcher/getResponseBody.d.mts +2 -2
- package/dist/esm/core/fetcher/getResponseBody.mjs +13 -13
- package/dist/esm/core/fetcher/index.d.mts +13 -13
- package/dist/esm/core/fetcher/index.mjs +7 -7
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +2 -2
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +16 -16
- package/dist/esm/core/fetcher/makeRequest.mjs +4 -4
- package/dist/esm/core/fetcher/redactUrl.mjs +36 -36
- package/dist/esm/core/fetcher/requestWithRetries.mjs +4 -4
- package/dist/esm/core/fetcher/signals.mjs +2 -2
- package/dist/esm/core/index.d.mts +6 -6
- package/dist/esm/core/index.mjs +6 -6
- package/dist/esm/core/logging/exports.d.mts +1 -1
- package/dist/esm/core/logging/exports.mjs +1 -1
- package/dist/esm/core/logging/index.d.mts +1 -1
- package/dist/esm/core/logging/index.mjs +1 -1
- package/dist/esm/core/logging/logger.mjs +4 -4
- package/dist/esm/core/requestBody.mjs +1 -1
- package/dist/esm/core/runtime/index.d.mts +1 -1
- package/dist/esm/core/runtime/index.mjs +1 -1
- package/dist/esm/core/runtime/runtime.d.mts +1 -1
- package/dist/esm/core/runtime/runtime.mjs +35 -37
- package/dist/esm/core/url/QueryStringBuilder.d.mts +1 -1
- package/dist/esm/core/url/QueryStringBuilder.mjs +4 -4
- package/dist/esm/core/url/encodePathParam.mjs +8 -10
- package/dist/esm/core/url/index.d.mts +4 -4
- package/dist/esm/core/url/index.mjs +4 -4
- package/dist/esm/core/url/join.mjs +11 -11
- package/dist/esm/core/url/qs.d.mts +1 -1
- package/dist/esm/core/url/qs.mjs +14 -14
- package/dist/esm/environments.mjs +1 -1
- package/dist/esm/errors/SpyglassError.d.mts +1 -1
- package/dist/esm/errors/SpyglassError.mjs +4 -4
- package/dist/esm/errors/SpyglassTimeoutError.d.mts +1 -1
- package/dist/esm/errors/SpyglassTimeoutError.mjs +2 -2
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +1 -1
- package/dist/esm/errors/handleNonStatusCodeError.mjs +6 -6
- package/dist/esm/errors/index.d.mts +2 -2
- package/dist/esm/errors/index.mjs +2 -2
- package/dist/esm/exports.d.mts +1 -1
- package/dist/esm/exports.mjs +1 -1
- package/dist/esm/index.d.mts +6 -6
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +91 -91
- package/reference.md +232 -91
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
**`@spyglasshq/sdk`** is the official TypeScript and Node.js client for the [Spyglass API](https://docs.spyglass.so). Resolve brands and creators, search across millions of Meta, Instagram, and TikTok creatives with natural-language briefs or structured filters, and extract hooks, personas, landing pages, and public comments.
|
|
37
|
+
**`@spyglasshq/sdk`** is the official TypeScript and Node.js client for the [Spyglass API](https://docs.spyglass.so). Resolve brands and creators, search across millions of Meta, Instagram, and TikTok creatives with natural-language briefs or structured filters, and extract hooks, personas, campaigns, collaborations, landing pages, and public comments.
|
|
38
38
|
|
|
39
39
|
> Looking for Python? See [`spyglass-so/spyglass-python`](https://github.com/spyglass-so/spyglass-python) (`pip install spyglass-sdk`).
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
- [Search Brands](#1-search-brands)
|
|
47
47
|
- [Search Ad Creatives & Social Media](#2-search-ad-creatives--social-media)
|
|
48
48
|
- [Discover Creators](#3-discover-creators)
|
|
49
|
-
- [Creative Insights & Landing Pages](#4-creative-insights--landing-pages)
|
|
49
|
+
- [Creative Insights, Campaigns, Collabs & Landing Pages](#4-creative-insights-campaigns-collabs--landing-pages)
|
|
50
50
|
- [Post Comments](#5-post-comments)
|
|
51
51
|
- [Index a New Account](#6-index-a-new-account)
|
|
52
52
|
- [Check Team Credit Usage](#7-check-team-credit-usage)
|
|
@@ -96,7 +96,7 @@ const brand = brands[0];
|
|
|
96
96
|
if (brand) {
|
|
97
97
|
// 2. Search the creatives that brand is running
|
|
98
98
|
const { media } = await client.searchMedia({
|
|
99
|
-
|
|
99
|
+
accountId: brand.id,
|
|
100
100
|
query: "marathon running shoes comfort",
|
|
101
101
|
limit: 10,
|
|
102
102
|
});
|
|
@@ -120,7 +120,7 @@ if (brand) {
|
|
|
120
120
|
|
|
121
121
|
### 1. Search Brands
|
|
122
122
|
|
|
123
|
-
Search advertisers by name (`names`), social handle (`igUsername`, `tiktokUsername`), known IDs (`
|
|
123
|
+
Search advertisers by name (`names`), social handle (`igUsername`, `tiktokUsername`), known IDs (`ids`), or a natural-language brief (`query`). You can also combine `names` + `query` to rank a specific set of brands against a brief.
|
|
124
124
|
|
|
125
125
|
```ts
|
|
126
126
|
// Fuzzy name lookup
|
|
@@ -138,7 +138,7 @@ const byBrief = await client.searchBrands({
|
|
|
138
138
|
|
|
139
139
|
### 2. Search Ad Creatives & Social Media
|
|
140
140
|
|
|
141
|
-
Pass `
|
|
141
|
+
Pass `accountId` to inspect a specific brand or creator's creatives, or omit `accountId` and pass `query` to search across the entire Spyglass index. Combine semantic search with structured filters:
|
|
142
142
|
|
|
143
143
|
```ts
|
|
144
144
|
// Optional: look up valid product taxonomy paths first (free call)
|
|
@@ -178,9 +178,9 @@ const { creators } = await client.searchCreators({
|
|
|
178
178
|
});
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
### 4. Creative Insights & Landing Pages
|
|
181
|
+
### 4. Creative Insights, Campaigns, Collabs & Landing Pages
|
|
182
182
|
|
|
183
|
-
Pull clustered creative themes (`HOOK`, `USP`, `PERSONA`, `MEDIA_MIX`) and ranked destination landing pages for any account:
|
|
183
|
+
Pull clustered creative themes (`HOOK`, `USP`, `PERSONA`, `MEDIA_MIX`), campaigns or offers, creator collaborations, and ranked destination landing pages for any account:
|
|
184
184
|
|
|
185
185
|
```ts
|
|
186
186
|
// Ranked hooks + weekly volume breakdown over the last 90 days
|
|
@@ -191,6 +191,20 @@ const insights = await client.account.insights({
|
|
|
191
191
|
limit: 10,
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
+
// Active campaigns or promotional offers
|
|
195
|
+
const { campaigns } = await client.account.campaigns({
|
|
196
|
+
id: brand.id,
|
|
197
|
+
type: "CAMPAIGN",
|
|
198
|
+
datePreset: "last-30-days",
|
|
199
|
+
limit: 10,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// Creators the account has collaborated with, ordered by media count
|
|
203
|
+
const { collabs } = await client.account.collabs({
|
|
204
|
+
id: brand.id,
|
|
205
|
+
limit: 20,
|
|
206
|
+
});
|
|
207
|
+
|
|
194
208
|
// Top landing pages where the brand sends ad traffic
|
|
195
209
|
const { landingPages } = await client.account.landingPages({
|
|
196
210
|
id: brand.id,
|
|
@@ -249,14 +263,16 @@ console.log(`Remaining: ${usage.remainingCredits} / ${usage.planCredits}`);
|
|
|
249
263
|
|
|
250
264
|
| SDK Method | HTTP Endpoint | Cost | Rate Limit |
|
|
251
265
|
| --- | --- | --- | --- |
|
|
252
|
-
| `client.searchBrands(req)` | `POST /brands` | $0.
|
|
253
|
-
| `client.searchCreators(req)` | `POST /creators` | $0.
|
|
254
|
-
| `client.searchMedia(req)` | `POST /media` | $0.
|
|
266
|
+
| `client.searchBrands(req)` | `POST /brands` | $0.0010 / brand returned | 120 / min |
|
|
267
|
+
| `client.searchCreators(req)` | `POST /creators` | $0.0010 / creator returned | 120 / min |
|
|
268
|
+
| `client.searchMedia(req)` | `POST /media` | $0.0005 / creative returned | 120 / min |
|
|
255
269
|
| `client.searchTaxonomies({ query })` | `GET /taxonomies` | Free | 120 / min |
|
|
256
|
-
| `client.getComments(req)` | `POST /comments` | $0.
|
|
257
|
-
| `client.account.get({ id })` | `GET /account/{id}` | $0.
|
|
258
|
-
| `client.account.insights(req)` | `GET /account/{id}/insights` | $0.
|
|
259
|
-
| `client.account.
|
|
270
|
+
| `client.getComments(req)` | `POST /comments` | $0.0050 / live page fetched | 20 / min |
|
|
271
|
+
| `client.account.get({ id })` | `GET /account/{id}` | $0.0010 / account returned | 120 / min |
|
|
272
|
+
| `client.account.insights(req)` | `GET /account/{id}/insights` | $0.0005 / cluster returned | 120 / min |
|
|
273
|
+
| `client.account.campaigns(req)` | `GET /account/{id}/campaigns` | $0.0005 / campaign returned | 120 / min |
|
|
274
|
+
| `client.account.collabs(req)` | `GET /account/{id}/collabs` | $0.0005 / collab returned | 120 / min |
|
|
275
|
+
| `client.account.landingPages(req)` | `GET /account/{id}/landing-pages` | $0.0025 / landing page returned | 120 / min |
|
|
260
276
|
| `client.account.index(req)` | `POST /account/index` | Free | 50 / min |
|
|
261
277
|
| `client.account.indexStatus({ id })` | `GET /account/{id}/index-status` | Free | 300 / min |
|
|
262
278
|
| `client.getCreditUsage()` | `GET /team/credit-usage` | Free | 120 / min |
|
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BearerAuthProvider } from
|
|
2
|
-
import * as core from
|
|
3
|
-
import type * as environments from
|
|
4
|
-
export type AuthOption = false | core.AuthProvider[
|
|
1
|
+
import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
|
|
2
|
+
import * as core from "./core/index.js";
|
|
3
|
+
import type * as environments from "./environments.js";
|
|
4
|
+
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | BearerAuthProvider.AuthOptions;
|
|
5
5
|
export type BaseClientOptions = {
|
|
6
6
|
environment?: core.Supplier<environments.SpyglassEnvironment | string>;
|
|
7
7
|
/** Specify a custom URL to connect the client to. */
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -41,12 +41,12 @@ const headers_js_1 = require("./core/headers.js");
|
|
|
41
41
|
const core = __importStar(require("./core/index.js"));
|
|
42
42
|
function normalizeClientOptions(options) {
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
"X-Fern-Language": "JavaScript",
|
|
45
|
+
"X-Fern-SDK-Name": "@spyglasshq/sdk",
|
|
46
|
+
"X-Fern-SDK-Version": "0.1.11",
|
|
47
|
+
"User-Agent": "@spyglasshq/sdk/0.1.11",
|
|
48
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
51
51
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
52
52
|
}
|
|
@@ -58,7 +58,7 @@ function normalizeClientOptionsWithAuth(options) {
|
|
|
58
58
|
return normalized;
|
|
59
59
|
}
|
|
60
60
|
if (options.auth != null) {
|
|
61
|
-
if (typeof options.auth ===
|
|
61
|
+
if (typeof options.auth === "function") {
|
|
62
62
|
normalized.authProvider = { getAuthRequest: options.auth };
|
|
63
63
|
return normalized;
|
|
64
64
|
}
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as spyglass from
|
|
2
|
-
import { AccountClient } from
|
|
3
|
-
import type { BaseClientOptions, BaseRequestOptions } from
|
|
4
|
-
import { type NormalizedClientOptionsWithAuth } from
|
|
5
|
-
import * as core from
|
|
1
|
+
import * as spyglass from "./api/index.js";
|
|
2
|
+
import { AccountClient } from "./api/resources/account/client/Client.js";
|
|
3
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
4
|
+
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
5
|
+
import * as core from "./core/index.js";
|
|
6
6
|
export declare namespace Spyglass {
|
|
7
7
|
type Options = BaseClientOptions;
|
|
8
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -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
|
*
|
|
@@ -128,12 +128,12 @@ class Spyglass {
|
|
|
128
128
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
129
129
|
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);
|
|
130
130
|
const _response = yield core.fetcher({
|
|
131
|
-
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,
|
|
132
|
-
method:
|
|
131
|
+
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, "brands"),
|
|
132
|
+
method: "POST",
|
|
133
133
|
headers: _headers,
|
|
134
|
-
contentType:
|
|
134
|
+
contentType: "application/json",
|
|
135
135
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
136
|
-
requestType:
|
|
136
|
+
requestType: "json",
|
|
137
137
|
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
138
138
|
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,
|
|
139
139
|
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,
|
|
@@ -142,12 +142,9 @@ class Spyglass {
|
|
|
142
142
|
logging: this._options.logging,
|
|
143
143
|
});
|
|
144
144
|
if (_response.ok) {
|
|
145
|
-
return {
|
|
146
|
-
data: _response.body,
|
|
147
|
-
rawResponse: _response.rawResponse,
|
|
148
|
-
};
|
|
145
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
149
146
|
}
|
|
150
|
-
if (_response.error.reason ===
|
|
147
|
+
if (_response.error.reason === "status-code") {
|
|
151
148
|
switch (_response.error.statusCode) {
|
|
152
149
|
case 400:
|
|
153
150
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -173,7 +170,7 @@ class Spyglass {
|
|
|
173
170
|
});
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse,
|
|
173
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/brands");
|
|
177
174
|
});
|
|
178
175
|
}
|
|
179
176
|
/**
|
|
@@ -189,7 +186,7 @@ class Spyglass {
|
|
|
189
186
|
* when nothing matches.
|
|
190
187
|
* - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
|
|
191
188
|
* match). Pass every name in one array.
|
|
192
|
-
* - **ID** (`
|
|
189
|
+
* - **ID** (`ids`). Looks up known ids. Missing ids are omitted and listed
|
|
193
190
|
* in `unmatchedIds`. `limit` and `offset` are ignored.
|
|
194
191
|
* - **Instagram** (`igUsername`). Case-insensitive contains match on the
|
|
195
192
|
* handle. A leading `@` is ignored.
|
|
@@ -198,7 +195,7 @@ class Spyglass {
|
|
|
198
195
|
* If a request includes more than one of these fields, only the highest
|
|
199
196
|
* priority field is used. The rest are ignored:
|
|
200
197
|
*
|
|
201
|
-
* 1. `
|
|
198
|
+
* 1. `ids`
|
|
202
199
|
* 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
|
|
203
200
|
* 3. `names`
|
|
204
201
|
* 4. `query`
|
|
@@ -210,7 +207,7 @@ class Spyglass {
|
|
|
210
207
|
* every mode except ID.
|
|
211
208
|
*
|
|
212
209
|
* Limited to 120 requests per minute per user.
|
|
213
|
-
* Costs
|
|
210
|
+
* Costs $0.0010 per creator returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
214
211
|
* A `query` search runs a language model, so it bills a minimum of one
|
|
215
212
|
* row even when nothing matches.
|
|
216
213
|
*
|
|
@@ -244,12 +241,12 @@ class Spyglass {
|
|
|
244
241
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
245
242
|
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);
|
|
246
243
|
const _response = yield core.fetcher({
|
|
247
|
-
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,
|
|
248
|
-
method:
|
|
244
|
+
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, "creators"),
|
|
245
|
+
method: "POST",
|
|
249
246
|
headers: _headers,
|
|
250
|
-
contentType:
|
|
247
|
+
contentType: "application/json",
|
|
251
248
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
252
|
-
requestType:
|
|
249
|
+
requestType: "json",
|
|
253
250
|
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
254
251
|
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,
|
|
255
252
|
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,
|
|
@@ -258,12 +255,9 @@ class Spyglass {
|
|
|
258
255
|
logging: this._options.logging,
|
|
259
256
|
});
|
|
260
257
|
if (_response.ok) {
|
|
261
|
-
return {
|
|
262
|
-
data: _response.body,
|
|
263
|
-
rawResponse: _response.rawResponse,
|
|
264
|
-
};
|
|
258
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
265
259
|
}
|
|
266
|
-
if (_response.error.reason ===
|
|
260
|
+
if (_response.error.reason === "status-code") {
|
|
267
261
|
switch (_response.error.statusCode) {
|
|
268
262
|
case 400:
|
|
269
263
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -289,7 +283,7 @@ class Spyglass {
|
|
|
289
283
|
});
|
|
290
284
|
}
|
|
291
285
|
}
|
|
292
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse,
|
|
286
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/creators");
|
|
293
287
|
});
|
|
294
288
|
}
|
|
295
289
|
/**
|
|
@@ -332,8 +326,8 @@ class Spyglass {
|
|
|
332
326
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
333
327
|
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);
|
|
334
328
|
const _response = yield core.fetcher({
|
|
335
|
-
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,
|
|
336
|
-
method:
|
|
329
|
+
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, "taxonomies"),
|
|
330
|
+
method: "GET",
|
|
337
331
|
headers: _headers,
|
|
338
332
|
queryString: core.url
|
|
339
333
|
.queryBuilder()
|
|
@@ -347,12 +341,9 @@ class Spyglass {
|
|
|
347
341
|
logging: this._options.logging,
|
|
348
342
|
});
|
|
349
343
|
if (_response.ok) {
|
|
350
|
-
return {
|
|
351
|
-
data: _response.body,
|
|
352
|
-
rawResponse: _response.rawResponse,
|
|
353
|
-
};
|
|
344
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
354
345
|
}
|
|
355
|
-
if (_response.error.reason ===
|
|
346
|
+
if (_response.error.reason === "status-code") {
|
|
356
347
|
switch (_response.error.statusCode) {
|
|
357
348
|
case 400:
|
|
358
349
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -376,7 +367,7 @@ class Spyglass {
|
|
|
376
367
|
});
|
|
377
368
|
}
|
|
378
369
|
}
|
|
379
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse,
|
|
370
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/taxonomies");
|
|
380
371
|
});
|
|
381
372
|
}
|
|
382
373
|
/**
|
|
@@ -385,7 +376,7 @@ class Spyglass {
|
|
|
385
376
|
* `query` is required.
|
|
386
377
|
*
|
|
387
378
|
* Limited to 120 requests per minute per user.
|
|
388
|
-
* Costs
|
|
379
|
+
* Costs $0.0005 per creative returned, charged against your plan's monthly credits. The count field is what you were charged for.
|
|
389
380
|
* The call bills a minimum of one row even when nothing matches. In that
|
|
390
381
|
* case `count` is 0 but you are charged for one row.
|
|
391
382
|
*
|
|
@@ -419,12 +410,12 @@ class Spyglass {
|
|
|
419
410
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
420
411
|
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);
|
|
421
412
|
const _response = yield core.fetcher({
|
|
422
|
-
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,
|
|
423
|
-
method:
|
|
413
|
+
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, "media"),
|
|
414
|
+
method: "POST",
|
|
424
415
|
headers: _headers,
|
|
425
|
-
contentType:
|
|
416
|
+
contentType: "application/json",
|
|
426
417
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
427
|
-
requestType:
|
|
418
|
+
requestType: "json",
|
|
428
419
|
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
429
420
|
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,
|
|
430
421
|
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,
|
|
@@ -433,12 +424,9 @@ class Spyglass {
|
|
|
433
424
|
logging: this._options.logging,
|
|
434
425
|
});
|
|
435
426
|
if (_response.ok) {
|
|
436
|
-
return {
|
|
437
|
-
data: _response.body,
|
|
438
|
-
rawResponse: _response.rawResponse,
|
|
439
|
-
};
|
|
427
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
440
428
|
}
|
|
441
|
-
if (_response.error.reason ===
|
|
429
|
+
if (_response.error.reason === "status-code") {
|
|
442
430
|
switch (_response.error.statusCode) {
|
|
443
431
|
case 400:
|
|
444
432
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -466,7 +454,7 @@ class Spyglass {
|
|
|
466
454
|
});
|
|
467
455
|
}
|
|
468
456
|
}
|
|
469
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse,
|
|
457
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/media");
|
|
470
458
|
});
|
|
471
459
|
}
|
|
472
460
|
/**
|
|
@@ -502,8 +490,8 @@ class Spyglass {
|
|
|
502
490
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
503
491
|
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);
|
|
504
492
|
const _response = yield core.fetcher({
|
|
505
|
-
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,
|
|
506
|
-
method:
|
|
493
|
+
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, "team/credit-usage"),
|
|
494
|
+
method: "GET",
|
|
507
495
|
headers: _headers,
|
|
508
496
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
509
497
|
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,
|
|
@@ -513,12 +501,9 @@ class Spyglass {
|
|
|
513
501
|
logging: this._options.logging,
|
|
514
502
|
});
|
|
515
503
|
if (_response.ok) {
|
|
516
|
-
return {
|
|
517
|
-
data: _response.body,
|
|
518
|
-
rawResponse: _response.rawResponse,
|
|
519
|
-
};
|
|
504
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
520
505
|
}
|
|
521
|
-
if (_response.error.reason ===
|
|
506
|
+
if (_response.error.reason === "status-code") {
|
|
522
507
|
switch (_response.error.statusCode) {
|
|
523
508
|
case 400:
|
|
524
509
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -542,7 +527,7 @@ class Spyglass {
|
|
|
542
527
|
});
|
|
543
528
|
}
|
|
544
529
|
}
|
|
545
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse,
|
|
530
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/team/credit-usage");
|
|
546
531
|
});
|
|
547
532
|
}
|
|
548
533
|
/**
|
|
@@ -566,7 +551,7 @@ class Spyglass {
|
|
|
566
551
|
* are served from cache.
|
|
567
552
|
*
|
|
568
553
|
* Limited to 20 requests per minute per user.
|
|
569
|
-
* Costs
|
|
554
|
+
* Costs $0.0050 per successful page of comments returned, charged against your plan's monthly credits.
|
|
570
555
|
* Each comment page fetched live (`limit`, default 1) is one billed
|
|
571
556
|
* unit. Cached posts do not scrape and are not billed.
|
|
572
557
|
*
|
|
@@ -600,12 +585,12 @@ class Spyglass {
|
|
|
600
585
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
601
586
|
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);
|
|
602
587
|
const _response = yield core.fetcher({
|
|
603
|
-
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,
|
|
604
|
-
method:
|
|
588
|
+
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, "comments"),
|
|
589
|
+
method: "POST",
|
|
605
590
|
headers: _headers,
|
|
606
|
-
contentType:
|
|
591
|
+
contentType: "application/json",
|
|
607
592
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
608
|
-
requestType:
|
|
593
|
+
requestType: "json",
|
|
609
594
|
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
610
595
|
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,
|
|
611
596
|
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,
|
|
@@ -614,12 +599,9 @@ class Spyglass {
|
|
|
614
599
|
logging: this._options.logging,
|
|
615
600
|
});
|
|
616
601
|
if (_response.ok) {
|
|
617
|
-
return {
|
|
618
|
-
data: _response.body,
|
|
619
|
-
rawResponse: _response.rawResponse,
|
|
620
|
-
};
|
|
602
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
621
603
|
}
|
|
622
|
-
if (_response.error.reason ===
|
|
604
|
+
if (_response.error.reason === "status-code") {
|
|
623
605
|
switch (_response.error.statusCode) {
|
|
624
606
|
case 400:
|
|
625
607
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -645,7 +627,7 @@ class Spyglass {
|
|
|
645
627
|
});
|
|
646
628
|
}
|
|
647
629
|
}
|
|
648
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse,
|
|
630
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/comments");
|
|
649
631
|
});
|
|
650
632
|
}
|
|
651
633
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -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
|
}
|
|
@@ -5,11 +5,11 @@ exports.SearchBrandsRequest = void 0;
|
|
|
5
5
|
var SearchBrandsRequest;
|
|
6
6
|
(function (SearchBrandsRequest) {
|
|
7
7
|
SearchBrandsRequest.SortBy = {
|
|
8
|
-
Name:
|
|
9
|
-
MostFollowers:
|
|
10
|
-
LeastFollowers:
|
|
11
|
-
MostViews:
|
|
12
|
-
HighestEngagement:
|
|
13
|
-
MostActiveAds:
|
|
8
|
+
Name: "NAME",
|
|
9
|
+
MostFollowers: "MOST_FOLLOWERS",
|
|
10
|
+
LeastFollowers: "LEAST_FOLLOWERS",
|
|
11
|
+
MostViews: "MOST_VIEWS",
|
|
12
|
+
HighestEngagement: "HIGHEST_ENGAGEMENT",
|
|
13
|
+
MostActiveAds: "MOST_ACTIVE_ADS",
|
|
14
14
|
};
|
|
15
15
|
})(SearchBrandsRequest || (exports.SearchBrandsRequest = SearchBrandsRequest = {}));
|
|
@@ -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
|
}
|