@spyglasshq/sdk 0.0.0-stage → 0.1.0

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 (440) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -2
  3. package/dist/cjs/BaseClient.d.ts +54 -0
  4. package/dist/cjs/BaseClient.js +77 -0
  5. package/dist/cjs/Client.d.ts +32 -0
  6. package/dist/cjs/Client.js +93 -0
  7. package/dist/cjs/api/errors/BadRequestError.d.ts +7 -0
  8. package/dist/cjs/api/errors/BadRequestError.js +54 -0
  9. package/dist/cjs/api/errors/ContentTooLargeError.d.ts +7 -0
  10. package/dist/cjs/api/errors/ContentTooLargeError.js +54 -0
  11. package/dist/cjs/api/errors/ForbiddenError.d.ts +7 -0
  12. package/dist/cjs/api/errors/ForbiddenError.js +54 -0
  13. package/dist/cjs/api/errors/InternalServerError.d.ts +7 -0
  14. package/dist/cjs/api/errors/InternalServerError.js +54 -0
  15. package/dist/cjs/api/errors/MethodNotAllowedError.d.ts +7 -0
  16. package/dist/cjs/api/errors/MethodNotAllowedError.js +54 -0
  17. package/dist/cjs/api/errors/NotFoundError.d.ts +7 -0
  18. package/dist/cjs/api/errors/NotFoundError.js +54 -0
  19. package/dist/cjs/api/errors/PaymentRequiredError.d.ts +7 -0
  20. package/dist/cjs/api/errors/PaymentRequiredError.js +54 -0
  21. package/dist/cjs/api/errors/TooManyRequestsError.d.ts +7 -0
  22. package/dist/cjs/api/errors/TooManyRequestsError.js +54 -0
  23. package/dist/cjs/api/errors/UnauthorizedError.d.ts +7 -0
  24. package/dist/cjs/api/errors/UnauthorizedError.js +54 -0
  25. package/dist/cjs/api/errors/index.d.ts +9 -0
  26. package/dist/cjs/api/errors/index.js +25 -0
  27. package/dist/cjs/api/index.d.ts +3 -0
  28. package/dist/cjs/api/index.js +19 -0
  29. package/dist/cjs/api/resources/account/client/Client.d.ts +42 -0
  30. package/dist/cjs/api/resources/account/client/Client.js +135 -0
  31. package/dist/cjs/api/resources/account/client/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/account/client/index.js +2 -0
  33. package/dist/cjs/api/resources/account/exports.d.ts +2 -0
  34. package/dist/cjs/api/resources/account/exports.js +21 -0
  35. package/dist/cjs/api/resources/account/index.d.ts +2 -0
  36. package/dist/cjs/api/resources/account/index.js +18 -0
  37. package/dist/cjs/api/resources/account/types/GetCreditUsageResponse.d.ts +10 -0
  38. package/dist/cjs/api/resources/account/types/GetCreditUsageResponse.js +3 -0
  39. package/dist/cjs/api/resources/account/types/index.d.ts +1 -0
  40. package/dist/cjs/api/resources/account/types/index.js +17 -0
  41. package/dist/cjs/api/resources/index.d.ts +8 -0
  42. package/dist/cjs/api/resources/index.js +47 -0
  43. package/dist/cjs/api/resources/indexing/client/Client.d.ts +74 -0
  44. package/dist/cjs/api/resources/indexing/client/Client.js +219 -0
  45. package/dist/cjs/api/resources/indexing/client/index.d.ts +1 -0
  46. package/dist/cjs/api/resources/indexing/client/index.js +17 -0
  47. package/dist/cjs/api/resources/indexing/client/requests/IndexBrandRequest.d.ts +9 -0
  48. package/dist/cjs/api/resources/indexing/client/requests/IndexBrandRequest.js +3 -0
  49. package/dist/cjs/api/resources/indexing/client/requests/IndexBrandStatusRequest.d.ts +10 -0
  50. package/dist/cjs/api/resources/indexing/client/requests/IndexBrandStatusRequest.js +3 -0
  51. package/dist/cjs/api/resources/indexing/client/requests/index.d.ts +2 -0
  52. package/dist/cjs/api/resources/indexing/client/requests/index.js +2 -0
  53. package/dist/cjs/api/resources/indexing/exports.d.ts +2 -0
  54. package/dist/cjs/api/resources/indexing/exports.js +21 -0
  55. package/dist/cjs/api/resources/indexing/index.d.ts +2 -0
  56. package/dist/cjs/api/resources/indexing/index.js +18 -0
  57. package/dist/cjs/api/resources/indexing/types/IndexBrandResponse.d.ts +11 -0
  58. package/dist/cjs/api/resources/indexing/types/IndexBrandResponse.js +11 -0
  59. package/dist/cjs/api/resources/indexing/types/IndexBrandStatusResponse.d.ts +10 -0
  60. package/dist/cjs/api/resources/indexing/types/IndexBrandStatusResponse.js +11 -0
  61. package/dist/cjs/api/resources/indexing/types/index.d.ts +2 -0
  62. package/dist/cjs/api/resources/indexing/types/index.js +18 -0
  63. package/dist/cjs/api/resources/search/client/Client.d.ts +333 -0
  64. package/dist/cjs/api/resources/search/client/Client.js +819 -0
  65. package/dist/cjs/api/resources/search/client/index.d.ts +1 -0
  66. package/dist/cjs/api/resources/search/client/index.js +17 -0
  67. package/dist/cjs/api/resources/search/client/requests/GetAccountRequest.d.ts +10 -0
  68. package/dist/cjs/api/resources/search/client/requests/GetAccountRequest.js +3 -0
  69. package/dist/cjs/api/resources/search/client/requests/GetBrandLandingPagesRequest.d.ts +13 -0
  70. package/dist/cjs/api/resources/search/client/requests/GetBrandLandingPagesRequest.js +3 -0
  71. package/dist/cjs/api/resources/search/client/requests/GetBrandMediaInsightsRequest.d.ts +15 -0
  72. package/dist/cjs/api/resources/search/client/requests/GetBrandMediaInsightsRequest.js +3 -0
  73. package/dist/cjs/api/resources/search/client/requests/GetCommentsRequest.d.ts +16 -0
  74. package/dist/cjs/api/resources/search/client/requests/GetCommentsRequest.js +3 -0
  75. package/dist/cjs/api/resources/search/client/requests/GetMediaV2Request.d.ts +313 -0
  76. package/dist/cjs/api/resources/search/client/requests/GetMediaV2Request.js +268 -0
  77. package/dist/cjs/api/resources/search/client/requests/SearchBrandsV2Request.d.ts +39 -0
  78. package/dist/cjs/api/resources/search/client/requests/SearchBrandsV2Request.js +15 -0
  79. package/dist/cjs/api/resources/search/client/requests/SearchCreatorsRequest.d.ts +223 -0
  80. package/dist/cjs/api/resources/search/client/requests/SearchCreatorsRequest.js +191 -0
  81. package/dist/cjs/api/resources/search/client/requests/SearchTaxonomiesRequest.d.ts +10 -0
  82. package/dist/cjs/api/resources/search/client/requests/SearchTaxonomiesRequest.js +3 -0
  83. package/dist/cjs/api/resources/search/client/requests/index.d.ts +8 -0
  84. package/dist/cjs/api/resources/search/client/requests/index.js +9 -0
  85. package/dist/cjs/api/resources/search/exports.d.ts +2 -0
  86. package/dist/cjs/api/resources/search/exports.js +21 -0
  87. package/dist/cjs/api/resources/search/index.d.ts +2 -0
  88. package/dist/cjs/api/resources/search/index.js +18 -0
  89. package/dist/cjs/api/resources/search/types/GetAccountResponse.d.ts +43 -0
  90. package/dist/cjs/api/resources/search/types/GetAccountResponse.js +3 -0
  91. package/dist/cjs/api/resources/search/types/GetBrandLandingPagesRequestShowInactive.d.ts +5 -0
  92. package/dist/cjs/api/resources/search/types/GetBrandLandingPagesRequestShowInactive.js +8 -0
  93. package/dist/cjs/api/resources/search/types/GetBrandLandingPagesResponse.d.ts +13 -0
  94. package/dist/cjs/api/resources/search/types/GetBrandLandingPagesResponse.js +3 -0
  95. package/dist/cjs/api/resources/search/types/GetBrandMediaInsightsRequestType.d.ts +7 -0
  96. package/dist/cjs/api/resources/search/types/GetBrandMediaInsightsRequestType.js +10 -0
  97. package/dist/cjs/api/resources/search/types/GetBrandMediaInsightsResponse.d.ts +27 -0
  98. package/dist/cjs/api/resources/search/types/GetBrandMediaInsightsResponse.js +3 -0
  99. package/dist/cjs/api/resources/search/types/GetCommentsResponse.d.ts +31 -0
  100. package/dist/cjs/api/resources/search/types/GetCommentsResponse.js +3 -0
  101. package/dist/cjs/api/resources/search/types/GetMediaV2Response.d.ts +110 -0
  102. package/dist/cjs/api/resources/search/types/GetMediaV2Response.js +57 -0
  103. package/dist/cjs/api/resources/search/types/SearchBrandsV2Response.d.ts +35 -0
  104. package/dist/cjs/api/resources/search/types/SearchBrandsV2Response.js +16 -0
  105. package/dist/cjs/api/resources/search/types/SearchCreatorsResponse.d.ts +36 -0
  106. package/dist/cjs/api/resources/search/types/SearchCreatorsResponse.js +16 -0
  107. package/dist/cjs/api/resources/search/types/SearchTaxonomiesResponse.d.ts +4 -0
  108. package/dist/cjs/api/resources/search/types/SearchTaxonomiesResponse.js +3 -0
  109. package/dist/cjs/api/resources/search/types/index.d.ts +10 -0
  110. package/dist/cjs/api/resources/search/types/index.js +26 -0
  111. package/dist/cjs/api/types/Error_.d.ts +33 -0
  112. package/dist/cjs/api/types/Error_.js +23 -0
  113. package/dist/cjs/api/types/index.d.ts +1 -0
  114. package/dist/cjs/api/types/index.js +17 -0
  115. package/dist/cjs/auth/BearerAuthProvider.d.ts +20 -0
  116. package/dist/cjs/auth/BearerAuthProvider.js +79 -0
  117. package/dist/cjs/auth/index.d.ts +1 -0
  118. package/dist/cjs/auth/index.js +5 -0
  119. package/dist/cjs/core/auth/AuthProvider.d.ts +8 -0
  120. package/dist/cjs/core/auth/AuthProvider.js +9 -0
  121. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  122. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  123. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  124. package/dist/cjs/core/auth/BasicAuth.js +33 -0
  125. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  126. package/dist/cjs/core/auth/BearerToken.js +16 -0
  127. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  128. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  129. package/dist/cjs/core/auth/index.d.ts +5 -0
  130. package/dist/cjs/core/auth/index.js +11 -0
  131. package/dist/cjs/core/base64.d.ts +2 -0
  132. package/dist/cjs/core/base64.js +26 -0
  133. package/dist/cjs/core/exports.d.ts +1 -0
  134. package/dist/cjs/core/exports.js +17 -0
  135. package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
  136. package/dist/cjs/core/fetcher/APIResponse.js +2 -0
  137. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
  138. package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
  139. package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
  140. package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
  141. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
  142. package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
  143. package/dist/cjs/core/fetcher/Fetcher.d.ts +56 -0
  144. package/dist/cjs/core/fetcher/Fetcher.js +274 -0
  145. package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
  146. package/dist/cjs/core/fetcher/Headers.js +84 -0
  147. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
  148. package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
  149. package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
  150. package/dist/cjs/core/fetcher/RawResponse.js +44 -0
  151. package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
  152. package/dist/cjs/core/fetcher/Supplier.js +22 -0
  153. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
  154. package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
  155. package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
  156. package/dist/cjs/core/fetcher/getErrorResponseBody.js +58 -0
  157. package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
  158. package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
  159. package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
  160. package/dist/cjs/core/fetcher/getHeader.js +11 -0
  161. package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
  162. package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
  163. package/dist/cjs/core/fetcher/getResponseBody.d.ts +17 -0
  164. package/dist/cjs/core/fetcher/getResponseBody.js +85 -0
  165. package/dist/cjs/core/fetcher/index.d.ts +13 -0
  166. package/dist/cjs/core/fetcher/index.js +19 -0
  167. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  168. package/dist/cjs/core/fetcher/makePassthroughRequest.js +173 -0
  169. package/dist/cjs/core/fetcher/makeRequest.d.ts +11 -0
  170. package/dist/cjs/core/fetcher/makeRequest.js +94 -0
  171. package/dist/cjs/core/fetcher/redactUrl.d.ts +2 -0
  172. package/dist/cjs/core/fetcher/redactUrl.js +88 -0
  173. package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
  174. package/dist/cjs/core/fetcher/requestWithRetries.js +91 -0
  175. package/dist/cjs/core/fetcher/signals.d.ts +6 -0
  176. package/dist/cjs/core/fetcher/signals.js +33 -0
  177. package/dist/cjs/core/headers.d.ts +2 -0
  178. package/dist/cjs/core/headers.js +31 -0
  179. package/dist/cjs/core/index.d.ts +6 -0
  180. package/dist/cjs/core/index.js +45 -0
  181. package/dist/cjs/core/json.d.ts +15 -0
  182. package/dist/cjs/core/json.js +24 -0
  183. package/dist/cjs/core/logging/exports.d.ts +18 -0
  184. package/dist/cjs/core/logging/exports.js +45 -0
  185. package/dist/cjs/core/logging/index.d.ts +1 -0
  186. package/dist/cjs/core/logging/index.js +17 -0
  187. package/dist/cjs/core/logging/logger.d.ts +126 -0
  188. package/dist/cjs/core/logging/logger.js +144 -0
  189. package/dist/cjs/core/requestBody.d.ts +12 -0
  190. package/dist/cjs/core/requestBody.js +26 -0
  191. package/dist/cjs/core/runtime/index.d.ts +1 -0
  192. package/dist/cjs/core/runtime/index.js +6 -0
  193. package/dist/cjs/core/runtime/runtime.d.ts +28 -0
  194. package/dist/cjs/core/runtime/runtime.js +176 -0
  195. package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
  196. package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
  197. package/dist/cjs/core/url/encodePathParam.d.ts +3 -0
  198. package/dist/cjs/core/url/encodePathParam.js +27 -0
  199. package/dist/cjs/core/url/index.d.ts +4 -0
  200. package/dist/cjs/core/url/index.js +11 -0
  201. package/dist/cjs/core/url/join.d.ts +1 -0
  202. package/dist/cjs/core/url/join.js +68 -0
  203. package/dist/cjs/core/url/qs.d.ts +7 -0
  204. package/dist/cjs/core/url/qs.js +76 -0
  205. package/dist/cjs/environments.d.ts +4 -0
  206. package/dist/cjs/environments.js +7 -0
  207. package/dist/cjs/errors/SpyglassError.d.ts +15 -0
  208. package/dist/cjs/errors/SpyglassError.js +53 -0
  209. package/dist/cjs/errors/SpyglassTimeoutError.d.ts +6 -0
  210. package/dist/cjs/errors/SpyglassTimeoutError.js +52 -0
  211. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  212. package/dist/cjs/errors/handleNonStatusCodeError.js +68 -0
  213. package/dist/cjs/errors/index.d.ts +2 -0
  214. package/dist/cjs/errors/index.js +7 -0
  215. package/dist/cjs/exports.d.ts +1 -0
  216. package/dist/cjs/exports.js +17 -0
  217. package/dist/cjs/index.d.ts +6 -0
  218. package/dist/cjs/index.js +48 -0
  219. package/dist/cjs/version.d.ts +1 -0
  220. package/dist/cjs/version.js +4 -0
  221. package/dist/esm/BaseClient.d.mts +54 -0
  222. package/dist/esm/BaseClient.mjs +40 -0
  223. package/dist/esm/Client.d.mts +32 -0
  224. package/dist/esm/Client.mjs +56 -0
  225. package/dist/esm/api/errors/BadRequestError.d.mts +7 -0
  226. package/dist/esm/api/errors/BadRequestError.mjs +17 -0
  227. package/dist/esm/api/errors/ContentTooLargeError.d.mts +7 -0
  228. package/dist/esm/api/errors/ContentTooLargeError.mjs +17 -0
  229. package/dist/esm/api/errors/ForbiddenError.d.mts +7 -0
  230. package/dist/esm/api/errors/ForbiddenError.mjs +17 -0
  231. package/dist/esm/api/errors/InternalServerError.d.mts +7 -0
  232. package/dist/esm/api/errors/InternalServerError.mjs +17 -0
  233. package/dist/esm/api/errors/MethodNotAllowedError.d.mts +7 -0
  234. package/dist/esm/api/errors/MethodNotAllowedError.mjs +17 -0
  235. package/dist/esm/api/errors/NotFoundError.d.mts +7 -0
  236. package/dist/esm/api/errors/NotFoundError.mjs +17 -0
  237. package/dist/esm/api/errors/PaymentRequiredError.d.mts +7 -0
  238. package/dist/esm/api/errors/PaymentRequiredError.mjs +17 -0
  239. package/dist/esm/api/errors/TooManyRequestsError.d.mts +7 -0
  240. package/dist/esm/api/errors/TooManyRequestsError.mjs +17 -0
  241. package/dist/esm/api/errors/UnauthorizedError.d.mts +7 -0
  242. package/dist/esm/api/errors/UnauthorizedError.mjs +17 -0
  243. package/dist/esm/api/errors/index.d.mts +9 -0
  244. package/dist/esm/api/errors/index.mjs +9 -0
  245. package/dist/esm/api/index.d.mts +3 -0
  246. package/dist/esm/api/index.mjs +3 -0
  247. package/dist/esm/api/resources/account/client/Client.d.mts +42 -0
  248. package/dist/esm/api/resources/account/client/Client.mjs +98 -0
  249. package/dist/esm/api/resources/account/client/index.d.mts +1 -0
  250. package/dist/esm/api/resources/account/client/index.mjs +1 -0
  251. package/dist/esm/api/resources/account/exports.d.mts +2 -0
  252. package/dist/esm/api/resources/account/exports.mjs +3 -0
  253. package/dist/esm/api/resources/account/index.d.mts +2 -0
  254. package/dist/esm/api/resources/account/index.mjs +2 -0
  255. package/dist/esm/api/resources/account/types/GetCreditUsageResponse.d.mts +10 -0
  256. package/dist/esm/api/resources/account/types/GetCreditUsageResponse.mjs +2 -0
  257. package/dist/esm/api/resources/account/types/index.d.mts +1 -0
  258. package/dist/esm/api/resources/account/types/index.mjs +1 -0
  259. package/dist/esm/api/resources/index.d.mts +8 -0
  260. package/dist/esm/api/resources/index.mjs +8 -0
  261. package/dist/esm/api/resources/indexing/client/Client.d.mts +74 -0
  262. package/dist/esm/api/resources/indexing/client/Client.mjs +182 -0
  263. package/dist/esm/api/resources/indexing/client/index.d.mts +1 -0
  264. package/dist/esm/api/resources/indexing/client/index.mjs +1 -0
  265. package/dist/esm/api/resources/indexing/client/requests/IndexBrandRequest.d.mts +9 -0
  266. package/dist/esm/api/resources/indexing/client/requests/IndexBrandRequest.mjs +2 -0
  267. package/dist/esm/api/resources/indexing/client/requests/IndexBrandStatusRequest.d.mts +10 -0
  268. package/dist/esm/api/resources/indexing/client/requests/IndexBrandStatusRequest.mjs +2 -0
  269. package/dist/esm/api/resources/indexing/client/requests/index.d.mts +2 -0
  270. package/dist/esm/api/resources/indexing/client/requests/index.mjs +1 -0
  271. package/dist/esm/api/resources/indexing/exports.d.mts +2 -0
  272. package/dist/esm/api/resources/indexing/exports.mjs +3 -0
  273. package/dist/esm/api/resources/indexing/index.d.mts +2 -0
  274. package/dist/esm/api/resources/indexing/index.mjs +2 -0
  275. package/dist/esm/api/resources/indexing/types/IndexBrandResponse.d.mts +11 -0
  276. package/dist/esm/api/resources/indexing/types/IndexBrandResponse.mjs +8 -0
  277. package/dist/esm/api/resources/indexing/types/IndexBrandStatusResponse.d.mts +10 -0
  278. package/dist/esm/api/resources/indexing/types/IndexBrandStatusResponse.mjs +8 -0
  279. package/dist/esm/api/resources/indexing/types/index.d.mts +2 -0
  280. package/dist/esm/api/resources/indexing/types/index.mjs +2 -0
  281. package/dist/esm/api/resources/search/client/Client.d.mts +333 -0
  282. package/dist/esm/api/resources/search/client/Client.mjs +782 -0
  283. package/dist/esm/api/resources/search/client/index.d.mts +1 -0
  284. package/dist/esm/api/resources/search/client/index.mjs +1 -0
  285. package/dist/esm/api/resources/search/client/requests/GetAccountRequest.d.mts +10 -0
  286. package/dist/esm/api/resources/search/client/requests/GetAccountRequest.mjs +2 -0
  287. package/dist/esm/api/resources/search/client/requests/GetBrandLandingPagesRequest.d.mts +13 -0
  288. package/dist/esm/api/resources/search/client/requests/GetBrandLandingPagesRequest.mjs +2 -0
  289. package/dist/esm/api/resources/search/client/requests/GetBrandMediaInsightsRequest.d.mts +15 -0
  290. package/dist/esm/api/resources/search/client/requests/GetBrandMediaInsightsRequest.mjs +2 -0
  291. package/dist/esm/api/resources/search/client/requests/GetCommentsRequest.d.mts +16 -0
  292. package/dist/esm/api/resources/search/client/requests/GetCommentsRequest.mjs +2 -0
  293. package/dist/esm/api/resources/search/client/requests/GetMediaV2Request.d.mts +313 -0
  294. package/dist/esm/api/resources/search/client/requests/GetMediaV2Request.mjs +265 -0
  295. package/dist/esm/api/resources/search/client/requests/SearchBrandsV2Request.d.mts +39 -0
  296. package/dist/esm/api/resources/search/client/requests/SearchBrandsV2Request.mjs +12 -0
  297. package/dist/esm/api/resources/search/client/requests/SearchCreatorsRequest.d.mts +223 -0
  298. package/dist/esm/api/resources/search/client/requests/SearchCreatorsRequest.mjs +188 -0
  299. package/dist/esm/api/resources/search/client/requests/SearchTaxonomiesRequest.d.mts +10 -0
  300. package/dist/esm/api/resources/search/client/requests/SearchTaxonomiesRequest.mjs +2 -0
  301. package/dist/esm/api/resources/search/client/requests/index.d.mts +8 -0
  302. package/dist/esm/api/resources/search/client/requests/index.mjs +3 -0
  303. package/dist/esm/api/resources/search/exports.d.mts +2 -0
  304. package/dist/esm/api/resources/search/exports.mjs +3 -0
  305. package/dist/esm/api/resources/search/index.d.mts +2 -0
  306. package/dist/esm/api/resources/search/index.mjs +2 -0
  307. package/dist/esm/api/resources/search/types/GetAccountResponse.d.mts +43 -0
  308. package/dist/esm/api/resources/search/types/GetAccountResponse.mjs +2 -0
  309. package/dist/esm/api/resources/search/types/GetBrandLandingPagesRequestShowInactive.d.mts +5 -0
  310. package/dist/esm/api/resources/search/types/GetBrandLandingPagesRequestShowInactive.mjs +5 -0
  311. package/dist/esm/api/resources/search/types/GetBrandLandingPagesResponse.d.mts +13 -0
  312. package/dist/esm/api/resources/search/types/GetBrandLandingPagesResponse.mjs +2 -0
  313. package/dist/esm/api/resources/search/types/GetBrandMediaInsightsRequestType.d.mts +7 -0
  314. package/dist/esm/api/resources/search/types/GetBrandMediaInsightsRequestType.mjs +7 -0
  315. package/dist/esm/api/resources/search/types/GetBrandMediaInsightsResponse.d.mts +27 -0
  316. package/dist/esm/api/resources/search/types/GetBrandMediaInsightsResponse.mjs +2 -0
  317. package/dist/esm/api/resources/search/types/GetCommentsResponse.d.mts +31 -0
  318. package/dist/esm/api/resources/search/types/GetCommentsResponse.mjs +2 -0
  319. package/dist/esm/api/resources/search/types/GetMediaV2Response.d.mts +110 -0
  320. package/dist/esm/api/resources/search/types/GetMediaV2Response.mjs +54 -0
  321. package/dist/esm/api/resources/search/types/SearchBrandsV2Response.d.mts +35 -0
  322. package/dist/esm/api/resources/search/types/SearchBrandsV2Response.mjs +13 -0
  323. package/dist/esm/api/resources/search/types/SearchCreatorsResponse.d.mts +36 -0
  324. package/dist/esm/api/resources/search/types/SearchCreatorsResponse.mjs +13 -0
  325. package/dist/esm/api/resources/search/types/SearchTaxonomiesResponse.d.mts +4 -0
  326. package/dist/esm/api/resources/search/types/SearchTaxonomiesResponse.mjs +2 -0
  327. package/dist/esm/api/resources/search/types/index.d.mts +10 -0
  328. package/dist/esm/api/resources/search/types/index.mjs +10 -0
  329. package/dist/esm/api/types/Error_.d.mts +33 -0
  330. package/dist/esm/api/types/Error_.mjs +20 -0
  331. package/dist/esm/api/types/index.d.mts +1 -0
  332. package/dist/esm/api/types/index.mjs +1 -0
  333. package/dist/esm/auth/BearerAuthProvider.d.mts +20 -0
  334. package/dist/esm/auth/BearerAuthProvider.mjs +42 -0
  335. package/dist/esm/auth/index.d.mts +1 -0
  336. package/dist/esm/auth/index.mjs +1 -0
  337. package/dist/esm/core/auth/AuthProvider.d.mts +8 -0
  338. package/dist/esm/core/auth/AuthProvider.mjs +6 -0
  339. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  340. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  341. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  342. package/dist/esm/core/auth/BasicAuth.mjs +30 -0
  343. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  344. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  345. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  346. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  347. package/dist/esm/core/auth/index.d.mts +5 -0
  348. package/dist/esm/core/auth/index.mjs +4 -0
  349. package/dist/esm/core/base64.d.mts +2 -0
  350. package/dist/esm/core/base64.mjs +22 -0
  351. package/dist/esm/core/exports.d.mts +1 -0
  352. package/dist/esm/core/exports.mjs +1 -0
  353. package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
  354. package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
  355. package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
  356. package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
  357. package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
  358. package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
  359. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
  360. package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
  361. package/dist/esm/core/fetcher/Fetcher.d.mts +56 -0
  362. package/dist/esm/core/fetcher/Fetcher.mjs +270 -0
  363. package/dist/esm/core/fetcher/Headers.d.mts +2 -0
  364. package/dist/esm/core/fetcher/Headers.mjs +82 -0
  365. package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
  366. package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
  367. package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
  368. package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
  369. package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
  370. package/dist/esm/core/fetcher/Supplier.mjs +19 -0
  371. package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
  372. package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
  373. package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
  374. package/dist/esm/core/fetcher/getErrorResponseBody.mjs +55 -0
  375. package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
  376. package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
  377. package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
  378. package/dist/esm/core/fetcher/getHeader.mjs +8 -0
  379. package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
  380. package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
  381. package/dist/esm/core/fetcher/getResponseBody.d.mts +17 -0
  382. package/dist/esm/core/fetcher/getResponseBody.mjs +81 -0
  383. package/dist/esm/core/fetcher/index.d.mts +13 -0
  384. package/dist/esm/core/fetcher/index.mjs +7 -0
  385. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  386. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +170 -0
  387. package/dist/esm/core/fetcher/makeRequest.d.mts +11 -0
  388. package/dist/esm/core/fetcher/makeRequest.mjs +87 -0
  389. package/dist/esm/core/fetcher/redactUrl.d.mts +2 -0
  390. package/dist/esm/core/fetcher/redactUrl.mjs +84 -0
  391. package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
  392. package/dist/esm/core/fetcher/requestWithRetries.mjs +88 -0
  393. package/dist/esm/core/fetcher/signals.d.mts +6 -0
  394. package/dist/esm/core/fetcher/signals.mjs +28 -0
  395. package/dist/esm/core/headers.d.mts +2 -0
  396. package/dist/esm/core/headers.mjs +27 -0
  397. package/dist/esm/core/index.d.mts +6 -0
  398. package/dist/esm/core/index.mjs +6 -0
  399. package/dist/esm/core/json.d.mts +15 -0
  400. package/dist/esm/core/json.mjs +19 -0
  401. package/dist/esm/core/logging/exports.d.mts +18 -0
  402. package/dist/esm/core/logging/exports.mjs +9 -0
  403. package/dist/esm/core/logging/index.d.mts +1 -0
  404. package/dist/esm/core/logging/index.mjs +1 -0
  405. package/dist/esm/core/logging/logger.d.mts +126 -0
  406. package/dist/esm/core/logging/logger.mjs +138 -0
  407. package/dist/esm/core/requestBody.d.mts +12 -0
  408. package/dist/esm/core/requestBody.mjs +23 -0
  409. package/dist/esm/core/runtime/index.d.mts +1 -0
  410. package/dist/esm/core/runtime/index.mjs +1 -0
  411. package/dist/esm/core/runtime/runtime.d.mts +28 -0
  412. package/dist/esm/core/runtime/runtime.mjs +172 -0
  413. package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
  414. package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
  415. package/dist/esm/core/url/encodePathParam.d.mts +3 -0
  416. package/dist/esm/core/url/encodePathParam.mjs +24 -0
  417. package/dist/esm/core/url/index.d.mts +4 -0
  418. package/dist/esm/core/url/index.mjs +4 -0
  419. package/dist/esm/core/url/join.d.mts +1 -0
  420. package/dist/esm/core/url/join.mjs +65 -0
  421. package/dist/esm/core/url/qs.d.mts +7 -0
  422. package/dist/esm/core/url/qs.mjs +73 -0
  423. package/dist/esm/environments.d.mts +4 -0
  424. package/dist/esm/environments.mjs +4 -0
  425. package/dist/esm/errors/SpyglassError.d.mts +15 -0
  426. package/dist/esm/errors/SpyglassError.mjs +49 -0
  427. package/dist/esm/errors/SpyglassTimeoutError.d.mts +6 -0
  428. package/dist/esm/errors/SpyglassTimeoutError.mjs +15 -0
  429. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  430. package/dist/esm/errors/handleNonStatusCodeError.mjs +32 -0
  431. package/dist/esm/errors/index.d.mts +2 -0
  432. package/dist/esm/errors/index.mjs +2 -0
  433. package/dist/esm/exports.d.mts +1 -0
  434. package/dist/esm/exports.mjs +1 -0
  435. package/dist/esm/index.d.mts +6 -0
  436. package/dist/esm/index.mjs +5 -0
  437. package/dist/esm/version.d.mts +1 -0
  438. package/dist/esm/version.mjs +1 -0
  439. package/package.json +101 -5
  440. package/reference.md +852 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Spyglass
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,205 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <img src="./assets/wordmark.svg" alt="Spyglass" width="360">
2
3
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
4
+ <h3>The API layer for the social internet</h3>
5
+ <p>Official TypeScript & Node.js SDK for the Spyglass API — search brands, creators, and the ads they run.</p>
6
+
7
+ <a href="https://app.spyglass.so">
8
+ <img src="https://img.shields.io/badge/Get_Started-111111?style=for-the-badge" alt="Get Started">
9
+ </a>
10
+ <a href="https://docs.spyglass.so">
11
+ <img src="https://img.shields.io/badge/Documentation-4A4A4A?style=for-the-badge" alt="Documentation">
12
+ </a>
13
+ <a href="https://spyglass.so">
14
+ <img src="https://img.shields.io/badge/spyglass.so-0A0A0A?style=for-the-badge" alt="spyglass.so">
15
+ </a>
16
+ </div>
17
+
18
+ <br>
19
+
20
+ <div align="center">
21
+ <a href="./LICENSE">
22
+ <img src="https://img.shields.io/github/license/spyglass-so/spyglass-typescript" alt="License">
23
+ </a>
24
+ <a href="https://github.com/spyglass-so/spyglass-typescript/stargazers">
25
+ <img src="https://img.shields.io/github/stars/spyglass-so/spyglass-typescript?style=social" alt="Stars">
26
+ </a>
27
+ <a href="https://www.npmjs.com/package/@spyglasshq/sdk">
28
+ <img src="https://img.shields.io/npm/v/@spyglasshq/sdk" alt="npm">
29
+ </a>
30
+ <a href="https://github.com/spyglass-so/spyglass-python">
31
+ <img src="https://img.shields.io/badge/Python_SDK-spyglass--sdk-3776AB?logo=python&logoColor=white" alt="Python SDK">
32
+ </a>
33
+ </div>
34
+
35
+ ---
36
+
37
+ Official TypeScript client for the [Spyglass API](https://docs.spyglass.so). Server-side only. Looking for Python? See [`spyglass-so/spyglass-python`](https://github.com/spyglass-so/spyglass-python).
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install @spyglasshq/sdk
43
+ # or
44
+ pnpm add @spyglasshq/sdk
45
+ ```
46
+
47
+ ## Quickstart
48
+
49
+ Create an API key in [Settings → API](https://app.spyglass.so). Keys start with `sg_live_` and are shown once.
50
+
51
+ ```ts
52
+ import { SpyglassClient } from "@spyglasshq/sdk";
53
+
54
+ const client = new SpyglassClient({
55
+ token: process.env.SPYGLASS_API_KEY!,
56
+ });
57
+
58
+ // 1. Resolve a brand
59
+ const { brands } = await client.search.searchBrandsV2({
60
+ names: ["Nike"],
61
+ limit: 1,
62
+ });
63
+
64
+ const brand = brands[0];
65
+
66
+ if (brand) {
67
+ // 2. Pull the creatives that brand is running
68
+ const { media } = await client.search.getMediaV2({
69
+ brandId: brand.id,
70
+ query: "running shoes comfort",
71
+ limit: 20,
72
+ });
73
+
74
+ for (const ad of media) {
75
+ console.log(ad.id, ad.hook, ad.landingPageUrl);
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## What You Can Query
81
+
82
+ | Method | Endpoint | What it answers |
83
+ | --- | --- | --- |
84
+ | `client.search.searchBrandsV2(...)` | `POST /brands` | Which brand is this? Who else is in this space? |
85
+ | `client.search.creators(...)` | `POST /creators` | Which creator is this? Who matches this audience profile? |
86
+ | `client.search.getAccount(...)` | `GET /account/{id}` | What do we know about a brand or creator ID you already have? |
87
+ | `client.search.getMediaV2(...)` | `POST /media` | What creatives is this account running, or what's out there for this theme? |
88
+ | `client.search.taxonomies(...)` | `GET /taxonomies` | Which product-category paths match this phrase? |
89
+ | `client.search.getBrandMediaInsights(...)` | `GET /account/{id}/insights` | What hooks, USPs, personas, and formats does it lean on? |
90
+ | `client.search.getBrandLandingPages(...)` | `GET /account/{id}/landing-pages` | Where does its ad traffic go? |
91
+ | `client.search.getComments(...)` | `POST /comments` | What are people saying on this Instagram or TikTok post? |
92
+ | `client.indexing.indexBrand(...)` | `POST /account/index` | Index a brand we don't have yet by website or social URL. |
93
+ | `client.indexing.indexBrandStatus(...)` | `GET /account/{id}/index-status` | Has that brand finished indexing? |
94
+ | `client.account.getCreditUsage()` | `GET /team/credit-usage` | How many monthly credits does this team have left? |
95
+
96
+ Full parameters and response schemas are documented in [`reference.md`](./reference.md) and at [docs.spyglass.so](https://docs.spyglass.so).
97
+
98
+ ## Indexing a New Brand
99
+
100
+ If Spyglass doesn't have a brand yet, queue it by website or social profile URL and poll until `status` is `"ready"`:
101
+
102
+ ```ts
103
+ const indexed = await client.indexing.indexBrand({
104
+ websiteUrl: "https://www.nike.com",
105
+ });
106
+
107
+ if (indexed.status === "indexing") {
108
+ let status = indexed.status;
109
+ while (status === "indexing") {
110
+ await new Promise((r) => setTimeout(r, 3000));
111
+ const check = await client.indexing.indexBrandStatus({ id: indexed.brandId });
112
+ status = check.status;
113
+ }
114
+ }
115
+ ```
116
+
117
+ ## Request & Response Types
118
+
119
+ All request and response types are exported under the `Spyglass` namespace:
120
+
121
+ ```ts
122
+ import { Spyglass } from "@spyglasshq/sdk";
123
+
124
+ const request: Spyglass.SearchBrandsV2Request = {
125
+ names: ["Nike"],
126
+ limit: 5,
127
+ };
128
+ ```
129
+
130
+ ## Error Handling
131
+
132
+ Non-2xx responses throw a `SpyglassError` with status code, parsed body, and raw response metadata:
133
+
134
+ ```ts
135
+ import { SpyglassError } from "@spyglasshq/sdk";
136
+
137
+ try {
138
+ await client.search.searchBrandsV2({ names: ["Nike"], limit: 5 });
139
+ } catch (err) {
140
+ if (err instanceof SpyglassError) {
141
+ console.error(err.statusCode, err.message, err.body);
142
+ }
143
+ }
144
+ ```
145
+
146
+ ## Advanced Options
147
+
148
+ ### Retries & Timeouts
149
+
150
+ Requests default to a 60-second timeout and up to 2 automatic retries with exponential backoff on `408`, `429`, and `5xx` responses. Override per request:
151
+
152
+ ```ts
153
+ const response = await client.search.searchBrandsV2(
154
+ { names: ["Nike"], limit: 5 },
155
+ {
156
+ timeoutInSeconds: 30,
157
+ maxRetries: 3,
158
+ abortSignal: controller.signal,
159
+ },
160
+ );
161
+ ```
162
+
163
+ ### Raw Response & Headers
164
+
165
+ Use `.withRawResponse()` to inspect HTTP headers (such as rate-limit or credit headers):
166
+
167
+ ```ts
168
+ const { data, rawResponse } = await client.search
169
+ .searchBrandsV2({ names: ["Nike"], limit: 1 })
170
+ .withRawResponse();
171
+
172
+ console.log(data.brands);
173
+ console.log(rawResponse.headers);
174
+ ```
175
+
176
+ ### Subpackage Imports
177
+
178
+ Import individual resource clients directly for smaller bundle sizes:
179
+
180
+ ```ts
181
+ import { SearchClient } from "@spyglasshq/sdk/search";
182
+ ```
183
+
184
+ ### Runtime Compatibility
185
+
186
+ - Node.js 18+
187
+ - Bun 1.0+
188
+ - Deno v1.25+
189
+ - Vercel / Cloudflare Workers
190
+
191
+ ## Billing & Conventions
192
+
193
+ - **Credits:** Most calls spend monthly credits per row returned (`count` in the response). Always bound requests with `limit`. See [Billing docs](https://docs.spyglass.so/documentation/get-started/billing).
194
+ - **Pagination:** Page through results with `offset` and `limit`. `count` is the number of rows in the current response.
195
+ - **Server-to-server:** The API does not enable browser CORS; call it from your backend or agent runtime.
196
+
197
+ ## Support
198
+
199
+ - **Documentation:** [docs.spyglass.so](https://docs.spyglass.so)
200
+ - **Issues:** [GitHub Issues](https://github.com/spyglass-so/spyglass-typescript/issues)
201
+ - **Email:** [support@spyglass.so](mailto:support@spyglass.so)
202
+
203
+ ## License
204
+
205
+ [MIT](./LICENSE)
@@ -0,0 +1,54 @@
1
+ import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
2
+ import * as core from "./core/index.js";
3
+ import type * as environments from "./environments.js";
4
+ export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | BearerAuthProvider.AuthOptions;
5
+ export type BaseClientOptions = {
6
+ environment?: core.Supplier<environments.SpyglassEnvironment | string>;
7
+ /** Specify a custom URL to connect the client to. */
8
+ baseUrl?: core.Supplier<string>;
9
+ /** Additional headers to include in requests. */
10
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
11
+ /** The default maximum time to wait for a response in seconds. */
12
+ timeoutInSeconds?: number;
13
+ /** The default number of times to retry the request. Defaults to 2. */
14
+ maxRetries?: number;
15
+ /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
16
+ fetch?: typeof fetch;
17
+ /** Configure logging for the client. */
18
+ logging?: core.logging.LogConfig | core.logging.Logger;
19
+ /** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
20
+ stream?: {
21
+ reconnectionEnabled?: boolean;
22
+ maxReconnectionAttempts?: number;
23
+ };
24
+ /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
25
+ auth?: AuthOption;
26
+ } & BearerAuthProvider.AuthOptions;
27
+ export interface BaseRequestOptions {
28
+ /** The maximum time to wait for a response in seconds. */
29
+ timeoutInSeconds?: number;
30
+ /** The number of times to retry the request. Defaults to 2. */
31
+ maxRetries?: number;
32
+ /** A hook to abort the request. */
33
+ abortSignal?: AbortSignal;
34
+ /** Additional query string parameters to include in the request. */
35
+ queryParams?: Record<string, unknown>;
36
+ /** A dictionary containing additional parameters to spread into the request's body. */
37
+ additionalBodyParameters?: Record<string, unknown>;
38
+ /** Additional headers to include in the request. */
39
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
40
+ /** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
41
+ stream?: {
42
+ reconnectionEnabled?: boolean;
43
+ maxReconnectionAttempts?: number;
44
+ };
45
+ }
46
+ export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
47
+ logging: core.logging.Logger;
48
+ authProvider?: core.AuthProvider;
49
+ };
50
+ export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
51
+ authProvider: core.AuthProvider;
52
+ };
53
+ export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
54
+ export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
@@ -0,0 +1,77 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.normalizeClientOptions = normalizeClientOptions;
38
+ exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
39
+ const BearerAuthProvider_js_1 = require("./auth/BearerAuthProvider.js");
40
+ const headers_js_1 = require("./core/headers.js");
41
+ const core = __importStar(require("./core/index.js"));
42
+ function normalizeClientOptions(options) {
43
+ const headers = (0, headers_js_1.mergeHeaders)({
44
+ "X-Fern-Language": "JavaScript",
45
+ "X-Fern-SDK-Name": "@spyglass/sdk",
46
+ "X-Fern-SDK-Version": "0.1.0",
47
+ "User-Agent": "@spyglass/sdk/0.1.0",
48
+ "X-Fern-Runtime": core.RUNTIME.type,
49
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
50
+ }, options === null || options === void 0 ? void 0 : options.headers);
51
+ return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
52
+ }
53
+ function normalizeClientOptionsWithAuth(options) {
54
+ var _a;
55
+ const normalized = normalizeClientOptions(options);
56
+ if (options.auth === false) {
57
+ normalized.authProvider = new core.NoOpAuthProvider();
58
+ return normalized;
59
+ }
60
+ if (options.auth != null) {
61
+ if (typeof options.auth === "function") {
62
+ normalized.authProvider = { getAuthRequest: options.auth };
63
+ return normalized;
64
+ }
65
+ if (core.isAuthProvider(options.auth)) {
66
+ normalized.authProvider = options.auth;
67
+ return normalized;
68
+ }
69
+ Object.assign(normalized, options.auth);
70
+ }
71
+ const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
72
+ (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new BearerAuthProvider_js_1.BearerAuthProvider(normalizedWithNoOpAuthProvider));
73
+ return normalized;
74
+ }
75
+ function withNoOpAuthProvider(options) {
76
+ return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
77
+ }
@@ -0,0 +1,32 @@
1
+ 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
+ import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
5
+ import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
6
+ import * as core from "./core/index.js";
7
+ export declare namespace SpyglassClient {
8
+ type Options = BaseClientOptions;
9
+ interface RequestOptions extends BaseRequestOptions {
10
+ }
11
+ }
12
+ export declare class SpyglassClient {
13
+ protected readonly _options: NormalizedClientOptionsWithAuth<SpyglassClient.Options>;
14
+ protected _search: SearchClient | undefined;
15
+ protected _account: AccountClient | undefined;
16
+ protected _indexing: IndexingClient | undefined;
17
+ constructor(options: SpyglassClient.Options);
18
+ get search(): SearchClient;
19
+ get account(): AccountClient;
20
+ get indexing(): IndexingClient;
21
+ /**
22
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
23
+ * This is useful for making requests to endpoints not yet supported in the SDK.
24
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
25
+ *
26
+ * @param {Request | string | URL} input - The URL, path, or Request object.
27
+ * @param {RequestInit} init - Standard fetch RequestInit options.
28
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
29
+ * @returns {Promise<Response>} A standard Response object.
30
+ */
31
+ fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
32
+ }
@@ -0,0 +1,93 @@
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.SpyglassClient = void 0;
47
+ const Client_js_1 = require("./api/resources/account/client/Client.js");
48
+ const Client_js_2 = require("./api/resources/indexing/client/Client.js");
49
+ const Client_js_3 = require("./api/resources/search/client/Client.js");
50
+ const BaseClient_js_1 = require("./BaseClient.js");
51
+ const core = __importStar(require("./core/index.js"));
52
+ class SpyglassClient {
53
+ constructor(options) {
54
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
55
+ }
56
+ get search() {
57
+ var _a;
58
+ return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_js_3.SearchClient(this._options)));
59
+ }
60
+ get account() {
61
+ var _a;
62
+ return ((_a = this._account) !== null && _a !== void 0 ? _a : (this._account = new Client_js_1.AccountClient(this._options)));
63
+ }
64
+ get indexing() {
65
+ var _a;
66
+ return ((_a = this._indexing) !== null && _a !== void 0 ? _a : (this._indexing = new Client_js_2.IndexingClient(this._options)));
67
+ }
68
+ /**
69
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
70
+ * This is useful for making requests to endpoints not yet supported in the SDK.
71
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
72
+ *
73
+ * @param {Request | string | URL} input - The URL, path, or Request object.
74
+ * @param {RequestInit} init - Standard fetch RequestInit options.
75
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
76
+ * @returns {Promise<Response>} A standard Response object.
77
+ */
78
+ fetch(input, init, requestOptions) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ var _a;
81
+ return core.makePassthroughRequest(input, init, {
82
+ baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
83
+ headers: this._options.headers,
84
+ timeoutInSeconds: this._options.timeoutInSeconds,
85
+ maxRetries: this._options.maxRetries,
86
+ fetch: this._options.fetch,
87
+ logging: this._options.logging,
88
+ getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
89
+ }, requestOptions);
90
+ });
91
+ }
92
+ }
93
+ exports.SpyglassClient = SpyglassClient;
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as Spyglass from "../index.js";
4
+ export declare class BadRequestError extends errors.SpyglassError {
5
+ readonly body: Spyglass.Error_;
6
+ constructor(body: Spyglass.Error_, rawResponse?: core.RawResponse);
7
+ }
@@ -0,0 +1,54 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.BadRequestError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class BadRequestError extends errors.SpyglassError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "BadRequestError",
43
+ statusCode: 400,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "BadRequestError";
52
+ }
53
+ }
54
+ exports.BadRequestError = BadRequestError;
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as Spyglass from "../index.js";
4
+ export declare class ContentTooLargeError extends errors.SpyglassError {
5
+ readonly body: Spyglass.Error_;
6
+ constructor(body: Spyglass.Error_, rawResponse?: core.RawResponse);
7
+ }
@@ -0,0 +1,54 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ContentTooLargeError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class ContentTooLargeError extends errors.SpyglassError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "ContentTooLargeError",
43
+ statusCode: 413,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = "ContentTooLargeError";
52
+ }
53
+ }
54
+ exports.ContentTooLargeError = ContentTooLargeError;
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as Spyglass from "../index.js";
4
+ export declare class ForbiddenError extends errors.SpyglassError {
5
+ readonly body: Spyglass.Error_;
6
+ constructor(body: Spyglass.Error_, rawResponse?: core.RawResponse);
7
+ }