@spyglasshq/sdk 0.1.2 → 0.1.4

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.
Files changed (189) hide show
  1. package/README.md +40 -42
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +257 -6
  4. package/dist/cjs/Client.js +574 -9
  5. package/dist/cjs/api/{resources/search/client/requests/GetMediaRequest.d.ts → client/requests/SearchMediaRequest.d.ts} +13 -13
  6. package/dist/cjs/api/{resources/search/client/requests/GetMediaRequest.js → client/requests/SearchMediaRequest.js} +14 -14
  7. package/dist/cjs/api/client/requests/index.d.ts +5 -0
  8. package/dist/cjs/api/{resources/search/client → client}/requests/index.js +3 -3
  9. package/dist/cjs/api/index.d.ts +1 -0
  10. package/dist/cjs/api/index.js +1 -0
  11. package/dist/cjs/api/resources/account/client/Client.d.ts +131 -11
  12. package/dist/cjs/api/resources/account/client/Client.js +353 -14
  13. package/dist/cjs/api/resources/account/client/index.d.ts +1 -1
  14. package/dist/cjs/api/resources/account/client/index.js +15 -0
  15. package/dist/cjs/api/resources/{indexing/client/requests/IndexBrandRequest.d.ts → account/client/requests/IndexAccountRequest.d.ts} +1 -1
  16. package/dist/{esm/api/resources/indexing/client/requests/IndexBrandStatusRequest.d.mts → cjs/api/resources/account/client/requests/IndexStatusAccountRequest.d.ts} +1 -1
  17. package/dist/cjs/api/resources/{search/client/requests/GetBrandMediaInsightsRequest.d.ts → account/client/requests/InsightsAccountRequest.d.ts} +2 -2
  18. package/dist/cjs/api/resources/{search/client/requests/GetBrandLandingPagesRequest.d.ts → account/client/requests/LandingPagesAccountRequest.d.ts} +2 -2
  19. package/dist/cjs/api/resources/account/client/requests/index.d.ts +5 -0
  20. package/dist/{esm/api/resources/indexing/types/IndexBrandResponse.d.mts → cjs/api/resources/account/types/IndexAccountResponse.d.ts} +3 -3
  21. package/dist/cjs/api/resources/account/types/IndexAccountResponse.js +11 -0
  22. package/dist/cjs/api/resources/{indexing/types/IndexBrandStatusResponse.d.ts → account/types/IndexStatusAccountResponse.d.ts} +3 -3
  23. package/dist/cjs/api/resources/account/types/IndexStatusAccountResponse.js +11 -0
  24. package/dist/cjs/api/resources/account/types/InsightsAccountRequestType.d.ts +7 -0
  25. package/dist/cjs/api/resources/{search/types/GetBrandMediaInsightsRequestType.js → account/types/InsightsAccountRequestType.js} +2 -2
  26. package/dist/cjs/api/resources/{search/types/GetBrandMediaInsightsResponse.d.ts → account/types/InsightsAccountResponse.d.ts} +1 -1
  27. package/dist/cjs/api/resources/account/types/LandingPagesAccountRequestShowInactive.d.ts +5 -0
  28. package/dist/cjs/api/resources/{search/types/GetBrandLandingPagesRequestShowInactive.js → account/types/LandingPagesAccountRequestShowInactive.js} +2 -2
  29. package/dist/cjs/api/resources/{search/types/GetBrandLandingPagesResponse.d.ts → account/types/LandingPagesAccountResponse.d.ts} +3 -3
  30. package/dist/cjs/api/resources/account/types/index.d.ts +7 -1
  31. package/dist/cjs/api/resources/account/types/index.js +7 -1
  32. package/dist/cjs/api/resources/index.d.ts +1 -6
  33. package/dist/cjs/api/resources/index.js +5 -10
  34. package/dist/{esm/api/resources/search/types/GetMediaResponse.d.mts → cjs/api/types/SearchMediaResponse.d.ts} +3 -3
  35. package/dist/cjs/api/{resources/search/types/GetMediaResponse.js → types/SearchMediaResponse.js} +5 -5
  36. package/dist/cjs/api/types/index.d.ts +6 -0
  37. package/dist/cjs/api/types/index.js +6 -0
  38. package/dist/cjs/version.d.ts +1 -1
  39. package/dist/cjs/version.js +1 -1
  40. package/dist/esm/BaseClient.mjs +2 -2
  41. package/dist/esm/Client.d.mts +257 -6
  42. package/dist/esm/Client.mjs +574 -9
  43. package/dist/esm/api/{resources/search/client/requests/GetMediaRequest.d.mts → client/requests/SearchMediaRequest.d.mts} +13 -13
  44. package/dist/esm/api/{resources/search/client/requests/GetMediaRequest.mjs → client/requests/SearchMediaRequest.mjs} +13 -13
  45. package/dist/esm/api/client/requests/index.d.mts +5 -0
  46. package/dist/esm/api/{resources/search/client → client}/requests/index.mjs +1 -1
  47. package/dist/esm/api/index.d.mts +1 -0
  48. package/dist/esm/api/index.mjs +1 -0
  49. package/dist/esm/api/resources/account/client/Client.d.mts +131 -11
  50. package/dist/esm/api/resources/account/client/Client.mjs +353 -14
  51. package/dist/esm/api/resources/account/client/index.d.mts +1 -1
  52. package/dist/esm/api/resources/account/client/index.mjs +1 -1
  53. package/dist/esm/api/resources/{indexing/client/requests/IndexBrandRequest.d.mts → account/client/requests/IndexAccountRequest.d.mts} +1 -1
  54. package/dist/{cjs/api/resources/indexing/client/requests/IndexBrandStatusRequest.d.ts → esm/api/resources/account/client/requests/IndexStatusAccountRequest.d.mts} +1 -1
  55. package/dist/esm/api/resources/{search/client/requests/GetBrandMediaInsightsRequest.d.mts → account/client/requests/InsightsAccountRequest.d.mts} +2 -2
  56. package/dist/esm/api/resources/{search/client/requests/GetBrandLandingPagesRequest.d.mts → account/client/requests/LandingPagesAccountRequest.d.mts} +2 -2
  57. package/dist/esm/api/resources/account/client/requests/index.d.mts +5 -0
  58. package/dist/{cjs/api/resources/indexing/types/IndexBrandResponse.d.ts → esm/api/resources/account/types/IndexAccountResponse.d.mts} +3 -3
  59. package/dist/esm/api/resources/account/types/IndexAccountResponse.mjs +8 -0
  60. package/dist/esm/api/resources/{indexing/types/IndexBrandStatusResponse.d.mts → account/types/IndexStatusAccountResponse.d.mts} +3 -3
  61. package/dist/esm/api/resources/account/types/IndexStatusAccountResponse.mjs +8 -0
  62. package/dist/esm/api/resources/account/types/InsightsAccountRequestType.d.mts +7 -0
  63. package/dist/esm/api/resources/{search/types/GetBrandMediaInsightsRequestType.mjs → account/types/InsightsAccountRequestType.mjs} +1 -1
  64. package/dist/esm/api/resources/{search/types/GetBrandMediaInsightsResponse.d.mts → account/types/InsightsAccountResponse.d.mts} +1 -1
  65. package/dist/esm/api/resources/account/types/LandingPagesAccountRequestShowInactive.d.mts +5 -0
  66. package/dist/esm/api/resources/{search/types/GetBrandLandingPagesRequestShowInactive.mjs → account/types/LandingPagesAccountRequestShowInactive.mjs} +1 -1
  67. package/dist/esm/api/resources/{search/types/GetBrandLandingPagesResponse.d.mts → account/types/LandingPagesAccountResponse.d.mts} +3 -3
  68. package/dist/esm/api/resources/account/types/index.d.mts +7 -1
  69. package/dist/esm/api/resources/account/types/index.mjs +7 -1
  70. package/dist/esm/api/resources/index.d.mts +1 -6
  71. package/dist/esm/api/resources/index.mjs +1 -6
  72. package/dist/{cjs/api/resources/search/types/GetMediaResponse.d.ts → esm/api/types/SearchMediaResponse.d.mts} +3 -3
  73. package/dist/esm/api/{resources/search/types/GetMediaResponse.mjs → types/SearchMediaResponse.mjs} +4 -4
  74. package/dist/esm/api/types/index.d.mts +6 -0
  75. package/dist/esm/api/types/index.mjs +6 -0
  76. package/dist/esm/version.d.mts +1 -1
  77. package/dist/esm/version.mjs +1 -1
  78. package/package.json +1 -23
  79. package/reference.md +109 -111
  80. package/dist/cjs/api/resources/indexing/client/Client.d.ts +0 -74
  81. package/dist/cjs/api/resources/indexing/client/Client.js +0 -219
  82. package/dist/cjs/api/resources/indexing/client/requests/index.d.ts +0 -2
  83. package/dist/cjs/api/resources/indexing/exports.d.ts +0 -2
  84. package/dist/cjs/api/resources/indexing/exports.js +0 -21
  85. package/dist/cjs/api/resources/indexing/index.d.ts +0 -2
  86. package/dist/cjs/api/resources/indexing/index.js +0 -18
  87. package/dist/cjs/api/resources/indexing/types/IndexBrandResponse.js +0 -11
  88. package/dist/cjs/api/resources/indexing/types/IndexBrandStatusResponse.js +0 -11
  89. package/dist/cjs/api/resources/indexing/types/index.d.ts +0 -2
  90. package/dist/cjs/api/resources/indexing/types/index.js +0 -18
  91. package/dist/cjs/api/resources/search/client/Client.d.ts +0 -337
  92. package/dist/cjs/api/resources/search/client/Client.js +0 -823
  93. package/dist/cjs/api/resources/search/client/index.d.ts +0 -1
  94. package/dist/cjs/api/resources/search/client/index.js +0 -17
  95. package/dist/cjs/api/resources/search/client/requests/index.d.ts +0 -8
  96. package/dist/cjs/api/resources/search/exports.d.ts +0 -2
  97. package/dist/cjs/api/resources/search/exports.js +0 -21
  98. package/dist/cjs/api/resources/search/index.d.ts +0 -2
  99. package/dist/cjs/api/resources/search/index.js +0 -18
  100. package/dist/cjs/api/resources/search/types/GetBrandLandingPagesRequestShowInactive.d.ts +0 -5
  101. package/dist/cjs/api/resources/search/types/GetBrandMediaInsightsRequestType.d.ts +0 -7
  102. package/dist/cjs/api/resources/search/types/index.d.ts +0 -10
  103. package/dist/cjs/api/resources/search/types/index.js +0 -26
  104. package/dist/esm/api/resources/indexing/client/Client.d.mts +0 -74
  105. package/dist/esm/api/resources/indexing/client/Client.mjs +0 -182
  106. package/dist/esm/api/resources/indexing/client/requests/index.d.mts +0 -2
  107. package/dist/esm/api/resources/indexing/exports.d.mts +0 -2
  108. package/dist/esm/api/resources/indexing/exports.mjs +0 -3
  109. package/dist/esm/api/resources/indexing/index.d.mts +0 -2
  110. package/dist/esm/api/resources/indexing/index.mjs +0 -2
  111. package/dist/esm/api/resources/indexing/types/IndexBrandResponse.mjs +0 -8
  112. package/dist/esm/api/resources/indexing/types/IndexBrandStatusResponse.mjs +0 -8
  113. package/dist/esm/api/resources/indexing/types/index.d.mts +0 -2
  114. package/dist/esm/api/resources/indexing/types/index.mjs +0 -2
  115. package/dist/esm/api/resources/search/client/Client.d.mts +0 -337
  116. package/dist/esm/api/resources/search/client/Client.mjs +0 -786
  117. package/dist/esm/api/resources/search/client/index.d.mts +0 -1
  118. package/dist/esm/api/resources/search/client/index.mjs +0 -1
  119. package/dist/esm/api/resources/search/client/requests/index.d.mts +0 -8
  120. package/dist/esm/api/resources/search/exports.d.mts +0 -2
  121. package/dist/esm/api/resources/search/exports.mjs +0 -3
  122. package/dist/esm/api/resources/search/index.d.mts +0 -2
  123. package/dist/esm/api/resources/search/index.mjs +0 -2
  124. package/dist/esm/api/resources/search/types/GetBrandLandingPagesRequestShowInactive.d.mts +0 -5
  125. package/dist/esm/api/resources/search/types/GetBrandMediaInsightsRequestType.d.mts +0 -7
  126. package/dist/esm/api/resources/search/types/index.d.mts +0 -10
  127. package/dist/esm/api/resources/search/types/index.mjs +0 -10
  128. /package/dist/cjs/api/{resources/indexing/client → client}/index.d.ts +0 -0
  129. /package/dist/cjs/api/{resources/indexing/client → client}/index.js +0 -0
  130. /package/dist/cjs/api/{resources/search/client → client}/requests/GetCommentsRequest.d.ts +0 -0
  131. /package/dist/cjs/api/{resources/search/client → client}/requests/GetCommentsRequest.js +0 -0
  132. /package/dist/cjs/api/{resources/search/client → client}/requests/SearchBrandsRequest.d.ts +0 -0
  133. /package/dist/cjs/api/{resources/search/client → client}/requests/SearchBrandsRequest.js +0 -0
  134. /package/dist/cjs/api/{resources/search/client → client}/requests/SearchCreatorsRequest.d.ts +0 -0
  135. /package/dist/cjs/api/{resources/search/client → client}/requests/SearchCreatorsRequest.js +0 -0
  136. /package/dist/cjs/api/{resources/search/client → client}/requests/SearchTaxonomiesRequest.d.ts +0 -0
  137. /package/dist/cjs/api/{resources/search/client → client}/requests/SearchTaxonomiesRequest.js +0 -0
  138. /package/dist/cjs/api/resources/{search → account}/client/requests/GetAccountRequest.d.ts +0 -0
  139. /package/dist/cjs/api/resources/{search → account}/client/requests/GetAccountRequest.js +0 -0
  140. /package/dist/cjs/api/resources/account/{types/GetCreditUsageResponse.js → client/requests/IndexAccountRequest.js} +0 -0
  141. /package/dist/cjs/api/resources/{indexing/client/requests/IndexBrandRequest.js → account/client/requests/IndexStatusAccountRequest.js} +0 -0
  142. /package/dist/cjs/api/resources/{indexing/client/requests/IndexBrandStatusRequest.js → account/client/requests/InsightsAccountRequest.js} +0 -0
  143. /package/dist/cjs/api/resources/{search/client/requests/GetBrandLandingPagesRequest.js → account/client/requests/LandingPagesAccountRequest.js} +0 -0
  144. /package/dist/cjs/api/resources/{indexing → account}/client/requests/index.js +0 -0
  145. /package/dist/cjs/api/resources/{search → account}/types/GetAccountResponse.d.ts +0 -0
  146. /package/dist/cjs/api/resources/{search → account}/types/GetAccountResponse.js +0 -0
  147. /package/dist/cjs/api/resources/{search/client/requests/GetBrandMediaInsightsRequest.js → account/types/InsightsAccountResponse.js} +0 -0
  148. /package/dist/cjs/api/resources/{search/types/GetBrandLandingPagesResponse.js → account/types/LandingPagesAccountResponse.js} +0 -0
  149. /package/dist/cjs/api/{resources/search/types → types}/GetCommentsResponse.d.ts +0 -0
  150. /package/dist/cjs/api/{resources/search/types → types}/GetCommentsResponse.js +0 -0
  151. /package/dist/cjs/api/{resources/account/types → types}/GetCreditUsageResponse.d.ts +0 -0
  152. /package/dist/cjs/api/{resources/search/types/GetBrandMediaInsightsResponse.js → types/GetCreditUsageResponse.js} +0 -0
  153. /package/dist/cjs/api/{resources/search/types → types}/SearchBrandsResponse.d.ts +0 -0
  154. /package/dist/cjs/api/{resources/search/types → types}/SearchBrandsResponse.js +0 -0
  155. /package/dist/cjs/api/{resources/search/types → types}/SearchCreatorsResponse.d.ts +0 -0
  156. /package/dist/cjs/api/{resources/search/types → types}/SearchCreatorsResponse.js +0 -0
  157. /package/dist/cjs/api/{resources/search/types → types}/SearchTaxonomiesResponse.d.ts +0 -0
  158. /package/dist/cjs/api/{resources/search/types → types}/SearchTaxonomiesResponse.js +0 -0
  159. /package/dist/esm/api/{resources/indexing/client → client}/index.d.mts +0 -0
  160. /package/dist/esm/api/{resources/indexing/client → client}/index.mjs +0 -0
  161. /package/dist/esm/api/{resources/search/client → client}/requests/GetCommentsRequest.d.mts +0 -0
  162. /package/dist/esm/api/{resources/search/client → client}/requests/GetCommentsRequest.mjs +0 -0
  163. /package/dist/esm/api/{resources/search/client → client}/requests/SearchBrandsRequest.d.mts +0 -0
  164. /package/dist/esm/api/{resources/search/client → client}/requests/SearchBrandsRequest.mjs +0 -0
  165. /package/dist/esm/api/{resources/search/client → client}/requests/SearchCreatorsRequest.d.mts +0 -0
  166. /package/dist/esm/api/{resources/search/client → client}/requests/SearchCreatorsRequest.mjs +0 -0
  167. /package/dist/esm/api/{resources/search/client → client}/requests/SearchTaxonomiesRequest.d.mts +0 -0
  168. /package/dist/esm/api/{resources/search/client → client}/requests/SearchTaxonomiesRequest.mjs +0 -0
  169. /package/dist/esm/api/resources/{search → account}/client/requests/GetAccountRequest.d.mts +0 -0
  170. /package/dist/esm/api/resources/{search → account}/client/requests/GetAccountRequest.mjs +0 -0
  171. /package/dist/esm/api/resources/account/{types/GetCreditUsageResponse.mjs → client/requests/IndexAccountRequest.mjs} +0 -0
  172. /package/dist/esm/api/resources/{indexing/client/requests/IndexBrandRequest.mjs → account/client/requests/IndexStatusAccountRequest.mjs} +0 -0
  173. /package/dist/esm/api/resources/{indexing/client/requests/IndexBrandStatusRequest.mjs → account/client/requests/InsightsAccountRequest.mjs} +0 -0
  174. /package/dist/esm/api/resources/{search/client/requests/GetBrandLandingPagesRequest.mjs → account/client/requests/LandingPagesAccountRequest.mjs} +0 -0
  175. /package/dist/esm/api/resources/{indexing → account}/client/requests/index.mjs +0 -0
  176. /package/dist/esm/api/resources/{search → account}/types/GetAccountResponse.d.mts +0 -0
  177. /package/dist/esm/api/resources/{search → account}/types/GetAccountResponse.mjs +0 -0
  178. /package/dist/esm/api/resources/{search/client/requests/GetBrandMediaInsightsRequest.mjs → account/types/InsightsAccountResponse.mjs} +0 -0
  179. /package/dist/esm/api/resources/{search/types/GetBrandLandingPagesResponse.mjs → account/types/LandingPagesAccountResponse.mjs} +0 -0
  180. /package/dist/esm/api/{resources/search/types → types}/GetCommentsResponse.d.mts +0 -0
  181. /package/dist/esm/api/{resources/search/types → types}/GetCommentsResponse.mjs +0 -0
  182. /package/dist/esm/api/{resources/account/types → types}/GetCreditUsageResponse.d.mts +0 -0
  183. /package/dist/esm/api/{resources/search/types/GetBrandMediaInsightsResponse.mjs → types/GetCreditUsageResponse.mjs} +0 -0
  184. /package/dist/esm/api/{resources/search/types → types}/SearchBrandsResponse.d.mts +0 -0
  185. /package/dist/esm/api/{resources/search/types → types}/SearchBrandsResponse.mjs +0 -0
  186. /package/dist/esm/api/{resources/search/types → types}/SearchCreatorsResponse.d.mts +0 -0
  187. /package/dist/esm/api/{resources/search/types → types}/SearchCreatorsResponse.mjs +0 -0
  188. /package/dist/esm/api/{resources/search/types → types}/SearchTaxonomiesResponse.d.mts +0 -0
  189. /package/dist/esm/api/{resources/search/types → types}/SearchTaxonomiesResponse.mjs +0 -0
@@ -1,74 +0,0 @@
1
- import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
- import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
- import * as core from "../../../../core/index.js";
4
- import * as spyglass from "../../../index.js";
5
- export declare namespace IndexingClient {
6
- type Options = BaseClientOptions;
7
- interface RequestOptions extends BaseRequestOptions {
8
- }
9
- }
10
- /**
11
- * Add an account we do not have yet, then poll until ready.
12
- */
13
- export declare class IndexingClient {
14
- protected readonly _options: NormalizedClientOptionsWithAuth<IndexingClient.Options>;
15
- constructor(options: IndexingClient.Options);
16
- /**
17
- * Look up a brand by website URL, or start indexing it if we do not
18
- * have it yet. Pass a single `websiteUrl`. Instagram and TikTok
19
- * profile URLs are accepted and resolved as creators.
20
- *
21
- * This endpoint does not consume credits. An existing brand returns
22
- * `status: "already_exists"`. A new brand is created and sync is
23
- * queued, returning `status: "indexing"` and the new `brandId`.
24
- *
25
- * Limited to 50 requests per minute per user.
26
- * This call is free.
27
- *
28
- * @param {spyglass.IndexBrandRequest} request
29
- * @param {IndexingClient.RequestOptions} requestOptions - Request-specific configuration.
30
- *
31
- * @throws {@link spyglass.BadRequestError}
32
- * @throws {@link spyglass.UnauthorizedError}
33
- * @throws {@link spyglass.ForbiddenError}
34
- * @throws {@link spyglass.MethodNotAllowedError}
35
- * @throws {@link spyglass.ContentTooLargeError}
36
- * @throws {@link spyglass.TooManyRequestsError}
37
- * @throws {@link spyglass.InternalServerError}
38
- * @throws {@link errors.SpyglassError}
39
- * @throws {@link errors.SpyglassTimeoutError}
40
- *
41
- * @example
42
- * await client.indexing.indexBrand({
43
- * websiteUrl: "https://www.nike.com"
44
- * })
45
- */
46
- indexBrand(request: spyglass.IndexBrandRequest, requestOptions?: IndexingClient.RequestOptions): core.HttpResponsePromise<spyglass.IndexBrandResponse>;
47
- private __indexBrand;
48
- /**
49
- * Poll whether a brand finished indexing after POST /account/index.
50
- *
51
- * Limited to 300 requests per minute per user.
52
- * This call is free.
53
- *
54
- * @param {spyglass.IndexBrandStatusRequest} request
55
- * @param {IndexingClient.RequestOptions} requestOptions - Request-specific configuration.
56
- *
57
- * @throws {@link spyglass.BadRequestError}
58
- * @throws {@link spyglass.UnauthorizedError}
59
- * @throws {@link spyglass.ForbiddenError}
60
- * @throws {@link spyglass.NotFoundError}
61
- * @throws {@link spyglass.MethodNotAllowedError}
62
- * @throws {@link spyglass.TooManyRequestsError}
63
- * @throws {@link spyglass.InternalServerError}
64
- * @throws {@link errors.SpyglassError}
65
- * @throws {@link errors.SpyglassTimeoutError}
66
- *
67
- * @example
68
- * await client.indexing.indexBrandStatus({
69
- * id: "id"
70
- * })
71
- */
72
- indexBrandStatus(request: spyglass.IndexBrandStatusRequest, requestOptions?: IndexingClient.RequestOptions): core.HttpResponsePromise<spyglass.IndexBrandStatusResponse>;
73
- private __indexBrandStatus;
74
- }
@@ -1,219 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.IndexingClient = void 0;
47
- const BaseClient_js_1 = require("../../../../BaseClient.js");
48
- const headers_js_1 = require("../../../../core/headers.js");
49
- const core = __importStar(require("../../../../core/index.js"));
50
- const requestBody_js_1 = require("../../../../core/requestBody.js");
51
- const environments = __importStar(require("../../../../environments.js"));
52
- const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
53
- const errors = __importStar(require("../../../../errors/index.js"));
54
- const spyglass = __importStar(require("../../../index.js"));
55
- /**
56
- * Add an account we do not have yet, then poll until ready.
57
- */
58
- class IndexingClient {
59
- constructor(options) {
60
- this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
61
- }
62
- /**
63
- * Look up a brand by website URL, or start indexing it if we do not
64
- * have it yet. Pass a single `websiteUrl`. Instagram and TikTok
65
- * profile URLs are accepted and resolved as creators.
66
- *
67
- * This endpoint does not consume credits. An existing brand returns
68
- * `status: "already_exists"`. A new brand is created and sync is
69
- * queued, returning `status: "indexing"` and the new `brandId`.
70
- *
71
- * Limited to 50 requests per minute per user.
72
- * This call is free.
73
- *
74
- * @param {spyglass.IndexBrandRequest} request
75
- * @param {IndexingClient.RequestOptions} requestOptions - Request-specific configuration.
76
- *
77
- * @throws {@link spyglass.BadRequestError}
78
- * @throws {@link spyglass.UnauthorizedError}
79
- * @throws {@link spyglass.ForbiddenError}
80
- * @throws {@link spyglass.MethodNotAllowedError}
81
- * @throws {@link spyglass.ContentTooLargeError}
82
- * @throws {@link spyglass.TooManyRequestsError}
83
- * @throws {@link spyglass.InternalServerError}
84
- * @throws {@link errors.SpyglassError}
85
- * @throws {@link errors.SpyglassTimeoutError}
86
- *
87
- * @example
88
- * await client.indexing.indexBrand({
89
- * websiteUrl: "https://www.nike.com"
90
- * })
91
- */
92
- indexBrand(request, requestOptions) {
93
- return core.HttpResponsePromise.fromPromise(this.__indexBrand(request, requestOptions));
94
- }
95
- __indexBrand(request, requestOptions) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
98
- const _authRequest = yield this._options.authProvider.getAuthRequest();
99
- 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);
100
- const _response = yield core.fetcher({
101
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SpyglassEnvironment.Default, "account/index"),
102
- method: "POST",
103
- headers: _headers,
104
- contentType: "application/json",
105
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
106
- requestType: "json",
107
- body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
108
- 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,
109
- 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,
110
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
111
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
112
- logging: this._options.logging,
113
- });
114
- if (_response.ok) {
115
- return { data: _response.body, rawResponse: _response.rawResponse };
116
- }
117
- if (_response.error.reason === "status-code") {
118
- switch (_response.error.statusCode) {
119
- case 400:
120
- throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
121
- case 401:
122
- throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
123
- case 403:
124
- throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
125
- case 405:
126
- throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
127
- case 413:
128
- throw new spyglass.ContentTooLargeError(_response.error.body, _response.rawResponse);
129
- case 429:
130
- throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
131
- case 500:
132
- throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
133
- default:
134
- throw new errors.SpyglassError({
135
- statusCode: _response.error.statusCode,
136
- body: _response.error.body,
137
- rawResponse: _response.rawResponse,
138
- });
139
- }
140
- }
141
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/account/index");
142
- });
143
- }
144
- /**
145
- * Poll whether a brand finished indexing after POST /account/index.
146
- *
147
- * Limited to 300 requests per minute per user.
148
- * This call is free.
149
- *
150
- * @param {spyglass.IndexBrandStatusRequest} request
151
- * @param {IndexingClient.RequestOptions} requestOptions - Request-specific configuration.
152
- *
153
- * @throws {@link spyglass.BadRequestError}
154
- * @throws {@link spyglass.UnauthorizedError}
155
- * @throws {@link spyglass.ForbiddenError}
156
- * @throws {@link spyglass.NotFoundError}
157
- * @throws {@link spyglass.MethodNotAllowedError}
158
- * @throws {@link spyglass.TooManyRequestsError}
159
- * @throws {@link spyglass.InternalServerError}
160
- * @throws {@link errors.SpyglassError}
161
- * @throws {@link errors.SpyglassTimeoutError}
162
- *
163
- * @example
164
- * await client.indexing.indexBrandStatus({
165
- * id: "id"
166
- * })
167
- */
168
- indexBrandStatus(request, requestOptions) {
169
- return core.HttpResponsePromise.fromPromise(this.__indexBrandStatus(request, requestOptions));
170
- }
171
- __indexBrandStatus(request, requestOptions) {
172
- return __awaiter(this, void 0, void 0, function* () {
173
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
174
- const { id } = request;
175
- const _authRequest = yield this._options.authProvider.getAuthRequest();
176
- 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);
177
- const _response = yield core.fetcher({
178
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SpyglassEnvironment.Default, `account/${core.url.encodePathParam(id, errors.SpyglassError)}/index-status`),
179
- method: "GET",
180
- headers: _headers,
181
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
182
- 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,
183
- 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,
184
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
185
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
186
- logging: this._options.logging,
187
- });
188
- if (_response.ok) {
189
- return { data: _response.body, rawResponse: _response.rawResponse };
190
- }
191
- if (_response.error.reason === "status-code") {
192
- switch (_response.error.statusCode) {
193
- case 400:
194
- throw new spyglass.BadRequestError(_response.error.body, _response.rawResponse);
195
- case 401:
196
- throw new spyglass.UnauthorizedError(_response.error.body, _response.rawResponse);
197
- case 403:
198
- throw new spyglass.ForbiddenError(_response.error.body, _response.rawResponse);
199
- case 404:
200
- throw new spyglass.NotFoundError(_response.error.body, _response.rawResponse);
201
- case 405:
202
- throw new spyglass.MethodNotAllowedError(_response.error.body, _response.rawResponse);
203
- case 429:
204
- throw new spyglass.TooManyRequestsError(_response.error.body, _response.rawResponse);
205
- case 500:
206
- throw new spyglass.InternalServerError(_response.error.body, _response.rawResponse);
207
- default:
208
- throw new errors.SpyglassError({
209
- statusCode: _response.error.statusCode,
210
- body: _response.error.body,
211
- rawResponse: _response.rawResponse,
212
- });
213
- }
214
- }
215
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/account/{id}/index-status");
216
- });
217
- }
218
- }
219
- exports.IndexingClient = IndexingClient;
@@ -1,2 +0,0 @@
1
- export type { IndexBrandRequest } from "./IndexBrandRequest.js";
2
- export type { IndexBrandStatusRequest } from "./IndexBrandStatusRequest.js";
@@ -1,2 +0,0 @@
1
- export { IndexingClient } from "./client/Client.js";
2
- export * from "./client/index.js";
@@ -1,21 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.IndexingClient = void 0;
19
- var Client_js_1 = require("./client/Client.js");
20
- Object.defineProperty(exports, "IndexingClient", { enumerable: true, get: function () { return Client_js_1.IndexingClient; } });
21
- __exportStar(require("./client/index.js"), exports);
@@ -1,2 +0,0 @@
1
- export * from "./client/index.js";
2
- export * from "./types/index.js";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client/index.js"), exports);
18
- __exportStar(require("./types/index.js"), exports);
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IndexBrandResponse = void 0;
5
- var IndexBrandResponse;
6
- (function (IndexBrandResponse) {
7
- IndexBrandResponse.Status = {
8
- AlreadyExists: "already_exists",
9
- Indexing: "indexing",
10
- };
11
- })(IndexBrandResponse || (exports.IndexBrandResponse = IndexBrandResponse = {}));
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IndexBrandStatusResponse = void 0;
5
- var IndexBrandStatusResponse;
6
- (function (IndexBrandStatusResponse) {
7
- IndexBrandStatusResponse.Status = {
8
- Indexing: "indexing",
9
- Ready: "ready",
10
- };
11
- })(IndexBrandStatusResponse || (exports.IndexBrandStatusResponse = IndexBrandStatusResponse = {}));
@@ -1,2 +0,0 @@
1
- export * from "./IndexBrandResponse.js";
2
- export * from "./IndexBrandStatusResponse.js";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./IndexBrandResponse.js"), exports);
18
- __exportStar(require("./IndexBrandStatusResponse.js"), exports);