@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
package/README.md CHANGED
@@ -48,7 +48,7 @@
48
48
  - [Discover Creators](#3-discover-creators)
49
49
  - [Creative Insights & Landing Pages](#4-creative-insights--landing-pages)
50
50
  - [Post Comments](#5-post-comments)
51
- - [Index a New Brand](#6-index-a-new-brand)
51
+ - [Index a New Account](#6-index-a-new-account)
52
52
  - [Check Team Credit Usage](#7-check-team-credit-usage)
53
53
  - [API Reference Overview](#api-reference-overview)
54
54
  - [TypeScript Types](#typescript-types)
@@ -86,7 +86,7 @@ const client = new Spyglass({
86
86
  });
87
87
 
88
88
  // 1. Resolve a brand by name
89
- const { brands } = await client.search.brands({
89
+ const { brands } = await client.searchBrands({
90
90
  names: ["Nike"],
91
91
  limit: 1,
92
92
  });
@@ -95,7 +95,7 @@ const brand = brands[0];
95
95
 
96
96
  if (brand) {
97
97
  // 2. Search the creatives that brand is running
98
- const { media } = await client.search.getMedia({
98
+ const { media } = await client.searchMedia({
99
99
  brandId: brand.id,
100
100
  query: "marathon running shoes comfort",
101
101
  limit: 10,
@@ -124,13 +124,13 @@ Search advertisers by name (`names`), social handle (`igUsername`, `tiktokUserna
124
124
 
125
125
  ```ts
126
126
  // Fuzzy name lookup
127
- const byName = await client.search.brands({
127
+ const byName = await client.searchBrands({
128
128
  names: ["Athletic Greens", "AG1"],
129
129
  limit: 5,
130
130
  });
131
131
 
132
132
  // Natural-language discovery
133
- const byBrief = await client.search.brands({
133
+ const byBrief = await client.searchBrands({
134
134
  query: "DTC electrolyte and hydration powder brands",
135
135
  limit: 10,
136
136
  });
@@ -142,16 +142,16 @@ Pass `brandId` to inspect a specific brand or creator's creatives, or omit `bran
142
142
 
143
143
  ```ts
144
144
  // Optional: look up valid product taxonomy paths first (free call)
145
- const { taxonomies } = await client.search.taxonomies({
145
+ const { paths } = await client.searchTaxonomies({
146
146
  query: "running shoes",
147
147
  });
148
148
 
149
- const { media, count } = await client.search.getMedia({
149
+ const { media, count } = await client.searchMedia({
150
150
  query: "UGC founder story explaining product benefits",
151
151
  channel: ["META_AD", "TIKTOK"],
152
152
  format: ["VIDEO"],
153
153
  status: "ACTIVE",
154
- taxonomy: taxonomies.slice(0, 2),
154
+ taxonomy: paths.slice(0, 2),
155
155
  minDaysRun: 14,
156
156
  limit: 20,
157
157
  offset: 0,
@@ -168,23 +168,23 @@ Each item in `media` includes creative intelligence extracted by Spyglass:
168
168
  Search creators by handle, name, or natural-language brief, and filter by demographic and profile attributes (`gender`, `ageRange`, `ethnicity`, `location`, `language`):
169
169
 
170
170
  ```ts
171
- const { creators } = await client.search.creators({
171
+ const { creators } = await client.searchCreators({
172
172
  query: "skincare routine and dermatology tips",
173
173
  gender: "female",
174
- ageRange: ["25-34"],
175
- location: ["US"],
176
- language: ["en"],
174
+ ageRange: "25-34",
175
+ location: "United States",
176
+ language: "English",
177
177
  limit: 20,
178
178
  });
179
179
  ```
180
180
 
181
181
  ### 4. Creative Insights & Landing Pages
182
182
 
183
- Pull clustered creative themes (`HOOK`, `USP`, `PERSONA`, `MEDIA_MIX`) and ranked destination landing pages for any brand:
183
+ Pull clustered creative themes (`HOOK`, `USP`, `PERSONA`, `MEDIA_MIX`) 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
187
- const insights = await client.search.getBrandMediaInsights({
187
+ const insights = await client.account.insights({
188
188
  id: brand.id,
189
189
  type: "HOOK",
190
190
  maxDaysBack: 90,
@@ -192,7 +192,7 @@ const insights = await client.search.getBrandMediaInsights({
192
192
  });
193
193
 
194
194
  // Top landing pages where the brand sends ad traffic
195
- const { landingPages } = await client.search.getBrandLandingPages({
195
+ const { landingPages } = await client.account.landingPages({
196
196
  id: brand.id,
197
197
  showInactive: "false",
198
198
  limit: 20,
@@ -204,19 +204,19 @@ const { landingPages } = await client.search.getBrandLandingPages({
204
204
  Fetch public comments from Instagram posts/reels (by shortcode or URL) and TikTok videos (by video ID or URL):
205
205
 
206
206
  ```ts
207
- const { posts } = await client.search.getComments({
207
+ const { posts } = await client.getComments({
208
208
  instagramIds: ["https://www.instagram.com/reel/C2xY9abcD1e/"],
209
209
  tiktokIds: ["https://www.tiktok.com/@nike/video/7234567890123456789"],
210
210
  limit: 1, // comment pages per post
211
211
  });
212
212
  ```
213
213
 
214
- ### 6. Index a New Brand
214
+ ### 6. Index a New Account
215
215
 
216
- If Spyglass doesn't have a brand yet, submit its website or social profile URL (`POST /account/index` is free) and poll until `status` is `"ready"`:
216
+ If Spyglass doesn't have a brand or creator yet, submit its website or social profile URL (`POST /account/index` is free) and poll until `status` is `"ready"`:
217
217
 
218
218
  ```ts
219
- const indexed = await client.indexing.indexBrand({
219
+ const indexed = await client.account.index({
220
220
  websiteUrl: "https://www.on.com",
221
221
  });
222
222
 
@@ -224,12 +224,12 @@ const indexed = await client.indexing.indexBrand({
224
224
  let status = indexed.status;
225
225
  while (status === "indexing") {
226
226
  await new Promise((resolve) => setTimeout(resolve, 3000));
227
- const check = await client.indexing.indexBrandStatus({ id: indexed.brandId });
227
+ const check = await client.account.indexStatus({ id: indexed.brandId });
228
228
  status = check.status;
229
229
  }
230
230
 
231
231
  if (status === "ready" || status === "already_exists") {
232
- const account = await client.search.getAccount({ id: indexed.brandId });
232
+ const account = await client.account.get({ id: indexed.brandId });
233
233
  console.log("Indexed account:", account.name);
234
234
  }
235
235
  ```
@@ -239,7 +239,7 @@ if (status === "ready" || status === "already_exists") {
239
239
  Check your team's remaining monthly credits and current billing window (free call):
240
240
 
241
241
  ```ts
242
- const usage = await client.account.getCreditUsage();
242
+ const usage = await client.getCreditUsage();
243
243
  console.log(`Remaining: ${usage.remainingCredits} / ${usage.planCredits}`);
244
244
  ```
245
245
 
@@ -249,17 +249,17 @@ console.log(`Remaining: ${usage.remainingCredits} / ${usage.planCredits}`);
249
249
 
250
250
  | SDK Method | HTTP Endpoint | Cost | Rate Limit |
251
251
  | --- | --- | --- | --- |
252
- | `client.search.brands(req)` | `POST /brands` | $0.0020 / brand returned | 120 / min |
253
- | `client.search.creators(req)` | `POST /creators` | $0.0020 / creator returned | 120 / min |
254
- | `client.search.getAccount({ id })` | `GET /account/{id}` | $0.0020 / account returned | 120 / min |
255
- | `client.search.getMedia(req)` | `POST /media` | $0.0010 / creative returned | 120 / min |
256
- | `client.search.taxonomies({ query })` | `GET /taxonomies` | Free | 120 / min |
257
- | `client.search.getBrandMediaInsights(req)` | `GET /account/{id}/insights` | $0.0010 / cluster returned | 120 / min |
258
- | `client.search.getBrandLandingPages(req)` | `GET /account/{id}/landing-pages` | $0.0050 / landing page returned | 120 / min |
259
- | `client.search.getComments(req)` | `POST /comments` | $0.0100 / live page fetched | 20 / min |
260
- | `client.indexing.indexBrand(req)` | `POST /account/index` | Free | 50 / min |
261
- | `client.indexing.indexBrandStatus({ id })` | `GET /account/{id}/index-status` | Free | 300 / min |
262
- | `client.account.getCreditUsage()` | `GET /team/credit-usage` | Free | 120 / min |
252
+ | `client.searchBrands(req)` | `POST /brands` | $0.0020 / brand returned | 120 / min |
253
+ | `client.searchCreators(req)` | `POST /creators` | $0.0020 / creator returned | 120 / min |
254
+ | `client.searchMedia(req)` | `POST /media` | $0.0010 / creative returned | 120 / min |
255
+ | `client.searchTaxonomies({ query })` | `GET /taxonomies` | Free | 120 / min |
256
+ | `client.getComments(req)` | `POST /comments` | $0.0100 / live page fetched | 20 / min |
257
+ | `client.account.get({ id })` | `GET /account/{id}` | $0.0020 / account returned | 120 / min |
258
+ | `client.account.insights(req)` | `GET /account/{id}/insights` | $0.0010 / cluster returned | 120 / min |
259
+ | `client.account.landingPages(req)` | `GET /account/{id}/landing-pages` | $0.0050 / landing page returned | 120 / min |
260
+ | `client.account.index(req)` | `POST /account/index` | Free | 50 / min |
261
+ | `client.account.indexStatus({ id })` | `GET /account/{id}/index-status` | Free | 300 / min |
262
+ | `client.getCreditUsage()` | `GET /team/credit-usage` | Free | 120 / min |
263
263
 
264
264
  Full method signatures and parameter types are available in [`reference.md`](https://github.com/spyglass-so/spyglass-typescript/blob/main/reference.md) and at [docs.spyglass.so](https://docs.spyglass.so).
265
265
 
@@ -272,13 +272,13 @@ All request and response types are exported under the `spyglass` namespace:
272
272
  ```ts
273
273
  import { spyglass } from "@spyglasshq/sdk";
274
274
 
275
- const request: spyglass.GetMediaRequest = {
275
+ const request: spyglass.SearchMediaRequest = {
276
276
  query: "summer sale",
277
277
  channel: ["META_AD"],
278
278
  limit: 25,
279
279
  };
280
280
 
281
- type MediaItem = spyglass.GetMediaResponse.Media.Item;
281
+ type MediaItem = spyglass.SearchMediaResponse.Media.Item;
282
282
  ```
283
283
 
284
284
  ## Error Handling
@@ -289,7 +289,7 @@ When the API returns a non-2xx status code (`400`, `401`, `402` out of credits,
289
289
  import { SpyglassError } from "@spyglasshq/sdk";
290
290
 
291
291
  try {
292
- await client.search.brands({ names: ["Nike"], limit: 5 });
292
+ await client.searchBrands({ names: ["Nike"], limit: 5 });
293
293
  } catch (err) {
294
294
  if (err instanceof SpyglassError) {
295
295
  console.error("Status:", err.statusCode);
@@ -310,7 +310,7 @@ The SDK defaults to a **60-second timeout** and **2 automatic retries** with exp
310
310
  ```ts
311
311
  const controller = new AbortController();
312
312
 
313
- const response = await client.search.getMedia(
313
+ const response = await client.searchMedia(
314
314
  { query: "protein bar", limit: 10 },
315
315
  {
316
316
  timeoutInSeconds: 30,
@@ -326,8 +326,8 @@ const response = await client.search.getMedia(
326
326
  Chain `.withRawResponse()` on any request promise to inspect HTTP status codes and headers alongside parsed data:
327
327
 
328
328
  ```ts
329
- const { data, rawResponse } = await client.search
330
- .brands({ names: ["Nike"], limit: 1 })
329
+ const { data, rawResponse } = await client
330
+ .searchBrands({ names: ["Nike"], limit: 1 })
331
331
  .withRawResponse();
332
332
 
333
333
  console.log(data.brands);
@@ -336,11 +336,9 @@ console.log(rawResponse.headers.get("retry-after"));
336
336
 
337
337
  ### Tree-Shakeable Subpackage Imports
338
338
 
339
- Import individual resource clients directly for minimal bundle sizes:
339
+ Import the `account` resource client directly for minimal bundle sizes:
340
340
 
341
341
  ```ts
342
- import { SearchClient } from "@spyglasshq/sdk/search";
343
- import { IndexingClient } from "@spyglasshq/sdk/indexing";
344
342
  import { AccountClient } from "@spyglasshq/sdk/account";
345
343
  ```
346
344
 
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@spyglasshq/sdk",
46
- "X-Fern-SDK-Version": "0.1.2",
47
- "User-Agent": "@spyglasshq/sdk/0.1.2",
46
+ "X-Fern-SDK-Version": "0.1.3",
47
+ "User-Agent": "@spyglasshq/sdk/0.1.3",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,6 +1,5 @@
1
+ import * as spyglass from "./api/index.js";
1
2
  import { AccountClient } from "./api/resources/account/client/Client.js";
2
- import { IndexingClient } from "./api/resources/indexing/client/Client.js";
3
- import { SearchClient } from "./api/resources/search/client/Client.js";
4
3
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
5
4
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
6
5
  import * as core from "./core/index.js";
@@ -11,13 +10,265 @@ export declare namespace Spyglass {
11
10
  }
12
11
  export declare class Spyglass {
13
12
  protected readonly _options: NormalizedClientOptionsWithAuth<Spyglass.Options>;
14
- protected _search: SearchClient | undefined;
15
13
  protected _account: AccountClient | undefined;
16
- protected _indexing: IndexingClient | undefined;
17
14
  constructor(options: Spyglass.Options);
18
- get search(): SearchClient;
19
15
  get account(): AccountClient;
20
- get indexing(): IndexingClient;
16
+ /**
17
+ * Find brands.
18
+ * Search semantically with `query`, or look them up by name, id, or
19
+ * social handle. Either way, you can also narrow the results with
20
+ * filters such as product taxonomy, location, and follower count.
21
+ *
22
+ * Send one search field. Each field is its own mode:
23
+ *
24
+ * - **Query** (`query`). A natural-language brief. Runs a language model and
25
+ * ranks by relevance, so `sortBy` is ignored. Bills at least one row even
26
+ * when nothing matches.
27
+ * - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
28
+ * match). Pass every name in one array.
29
+ * - **ID** (`brandIds`). Looks up known ids. Missing ids are omitted and listed
30
+ * in `unmatchedIds`. `limit` and `offset` are ignored.
31
+ * - **Instagram** (`igUsername`). Case-insensitive contains match on the
32
+ * handle. A leading `@` is ignored.
33
+ * - **TikTok** (`tiktokUsername`). Same match on the TikTok handle.
34
+ *
35
+ * If a request includes more than one of these fields, only the highest
36
+ * priority field is used. The rest are ignored:
37
+ *
38
+ * 1. `brandIds`
39
+ * 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
40
+ * 3. `names`
41
+ * 4. `query`
42
+ *
43
+ * One exception: `query` together with `names` uses both. `names` narrows the
44
+ * set, and `query` ranks inside it.
45
+ *
46
+ * `limit` (default 20, max 100) caps the rows returned, and the cost, for
47
+ * every mode except ID.
48
+ *
49
+ * Limited to 120 requests per minute per user.
50
+ * Costs 2,000 microdollars ($0.0020) per brand returned, charged against your plan's monthly credits. The count field is what you were charged for.
51
+ * A `query` search runs a language model, so it bills a minimum of one
52
+ * row even when nothing matches.
53
+ *
54
+ * @param {spyglass.SearchBrandsRequest} request
55
+ * @param {Spyglass.RequestOptions} requestOptions - Request-specific configuration.
56
+ *
57
+ * @throws {@link spyglass.BadRequestError}
58
+ * @throws {@link spyglass.UnauthorizedError}
59
+ * @throws {@link spyglass.PaymentRequiredError}
60
+ * @throws {@link spyglass.ForbiddenError}
61
+ * @throws {@link spyglass.MethodNotAllowedError}
62
+ * @throws {@link spyglass.ContentTooLargeError}
63
+ * @throws {@link spyglass.TooManyRequestsError}
64
+ * @throws {@link spyglass.InternalServerError}
65
+ * @throws {@link errors.SpyglassError}
66
+ * @throws {@link errors.SpyglassTimeoutError}
67
+ *
68
+ * @example
69
+ * await client.searchBrands({
70
+ * names: ["Nike"],
71
+ * limit: 3
72
+ * })
73
+ */
74
+ searchBrands(request?: spyglass.SearchBrandsRequest, requestOptions?: Spyglass.RequestOptions): core.HttpResponsePromise<spyglass.SearchBrandsResponse>;
75
+ private __searchBrands;
76
+ /**
77
+ * Find creators.
78
+ * Search semantically with `query`, or look them up by name, id, or
79
+ * social handle. Either way, you can also narrow the results with
80
+ * filters such as audience profile, location, and follower count.
81
+ *
82
+ * Send one search field. Each field is its own mode:
83
+ *
84
+ * - **Query** (`query`). A natural-language brief. Runs a language model and
85
+ * ranks by relevance, so `sortBy` is ignored. Bills at least one row even
86
+ * when nothing matches.
87
+ * - **Name** (`names`). Fuzzy-matches account names (a case-insensitive contains
88
+ * match). Pass every name in one array.
89
+ * - **ID** (`brandIds`). Looks up known ids. Missing ids are omitted and listed
90
+ * in `unmatchedIds`. `limit` and `offset` are ignored.
91
+ * - **Instagram** (`igUsername`). Case-insensitive contains match on the
92
+ * handle. A leading `@` is ignored.
93
+ * - **TikTok** (`tiktokUsername`). Same match on the TikTok handle.
94
+ *
95
+ * If a request includes more than one of these fields, only the highest
96
+ * priority field is used. The rest are ignored:
97
+ *
98
+ * 1. `brandIds`
99
+ * 2. `igUsername` or `tiktokUsername` (if both are set, either handle can match)
100
+ * 3. `names`
101
+ * 4. `query`
102
+ *
103
+ * One exception: `query` together with `names` uses both. `names` narrows the
104
+ * set, and `query` ranks inside it.
105
+ *
106
+ * `limit` (default 20, max 100) caps the rows returned, and the cost, for
107
+ * every mode except ID.
108
+ *
109
+ * Limited to 120 requests per minute per user.
110
+ * Costs 2,000 microdollars ($0.0020) per creator returned, charged against your plan's monthly credits. The count field is what you were charged for.
111
+ * A `query` search runs a language model, so it bills a minimum of one
112
+ * row even when nothing matches.
113
+ *
114
+ * @param {spyglass.SearchCreatorsRequest} request
115
+ * @param {Spyglass.RequestOptions} requestOptions - Request-specific configuration.
116
+ *
117
+ * @throws {@link spyglass.BadRequestError}
118
+ * @throws {@link spyglass.UnauthorizedError}
119
+ * @throws {@link spyglass.PaymentRequiredError}
120
+ * @throws {@link spyglass.ForbiddenError}
121
+ * @throws {@link spyglass.MethodNotAllowedError}
122
+ * @throws {@link spyglass.ContentTooLargeError}
123
+ * @throws {@link spyglass.TooManyRequestsError}
124
+ * @throws {@link spyglass.InternalServerError}
125
+ * @throws {@link errors.SpyglassError}
126
+ * @throws {@link errors.SpyglassTimeoutError}
127
+ *
128
+ * @example
129
+ * await client.searchCreators({
130
+ * igUsername: "charlidamelio",
131
+ * limit: 3,
132
+ * gender: "female"
133
+ * })
134
+ */
135
+ searchCreators(request?: spyglass.SearchCreatorsRequest, requestOptions?: Spyglass.RequestOptions): core.HttpResponsePromise<spyglass.SearchCreatorsResponse>;
136
+ private __searchCreators;
137
+ /**
138
+ * Find taxonomy paths you can pass to POST /media as `taxonomy`.
139
+ * `query` is a product or category phrase. Each path is a string
140
+ * such as `Apparel > Footwear > Sneakers`.
141
+ *
142
+ * Limited to 120 requests per minute per user.
143
+ * This call is free and does not use credits.
144
+ *
145
+ * @param {spyglass.SearchTaxonomiesRequest} request
146
+ * @param {Spyglass.RequestOptions} requestOptions - Request-specific configuration.
147
+ *
148
+ * @throws {@link spyglass.BadRequestError}
149
+ * @throws {@link spyglass.UnauthorizedError}
150
+ * @throws {@link spyglass.PaymentRequiredError}
151
+ * @throws {@link spyglass.ForbiddenError}
152
+ * @throws {@link spyglass.MethodNotAllowedError}
153
+ * @throws {@link spyglass.TooManyRequestsError}
154
+ * @throws {@link spyglass.InternalServerError}
155
+ * @throws {@link errors.SpyglassError}
156
+ * @throws {@link errors.SpyglassTimeoutError}
157
+ *
158
+ * @example
159
+ * await client.searchTaxonomies({
160
+ * query: "running shoes"
161
+ * })
162
+ */
163
+ searchTaxonomies(request: spyglass.SearchTaxonomiesRequest, requestOptions?: Spyglass.RequestOptions): core.HttpResponsePromise<spyglass.SearchTaxonomiesResponse>;
164
+ private __searchTaxonomies;
165
+ /**
166
+ * Return creatives. Pass `brandId` to scope to one brand or creator,
167
+ * or omit it to search the whole corpus. Without `brandId`,
168
+ * `query` is required.
169
+ *
170
+ * Limited to 120 requests per minute per user.
171
+ * Costs 1,000 microdollars ($0.0010) per creative returned, charged against your plan's monthly credits. The count field is what you were charged for.
172
+ * The call bills a minimum of one row even when nothing matches. In that
173
+ * case `count` is 0 but you are charged for one row.
174
+ *
175
+ * @param {spyglass.SearchMediaRequest} request
176
+ * @param {Spyglass.RequestOptions} requestOptions - Request-specific configuration.
177
+ *
178
+ * @throws {@link spyglass.BadRequestError}
179
+ * @throws {@link spyglass.UnauthorizedError}
180
+ * @throws {@link spyglass.PaymentRequiredError}
181
+ * @throws {@link spyglass.ForbiddenError}
182
+ * @throws {@link spyglass.NotFoundError}
183
+ * @throws {@link spyglass.MethodNotAllowedError}
184
+ * @throws {@link spyglass.ContentTooLargeError}
185
+ * @throws {@link spyglass.TooManyRequestsError}
186
+ * @throws {@link spyglass.InternalServerError}
187
+ * @throws {@link errors.SpyglassError}
188
+ * @throws {@link errors.SpyglassTimeoutError}
189
+ *
190
+ * @example
191
+ * await client.searchMedia({
192
+ * query: "comfort-focused video ads",
193
+ * limit: 20
194
+ * })
195
+ */
196
+ searchMedia(request?: spyglass.SearchMediaRequest, requestOptions?: Spyglass.RequestOptions): core.HttpResponsePromise<spyglass.SearchMediaResponse>;
197
+ private __searchMedia;
198
+ /**
199
+ * Credits left on the API key's team, the credits included in the
200
+ * plan, and the current billing period. Granted credits count toward
201
+ * `remainingCredits` and not `planCredits`.
202
+ *
203
+ * Limited to 120 requests per minute per user.
204
+ * This call is free and does not use credits. It still responds when
205
+ * the team is out of credits.
206
+ *
207
+ * @param {Spyglass.RequestOptions} requestOptions - Request-specific configuration.
208
+ *
209
+ * @throws {@link spyglass.BadRequestError}
210
+ * @throws {@link spyglass.UnauthorizedError}
211
+ * @throws {@link spyglass.PaymentRequiredError}
212
+ * @throws {@link spyglass.ForbiddenError}
213
+ * @throws {@link spyglass.MethodNotAllowedError}
214
+ * @throws {@link spyglass.TooManyRequestsError}
215
+ * @throws {@link spyglass.InternalServerError}
216
+ * @throws {@link errors.SpyglassError}
217
+ * @throws {@link errors.SpyglassTimeoutError}
218
+ *
219
+ * @example
220
+ * await client.getCreditUsage()
221
+ */
222
+ getCreditUsage(requestOptions?: Spyglass.RequestOptions): core.HttpResponsePromise<spyglass.GetCreditUsageResponse>;
223
+ private __getCreditUsage;
224
+ /**
225
+ * Return public comments for specific Instagram or TikTok posts.
226
+ * Pass post URLs or the platform id. At least one of `instagramIds` or
227
+ * `tiktokIds` is required (max 20 each). `limit` is comment pages
228
+ * per post (default 1, max 20).
229
+ *
230
+ * Instagram accepts a shortcode or a post URL:
231
+ *
232
+ * - `C2xY9abcD1e`
233
+ * - `https://www.instagram.com/p/C2xY9abcD1e/`
234
+ * - `https://www.instagram.com/reel/C2xY9abcD1e/`
235
+ *
236
+ * TikTok accepts a video id or a post URL:
237
+ *
238
+ * - `7234567890123456789`
239
+ * - `https://www.tiktok.com/@nike/video/7234567890123456789`
240
+ *
241
+ * Recent posts may be scraped live; older posts with stored comments
242
+ * are served from cache.
243
+ *
244
+ * Limited to 20 requests per minute per user.
245
+ * Costs 10,000 microdollars ($0.0100) per successful page of comments returned, charged against your plan's monthly credits.
246
+ * Each comment page fetched live (`limit`, default 1) is one billed
247
+ * unit. Cached posts do not scrape and are not billed.
248
+ *
249
+ * @param {spyglass.GetCommentsRequest} request
250
+ * @param {Spyglass.RequestOptions} requestOptions - Request-specific configuration.
251
+ *
252
+ * @throws {@link spyglass.BadRequestError}
253
+ * @throws {@link spyglass.UnauthorizedError}
254
+ * @throws {@link spyglass.PaymentRequiredError}
255
+ * @throws {@link spyglass.ForbiddenError}
256
+ * @throws {@link spyglass.MethodNotAllowedError}
257
+ * @throws {@link spyglass.ContentTooLargeError}
258
+ * @throws {@link spyglass.TooManyRequestsError}
259
+ * @throws {@link spyglass.InternalServerError}
260
+ * @throws {@link errors.SpyglassError}
261
+ * @throws {@link errors.SpyglassTimeoutError}
262
+ *
263
+ * @example
264
+ * await client.getComments({
265
+ * instagramIds: ["https://www.instagram.com/p/C2xY9abcD1e/"],
266
+ * tiktokIds: ["https://www.tiktok.com/@nike/video/7234567890123456789"],
267
+ * limit: 1
268
+ * })
269
+ */
270
+ getComments(request?: spyglass.GetCommentsRequest, requestOptions?: Spyglass.RequestOptions): core.HttpResponsePromise<spyglass.GetCommentsResponse>;
271
+ private __getComments;
21
272
  /**
22
273
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
23
274
  * This is useful for making requests to endpoints not yet supported in the SDK.