@spyglasshq/sdk 0.1.10 → 0.1.12
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 +5 -5
- package/dist/cjs/Client.js +38 -56
- package/dist/cjs/api/client/index.d.ts +1 -1
- package/dist/cjs/api/client/requests/SearchBrandsRequest.js +6 -6
- package/dist/cjs/api/client/requests/SearchCreatorsRequest.js +174 -174
- package/dist/cjs/api/client/requests/SearchMediaRequest.d.ts +4 -0
- 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 +4 -4
- package/dist/cjs/api/resources/account/client/Client.js +31 -52
- package/dist/cjs/api/resources/account/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/CampaignsAccountRequest.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/InsightsAccountRequest.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/LandingPagesAccountRequest.d.ts +1 -1
- package/dist/cjs/api/resources/account/client/requests/index.d.ts +7 -7
- 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.js +14 -14
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestSortBy.js +2 -2
- package/dist/cjs/api/resources/account/types/CampaignsAccountRequestType.js +2 -2
- 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 -2
- package/dist/cjs/api/resources/account/types/LandingPagesAccountRequestShowInactive.js +2 -2
- package/dist/cjs/api/resources/account/types/index.d.ts +12 -12
- 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 +5 -5
- package/dist/esm/Client.mjs +47 -65
- 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.mjs +6 -6
- package/dist/esm/api/client/requests/SearchCreatorsRequest.mjs +174 -174
- package/dist/esm/api/client/requests/SearchMediaRequest.d.mts +4 -0
- 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 +4 -4
- package/dist/esm/api/resources/account/client/Client.mjs +39 -60
- 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 +1 -1
- package/dist/esm/api/resources/account/client/requests/InsightsAccountRequest.d.mts +1 -1
- package/dist/esm/api/resources/account/client/requests/LandingPagesAccountRequest.d.mts +1 -1
- package/dist/esm/api/resources/account/client/requests/index.d.mts +7 -7
- 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.mjs +14 -14
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestSortBy.mjs +2 -2
- package/dist/esm/api/resources/account/types/CampaignsAccountRequestType.mjs +2 -2
- 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 -2
- package/dist/esm/api/resources/account/types/LandingPagesAccountRequestShowInactive.mjs +2 -2
- package/dist/esm/api/resources/account/types/index.d.mts +12 -12
- package/dist/esm/api/resources/account/types/index.mjs +12 -12
- 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 +97 -98
package/dist/cjs/core/url/qs.js
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toQueryString = toQueryString;
|
|
4
4
|
const defaultQsOptions = {
|
|
5
|
-
arrayFormat:
|
|
5
|
+
arrayFormat: "indices",
|
|
6
6
|
encode: true,
|
|
7
7
|
};
|
|
8
8
|
function encodeValue(value, shouldEncode) {
|
|
9
9
|
if (value === undefined) {
|
|
10
|
-
return
|
|
10
|
+
return "";
|
|
11
11
|
}
|
|
12
12
|
if (value === null) {
|
|
13
|
-
return
|
|
13
|
+
return "";
|
|
14
14
|
}
|
|
15
15
|
const stringValue = String(value);
|
|
16
16
|
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
17
17
|
}
|
|
18
|
-
function stringifyObject(obj, prefix =
|
|
18
|
+
function stringifyObject(obj, prefix = "", options) {
|
|
19
19
|
const parts = [];
|
|
20
20
|
for (const [key, value] of Object.entries(obj)) {
|
|
21
21
|
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
@@ -27,13 +27,13 @@ function stringifyObject(obj, prefix = '', options) {
|
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
29
|
const effectiveFormat = options.arrayFormat;
|
|
30
|
-
if (effectiveFormat ===
|
|
30
|
+
if (effectiveFormat === "comma") {
|
|
31
31
|
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
32
32
|
const encodedValues = value
|
|
33
33
|
.filter((item) => item !== undefined && item !== null)
|
|
34
34
|
.map((item) => encodeValue(item, options.encode));
|
|
35
35
|
if (encodedValues.length > 0) {
|
|
36
|
-
parts.push(`${encodedKey}=${encodedValues.join(
|
|
36
|
+
parts.push(`${encodedKey}=${encodedValues.join(",")}`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
@@ -42,19 +42,19 @@ function stringifyObject(obj, prefix = '', options) {
|
|
|
42
42
|
if (item == null) {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
if (typeof item ===
|
|
46
|
-
const arrayKey = effectiveFormat ===
|
|
45
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
46
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
47
47
|
parts.push(...stringifyObject(item, arrayKey, options));
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
const arrayKey = effectiveFormat ===
|
|
50
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
51
51
|
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
52
52
|
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
else if (typeof value ===
|
|
57
|
+
else if (typeof value === "object" && value !== null) {
|
|
58
58
|
if (Object.keys(value).length === 0) {
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
@@ -68,9 +68,9 @@ function stringifyObject(obj, prefix = '', options) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
function toQueryString(obj, options) {
|
|
71
|
-
if (obj == null || typeof obj !==
|
|
72
|
-
return
|
|
71
|
+
if (obj == null || typeof obj !== "object") {
|
|
72
|
+
return "";
|
|
73
73
|
}
|
|
74
|
-
const parts = stringifyObject(obj,
|
|
75
|
-
return parts.join(
|
|
74
|
+
const parts = stringifyObject(obj, "", Object.assign(Object.assign({}, defaultQsOptions), options));
|
|
75
|
+
return parts.join("&");
|
|
76
76
|
}
|
package/dist/cjs/environments.js
CHANGED
|
@@ -10,7 +10,7 @@ class SpyglassError extends Error {
|
|
|
10
10
|
if (Error.captureStackTrace) {
|
|
11
11
|
Error.captureStackTrace(this, this.constructor);
|
|
12
12
|
}
|
|
13
|
-
this.name =
|
|
13
|
+
this.name = "SpyglassError";
|
|
14
14
|
this.statusCode = statusCode;
|
|
15
15
|
this.body = body;
|
|
16
16
|
this.rawResponse = rawResponse;
|
|
@@ -24,7 +24,7 @@ class SpyglassError extends Error {
|
|
|
24
24
|
if (headers == null) {
|
|
25
25
|
return undefined;
|
|
26
26
|
}
|
|
27
|
-
const requestId = headers.get(
|
|
27
|
+
const requestId = headers.get("X-Request-Id");
|
|
28
28
|
if (requestId != null) {
|
|
29
29
|
return requestId;
|
|
30
30
|
}
|
|
@@ -49,5 +49,5 @@ function buildMessage({ message, statusCode, body, }) {
|
|
|
49
49
|
if (body != null) {
|
|
50
50
|
lines.push(`Body: ${(0, json_js_1.toJson)(body, undefined, 2)}`);
|
|
51
51
|
}
|
|
52
|
-
return lines.join(
|
|
52
|
+
return lines.join("\n");
|
|
53
53
|
}
|
|
@@ -46,7 +46,7 @@ class SpyglassTimeoutError extends errors.SpyglassError {
|
|
|
46
46
|
if (Error.captureStackTrace) {
|
|
47
47
|
Error.captureStackTrace(this, this.constructor);
|
|
48
48
|
}
|
|
49
|
-
this.name =
|
|
49
|
+
this.name = "SpyglassTimeoutError";
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
exports.SpyglassTimeoutError = SpyglassTimeoutError;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type * as core from
|
|
1
|
+
import type * as core from "../core/index.js";
|
|
2
2
|
export declare function handleNonStatusCodeError(error: core.Fetcher.Error, rawResponse: core.RawResponse, method: string, path: string): never;
|
|
@@ -38,22 +38,22 @@ exports.handleNonStatusCodeError = handleNonStatusCodeError;
|
|
|
38
38
|
const errors = __importStar(require("./index.js"));
|
|
39
39
|
function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
40
40
|
switch (error.reason) {
|
|
41
|
-
case
|
|
41
|
+
case "non-json":
|
|
42
42
|
throw new errors.SpyglassError({
|
|
43
43
|
statusCode: error.statusCode,
|
|
44
44
|
body: error.rawBody,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
case
|
|
47
|
+
case "body-is-null":
|
|
48
48
|
throw new errors.SpyglassError({
|
|
49
49
|
statusCode: error.statusCode,
|
|
50
50
|
rawResponse: rawResponse,
|
|
51
51
|
});
|
|
52
|
-
case
|
|
52
|
+
case "timeout":
|
|
53
53
|
throw new errors.SpyglassTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
|
|
54
54
|
cause: error.cause,
|
|
55
55
|
});
|
|
56
|
-
case
|
|
56
|
+
case "unknown":
|
|
57
57
|
throw new errors.SpyglassError({
|
|
58
58
|
message: error.errorMessage,
|
|
59
59
|
rawResponse: rawResponse,
|
|
@@ -61,7 +61,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
|
61
61
|
});
|
|
62
62
|
default:
|
|
63
63
|
throw new errors.SpyglassError({
|
|
64
|
-
message:
|
|
64
|
+
message: "Unknown error",
|
|
65
65
|
rawResponse: rawResponse,
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SpyglassError } from
|
|
2
|
-
export { SpyglassTimeoutError } from
|
|
1
|
+
export { SpyglassError } from "./SpyglassError.js";
|
|
2
|
+
export { SpyglassTimeoutError } from "./SpyglassTimeoutError.js";
|
package/dist/cjs/exports.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./core/exports.js";
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as spyglass from
|
|
2
|
-
export type { BaseClientOptions, BaseRequestOptions } from
|
|
3
|
-
export { Spyglass } from
|
|
4
|
-
export { SpyglassEnvironment } from
|
|
5
|
-
export { SpyglassError, SpyglassTimeoutError } from
|
|
6
|
-
export * from
|
|
1
|
+
export * as spyglass from "./api/index.js";
|
|
2
|
+
export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
3
|
+
export { Spyglass } from "./Client.js";
|
|
4
|
+
export { SpyglassEnvironment } from "./environments.js";
|
|
5
|
+
export { SpyglassError, SpyglassTimeoutError } from "./errors/index.js";
|
|
6
|
+
export * from "./exports.js";
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.12";
|
package/dist/cjs/version.js
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.mjs";
|
|
2
|
+
import * as core from "./core/index.mjs";
|
|
3
|
+
import type * as environments from "./environments.mjs";
|
|
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/esm/BaseClient.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
import { BearerAuthProvider } from
|
|
3
|
-
import { mergeHeaders } from
|
|
4
|
-
import * as core from
|
|
2
|
+
import { BearerAuthProvider } from "./auth/BearerAuthProvider.mjs";
|
|
3
|
+
import { mergeHeaders } from "./core/headers.mjs";
|
|
4
|
+
import * as core from "./core/index.mjs";
|
|
5
5
|
export function normalizeClientOptions(options) {
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
"X-Fern-Language": "JavaScript",
|
|
8
|
+
"X-Fern-SDK-Name": "@spyglasshq/sdk",
|
|
9
|
+
"X-Fern-SDK-Version": "0.1.12",
|
|
10
|
+
"User-Agent": "@spyglasshq/sdk/0.1.12",
|
|
11
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
14
14
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
15
15
|
}
|
|
@@ -21,7 +21,7 @@ export function normalizeClientOptionsWithAuth(options) {
|
|
|
21
21
|
return normalized;
|
|
22
22
|
}
|
|
23
23
|
if (options.auth != null) {
|
|
24
|
-
if (typeof options.auth ===
|
|
24
|
+
if (typeof options.auth === "function") {
|
|
25
25
|
normalized.authProvider = { getAuthRequest: options.auth };
|
|
26
26
|
return normalized;
|
|
27
27
|
}
|
package/dist/esm/Client.d.mts
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.mjs";
|
|
2
|
+
import { AccountClient } from "./api/resources/account/client/Client.mjs";
|
|
3
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
4
|
+
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
5
|
+
import * as core from "./core/index.mjs";
|
|
6
6
|
export declare namespace Spyglass {
|
|
7
7
|
type Options = BaseClientOptions;
|
|
8
8
|
interface RequestOptions extends BaseRequestOptions {
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import * as spyglass from
|
|
12
|
-
import { AccountClient } from
|
|
13
|
-
import { normalizeClientOptionsWithAuth
|
|
14
|
-
import { mergeHeaders } from
|
|
15
|
-
import * as core from
|
|
16
|
-
import { mergeAdditionalBodyParameters } from
|
|
17
|
-
import * as environments from
|
|
18
|
-
import { handleNonStatusCodeError } from
|
|
19
|
-
import * as errors from
|
|
11
|
+
import * as spyglass from "./api/index.mjs";
|
|
12
|
+
import { AccountClient } from "./api/resources/account/client/Client.mjs";
|
|
13
|
+
import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
14
|
+
import { mergeHeaders } from "./core/headers.mjs";
|
|
15
|
+
import * as core from "./core/index.mjs";
|
|
16
|
+
import { mergeAdditionalBodyParameters } from "./core/requestBody.mjs";
|
|
17
|
+
import * as environments from "./environments.mjs";
|
|
18
|
+
import { handleNonStatusCodeError } from "./errors/handleNonStatusCodeError.mjs";
|
|
19
|
+
import * as errors from "./errors/index.mjs";
|
|
20
20
|
export class Spyglass {
|
|
21
21
|
constructor(options) {
|
|
22
22
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
@@ -92,12 +92,12 @@ export class Spyglass {
|
|
|
92
92
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
93
93
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
94
94
|
const _response = yield core.fetcher({
|
|
95
|
-
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,
|
|
96
|
-
method:
|
|
95
|
+
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"),
|
|
96
|
+
method: "POST",
|
|
97
97
|
headers: _headers,
|
|
98
|
-
contentType:
|
|
98
|
+
contentType: "application/json",
|
|
99
99
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
100
|
-
requestType:
|
|
100
|
+
requestType: "json",
|
|
101
101
|
body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
102
102
|
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,
|
|
103
103
|
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,
|
|
@@ -106,12 +106,9 @@ export class Spyglass {
|
|
|
106
106
|
logging: this._options.logging,
|
|
107
107
|
});
|
|
108
108
|
if (_response.ok) {
|
|
109
|
-
return {
|
|
110
|
-
data: _response.body,
|
|
111
|
-
rawResponse: _response.rawResponse,
|
|
112
|
-
};
|
|
109
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
113
110
|
}
|
|
114
|
-
if (_response.error.reason ===
|
|
111
|
+
if (_response.error.reason === "status-code") {
|
|
115
112
|
switch (_response.error.statusCode) {
|
|
116
113
|
case 400:
|
|
117
114
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -137,7 +134,7 @@ export class Spyglass {
|
|
|
137
134
|
});
|
|
138
135
|
}
|
|
139
136
|
}
|
|
140
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse,
|
|
137
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/brands");
|
|
141
138
|
});
|
|
142
139
|
}
|
|
143
140
|
/**
|
|
@@ -208,12 +205,12 @@ export class Spyglass {
|
|
|
208
205
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
209
206
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
210
207
|
const _response = yield core.fetcher({
|
|
211
|
-
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,
|
|
212
|
-
method:
|
|
208
|
+
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"),
|
|
209
|
+
method: "POST",
|
|
213
210
|
headers: _headers,
|
|
214
|
-
contentType:
|
|
211
|
+
contentType: "application/json",
|
|
215
212
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
216
|
-
requestType:
|
|
213
|
+
requestType: "json",
|
|
217
214
|
body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
218
215
|
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,
|
|
219
216
|
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,
|
|
@@ -222,12 +219,9 @@ export class Spyglass {
|
|
|
222
219
|
logging: this._options.logging,
|
|
223
220
|
});
|
|
224
221
|
if (_response.ok) {
|
|
225
|
-
return {
|
|
226
|
-
data: _response.body,
|
|
227
|
-
rawResponse: _response.rawResponse,
|
|
228
|
-
};
|
|
222
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
229
223
|
}
|
|
230
|
-
if (_response.error.reason ===
|
|
224
|
+
if (_response.error.reason === "status-code") {
|
|
231
225
|
switch (_response.error.statusCode) {
|
|
232
226
|
case 400:
|
|
233
227
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -253,7 +247,7 @@ export class Spyglass {
|
|
|
253
247
|
});
|
|
254
248
|
}
|
|
255
249
|
}
|
|
256
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse,
|
|
250
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/creators");
|
|
257
251
|
});
|
|
258
252
|
}
|
|
259
253
|
/**
|
|
@@ -296,8 +290,8 @@ export class Spyglass {
|
|
|
296
290
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
297
291
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
298
292
|
const _response = yield core.fetcher({
|
|
299
|
-
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,
|
|
300
|
-
method:
|
|
293
|
+
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"),
|
|
294
|
+
method: "GET",
|
|
301
295
|
headers: _headers,
|
|
302
296
|
queryString: core.url
|
|
303
297
|
.queryBuilder()
|
|
@@ -311,12 +305,9 @@ export class Spyglass {
|
|
|
311
305
|
logging: this._options.logging,
|
|
312
306
|
});
|
|
313
307
|
if (_response.ok) {
|
|
314
|
-
return {
|
|
315
|
-
data: _response.body,
|
|
316
|
-
rawResponse: _response.rawResponse,
|
|
317
|
-
};
|
|
308
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
318
309
|
}
|
|
319
|
-
if (_response.error.reason ===
|
|
310
|
+
if (_response.error.reason === "status-code") {
|
|
320
311
|
switch (_response.error.statusCode) {
|
|
321
312
|
case 400:
|
|
322
313
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -340,7 +331,7 @@ export class Spyglass {
|
|
|
340
331
|
});
|
|
341
332
|
}
|
|
342
333
|
}
|
|
343
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse,
|
|
334
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/taxonomies");
|
|
344
335
|
});
|
|
345
336
|
}
|
|
346
337
|
/**
|
|
@@ -383,12 +374,12 @@ export class Spyglass {
|
|
|
383
374
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
384
375
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
385
376
|
const _response = yield core.fetcher({
|
|
386
|
-
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,
|
|
387
|
-
method:
|
|
377
|
+
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"),
|
|
378
|
+
method: "POST",
|
|
388
379
|
headers: _headers,
|
|
389
|
-
contentType:
|
|
380
|
+
contentType: "application/json",
|
|
390
381
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
391
|
-
requestType:
|
|
382
|
+
requestType: "json",
|
|
392
383
|
body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
393
384
|
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,
|
|
394
385
|
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,
|
|
@@ -397,12 +388,9 @@ export class Spyglass {
|
|
|
397
388
|
logging: this._options.logging,
|
|
398
389
|
});
|
|
399
390
|
if (_response.ok) {
|
|
400
|
-
return {
|
|
401
|
-
data: _response.body,
|
|
402
|
-
rawResponse: _response.rawResponse,
|
|
403
|
-
};
|
|
391
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
404
392
|
}
|
|
405
|
-
if (_response.error.reason ===
|
|
393
|
+
if (_response.error.reason === "status-code") {
|
|
406
394
|
switch (_response.error.statusCode) {
|
|
407
395
|
case 400:
|
|
408
396
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -430,7 +418,7 @@ export class Spyglass {
|
|
|
430
418
|
});
|
|
431
419
|
}
|
|
432
420
|
}
|
|
433
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse,
|
|
421
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/media");
|
|
434
422
|
});
|
|
435
423
|
}
|
|
436
424
|
/**
|
|
@@ -466,8 +454,8 @@ export class Spyglass {
|
|
|
466
454
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
467
455
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
468
456
|
const _response = yield core.fetcher({
|
|
469
|
-
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,
|
|
470
|
-
method:
|
|
457
|
+
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"),
|
|
458
|
+
method: "GET",
|
|
471
459
|
headers: _headers,
|
|
472
460
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
473
461
|
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,
|
|
@@ -477,12 +465,9 @@ export class Spyglass {
|
|
|
477
465
|
logging: this._options.logging,
|
|
478
466
|
});
|
|
479
467
|
if (_response.ok) {
|
|
480
|
-
return {
|
|
481
|
-
data: _response.body,
|
|
482
|
-
rawResponse: _response.rawResponse,
|
|
483
|
-
};
|
|
468
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
484
469
|
}
|
|
485
|
-
if (_response.error.reason ===
|
|
470
|
+
if (_response.error.reason === "status-code") {
|
|
486
471
|
switch (_response.error.statusCode) {
|
|
487
472
|
case 400:
|
|
488
473
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -506,7 +491,7 @@ export class Spyglass {
|
|
|
506
491
|
});
|
|
507
492
|
}
|
|
508
493
|
}
|
|
509
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse,
|
|
494
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/team/credit-usage");
|
|
510
495
|
});
|
|
511
496
|
}
|
|
512
497
|
/**
|
|
@@ -564,12 +549,12 @@ export class Spyglass {
|
|
|
564
549
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
565
550
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
566
551
|
const _response = yield core.fetcher({
|
|
567
|
-
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,
|
|
568
|
-
method:
|
|
552
|
+
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"),
|
|
553
|
+
method: "POST",
|
|
569
554
|
headers: _headers,
|
|
570
|
-
contentType:
|
|
555
|
+
contentType: "application/json",
|
|
571
556
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
572
|
-
requestType:
|
|
557
|
+
requestType: "json",
|
|
573
558
|
body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
574
559
|
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,
|
|
575
560
|
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,
|
|
@@ -578,12 +563,9 @@ export class Spyglass {
|
|
|
578
563
|
logging: this._options.logging,
|
|
579
564
|
});
|
|
580
565
|
if (_response.ok) {
|
|
581
|
-
return {
|
|
582
|
-
data: _response.body,
|
|
583
|
-
rawResponse: _response.rawResponse,
|
|
584
|
-
};
|
|
566
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
585
567
|
}
|
|
586
|
-
if (_response.error.reason ===
|
|
568
|
+
if (_response.error.reason === "status-code") {
|
|
587
569
|
switch (_response.error.statusCode) {
|
|
588
570
|
case 400:
|
|
589
571
|
throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
|
|
@@ -609,7 +591,7 @@ export class Spyglass {
|
|
|
609
591
|
});
|
|
610
592
|
}
|
|
611
593
|
}
|
|
612
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse,
|
|
594
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/comments");
|
|
613
595
|
});
|
|
614
596
|
}
|
|
615
597
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
export var SearchBrandsRequest;
|
|
3
3
|
(function (SearchBrandsRequest) {
|
|
4
4
|
SearchBrandsRequest.SortBy = {
|
|
5
|
-
Name:
|
|
6
|
-
MostFollowers:
|
|
7
|
-
LeastFollowers:
|
|
8
|
-
MostViews:
|
|
9
|
-
HighestEngagement:
|
|
10
|
-
MostActiveAds:
|
|
5
|
+
Name: "NAME",
|
|
6
|
+
MostFollowers: "MOST_FOLLOWERS",
|
|
7
|
+
LeastFollowers: "LEAST_FOLLOWERS",
|
|
8
|
+
MostViews: "MOST_VIEWS",
|
|
9
|
+
HighestEngagement: "HIGHEST_ENGAGEMENT",
|
|
10
|
+
MostActiveAds: "MOST_ACTIVE_ADS",
|
|
11
11
|
};
|
|
12
12
|
})(SearchBrandsRequest || (SearchBrandsRequest = {}));
|