@fern-api/postman 0.0.2

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 (275) hide show
  1. package/README.md +271 -0
  2. package/dist/cjs/BaseClient.d.ts +39 -0
  3. package/dist/cjs/BaseClient.js +62 -0
  4. package/dist/cjs/Client.d.ts +25 -0
  5. package/dist/cjs/Client.js +103 -0
  6. package/dist/cjs/api/index.d.ts +1 -0
  7. package/dist/cjs/api/index.js +17 -0
  8. package/dist/cjs/api/resources/collection/client/Client.d.ts +43 -0
  9. package/dist/cjs/api/resources/collection/client/Client.js +165 -0
  10. package/dist/cjs/api/resources/collection/client/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/collection/client/index.js +17 -0
  12. package/dist/cjs/api/resources/collection/client/requests/PublishCollectionRequest.d.ts +12 -0
  13. package/dist/cjs/api/resources/collection/client/requests/PublishCollectionRequest.js +3 -0
  14. package/dist/cjs/api/resources/collection/client/requests/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/collection/client/requests/index.js +2 -0
  16. package/dist/cjs/api/resources/collection/errors/CollectionDoesNotExistError.d.ts +6 -0
  17. package/dist/cjs/api/resources/collection/errors/CollectionDoesNotExistError.js +54 -0
  18. package/dist/cjs/api/resources/collection/errors/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/collection/errors/index.js +17 -0
  20. package/dist/cjs/api/resources/collection/index.d.ts +3 -0
  21. package/dist/cjs/api/resources/collection/index.js +19 -0
  22. package/dist/cjs/api/resources/collection/types/CollectionId.d.ts +4 -0
  23. package/dist/cjs/api/resources/collection/types/CollectionId.js +3 -0
  24. package/dist/cjs/api/resources/collection/types/CollectionStatusFailed.d.ts +3 -0
  25. package/dist/cjs/api/resources/collection/types/CollectionStatusFailed.js +3 -0
  26. package/dist/cjs/api/resources/collection/types/CollectionStatusPublished.d.ts +4 -0
  27. package/dist/cjs/api/resources/collection/types/CollectionStatusPublished.js +3 -0
  28. package/dist/cjs/api/resources/collection/types/CollectionStatusPublishing.d.ts +3 -0
  29. package/dist/cjs/api/resources/collection/types/CollectionStatusPublishing.js +3 -0
  30. package/dist/cjs/api/resources/collection/types/GetCollectionStatusResponse.d.ts +25 -0
  31. package/dist/cjs/api/resources/collection/types/GetCollectionStatusResponse.js +3 -0
  32. package/dist/cjs/api/resources/collection/types/TeamId.d.ts +4 -0
  33. package/dist/cjs/api/resources/collection/types/TeamId.js +3 -0
  34. package/dist/cjs/api/resources/collection/types/UserId.d.ts +4 -0
  35. package/dist/cjs/api/resources/collection/types/UserId.js +3 -0
  36. package/dist/cjs/api/resources/collection/types/index.d.ts +7 -0
  37. package/dist/cjs/api/resources/collection/types/index.js +23 -0
  38. package/dist/cjs/api/resources/index.d.ts +4 -0
  39. package/dist/cjs/api/resources/index.js +43 -0
  40. package/dist/cjs/auth/BearerAuthProvider.d.ts +20 -0
  41. package/dist/cjs/auth/BearerAuthProvider.js +79 -0
  42. package/dist/cjs/auth/index.d.ts +1 -0
  43. package/dist/cjs/auth/index.js +5 -0
  44. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  45. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  46. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  47. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  48. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  49. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  50. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  51. package/dist/cjs/core/auth/BearerToken.js +16 -0
  52. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  53. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  54. package/dist/cjs/core/auth/index.d.ts +5 -0
  55. package/dist/cjs/core/auth/index.js +9 -0
  56. package/dist/cjs/core/base64.d.ts +2 -0
  57. package/dist/cjs/core/base64.js +26 -0
  58. package/dist/cjs/core/exports.d.ts +1 -0
  59. package/dist/cjs/core/exports.js +17 -0
  60. package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
  61. package/dist/cjs/core/fetcher/APIResponse.js +2 -0
  62. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
  63. package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
  64. package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
  65. package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
  66. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
  67. package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
  68. package/dist/cjs/core/fetcher/Fetcher.d.ts +48 -0
  69. package/dist/cjs/core/fetcher/Fetcher.js +316 -0
  70. package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
  71. package/dist/cjs/core/fetcher/Headers.js +84 -0
  72. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
  73. package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
  74. package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
  75. package/dist/cjs/core/fetcher/RawResponse.js +44 -0
  76. package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
  77. package/dist/cjs/core/fetcher/Supplier.js +22 -0
  78. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
  79. package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
  80. package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
  81. package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
  82. package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
  83. package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
  84. package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
  85. package/dist/cjs/core/fetcher/getHeader.js +11 -0
  86. package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
  87. package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
  88. package/dist/cjs/core/fetcher/getResponseBody.d.ts +1 -0
  89. package/dist/cjs/core/fetcher/getResponseBody.js +69 -0
  90. package/dist/cjs/core/fetcher/index.d.ts +11 -0
  91. package/dist/cjs/core/fetcher/index.js +17 -0
  92. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -0
  93. package/dist/cjs/core/fetcher/makeRequest.js +40 -0
  94. package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
  95. package/dist/cjs/core/fetcher/requestWithRetries.js +67 -0
  96. package/dist/cjs/core/fetcher/signals.d.ts +5 -0
  97. package/dist/cjs/core/fetcher/signals.js +24 -0
  98. package/dist/cjs/core/headers.d.ts +2 -0
  99. package/dist/cjs/core/headers.js +31 -0
  100. package/dist/cjs/core/index.d.ts +6 -0
  101. package/dist/cjs/core/index.js +45 -0
  102. package/dist/cjs/core/json.d.ts +15 -0
  103. package/dist/cjs/core/json.js +24 -0
  104. package/dist/cjs/core/logging/exports.d.ts +18 -0
  105. package/dist/cjs/core/logging/exports.js +45 -0
  106. package/dist/cjs/core/logging/index.d.ts +1 -0
  107. package/dist/cjs/core/logging/index.js +17 -0
  108. package/dist/cjs/core/logging/logger.d.ts +126 -0
  109. package/dist/cjs/core/logging/logger.js +144 -0
  110. package/dist/cjs/core/runtime/index.d.ts +1 -0
  111. package/dist/cjs/core/runtime/index.js +5 -0
  112. package/dist/cjs/core/runtime/runtime.d.ts +9 -0
  113. package/dist/cjs/core/runtime/runtime.js +103 -0
  114. package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
  115. package/dist/cjs/core/url/encodePathParam.js +21 -0
  116. package/dist/cjs/core/url/index.d.ts +3 -0
  117. package/dist/cjs/core/url/index.js +9 -0
  118. package/dist/cjs/core/url/join.d.ts +1 -0
  119. package/dist/cjs/core/url/join.js +68 -0
  120. package/dist/cjs/core/url/qs.d.ts +6 -0
  121. package/dist/cjs/core/url/qs.js +64 -0
  122. package/dist/cjs/environments.d.ts +5 -0
  123. package/dist/cjs/environments.js +8 -0
  124. package/dist/cjs/errors/FernPostmanError.d.ts +12 -0
  125. package/dist/cjs/errors/FernPostmanError.js +32 -0
  126. package/dist/cjs/errors/FernPostmanTimeoutError.d.ts +3 -0
  127. package/dist/cjs/errors/FernPostmanTimeoutError.js +15 -0
  128. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  129. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  130. package/dist/cjs/errors/index.d.ts +2 -0
  131. package/dist/cjs/errors/index.js +7 -0
  132. package/dist/cjs/exports.d.ts +1 -0
  133. package/dist/cjs/exports.js +17 -0
  134. package/dist/cjs/index.d.ts +6 -0
  135. package/dist/cjs/index.js +48 -0
  136. package/dist/cjs/version.d.ts +1 -0
  137. package/dist/cjs/version.js +4 -0
  138. package/dist/esm/BaseClient.d.mts +39 -0
  139. package/dist/esm/BaseClient.mjs +25 -0
  140. package/dist/esm/Client.d.mts +25 -0
  141. package/dist/esm/Client.mjs +66 -0
  142. package/dist/esm/api/index.d.mts +1 -0
  143. package/dist/esm/api/index.mjs +1 -0
  144. package/dist/esm/api/resources/collection/client/Client.d.mts +43 -0
  145. package/dist/esm/api/resources/collection/client/Client.mjs +128 -0
  146. package/dist/esm/api/resources/collection/client/index.d.mts +1 -0
  147. package/dist/esm/api/resources/collection/client/index.mjs +1 -0
  148. package/dist/esm/api/resources/collection/client/requests/PublishCollectionRequest.d.mts +12 -0
  149. package/dist/esm/api/resources/collection/client/requests/PublishCollectionRequest.mjs +2 -0
  150. package/dist/esm/api/resources/collection/client/requests/index.d.mts +1 -0
  151. package/dist/esm/api/resources/collection/client/requests/index.mjs +1 -0
  152. package/dist/esm/api/resources/collection/errors/CollectionDoesNotExistError.d.mts +6 -0
  153. package/dist/esm/api/resources/collection/errors/CollectionDoesNotExistError.mjs +17 -0
  154. package/dist/esm/api/resources/collection/errors/index.d.mts +1 -0
  155. package/dist/esm/api/resources/collection/errors/index.mjs +1 -0
  156. package/dist/esm/api/resources/collection/index.d.mts +3 -0
  157. package/dist/esm/api/resources/collection/index.mjs +3 -0
  158. package/dist/esm/api/resources/collection/types/CollectionId.d.mts +4 -0
  159. package/dist/esm/api/resources/collection/types/CollectionId.mjs +2 -0
  160. package/dist/esm/api/resources/collection/types/CollectionStatusFailed.d.mts +3 -0
  161. package/dist/esm/api/resources/collection/types/CollectionStatusFailed.mjs +2 -0
  162. package/dist/esm/api/resources/collection/types/CollectionStatusPublished.d.mts +4 -0
  163. package/dist/esm/api/resources/collection/types/CollectionStatusPublished.mjs +2 -0
  164. package/dist/esm/api/resources/collection/types/CollectionStatusPublishing.d.mts +3 -0
  165. package/dist/esm/api/resources/collection/types/CollectionStatusPublishing.mjs +2 -0
  166. package/dist/esm/api/resources/collection/types/GetCollectionStatusResponse.d.mts +25 -0
  167. package/dist/esm/api/resources/collection/types/GetCollectionStatusResponse.mjs +2 -0
  168. package/dist/esm/api/resources/collection/types/TeamId.d.mts +4 -0
  169. package/dist/esm/api/resources/collection/types/TeamId.mjs +2 -0
  170. package/dist/esm/api/resources/collection/types/UserId.d.mts +4 -0
  171. package/dist/esm/api/resources/collection/types/UserId.mjs +2 -0
  172. package/dist/esm/api/resources/collection/types/index.d.mts +7 -0
  173. package/dist/esm/api/resources/collection/types/index.mjs +7 -0
  174. package/dist/esm/api/resources/index.d.mts +4 -0
  175. package/dist/esm/api/resources/index.mjs +4 -0
  176. package/dist/esm/auth/BearerAuthProvider.d.mts +20 -0
  177. package/dist/esm/auth/BearerAuthProvider.mjs +42 -0
  178. package/dist/esm/auth/index.d.mts +1 -0
  179. package/dist/esm/auth/index.mjs +1 -0
  180. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  181. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  182. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  183. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  184. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  185. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  186. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  187. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  188. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  189. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  190. package/dist/esm/core/auth/index.d.mts +5 -0
  191. package/dist/esm/core/auth/index.mjs +3 -0
  192. package/dist/esm/core/base64.d.mts +2 -0
  193. package/dist/esm/core/base64.mjs +22 -0
  194. package/dist/esm/core/exports.d.mts +1 -0
  195. package/dist/esm/core/exports.mjs +1 -0
  196. package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
  197. package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
  198. package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
  199. package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
  200. package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
  201. package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
  202. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
  203. package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
  204. package/dist/esm/core/fetcher/Fetcher.d.mts +48 -0
  205. package/dist/esm/core/fetcher/Fetcher.mjs +312 -0
  206. package/dist/esm/core/fetcher/Headers.d.mts +2 -0
  207. package/dist/esm/core/fetcher/Headers.mjs +82 -0
  208. package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
  209. package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
  210. package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
  211. package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
  212. package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
  213. package/dist/esm/core/fetcher/Supplier.mjs +19 -0
  214. package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
  215. package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
  216. package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
  217. package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
  218. package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
  219. package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
  220. package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
  221. package/dist/esm/core/fetcher/getHeader.mjs +8 -0
  222. package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
  223. package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
  224. package/dist/esm/core/fetcher/getResponseBody.d.mts +1 -0
  225. package/dist/esm/core/fetcher/getResponseBody.mjs +66 -0
  226. package/dist/esm/core/fetcher/index.d.mts +11 -0
  227. package/dist/esm/core/fetcher/index.mjs +6 -0
  228. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -0
  229. package/dist/esm/core/fetcher/makeRequest.mjs +36 -0
  230. package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
  231. package/dist/esm/core/fetcher/requestWithRetries.mjs +64 -0
  232. package/dist/esm/core/fetcher/signals.d.mts +5 -0
  233. package/dist/esm/core/fetcher/signals.mjs +20 -0
  234. package/dist/esm/core/headers.d.mts +2 -0
  235. package/dist/esm/core/headers.mjs +27 -0
  236. package/dist/esm/core/index.d.mts +6 -0
  237. package/dist/esm/core/index.mjs +6 -0
  238. package/dist/esm/core/json.d.mts +15 -0
  239. package/dist/esm/core/json.mjs +19 -0
  240. package/dist/esm/core/logging/exports.d.mts +18 -0
  241. package/dist/esm/core/logging/exports.mjs +9 -0
  242. package/dist/esm/core/logging/index.d.mts +1 -0
  243. package/dist/esm/core/logging/index.mjs +1 -0
  244. package/dist/esm/core/logging/logger.d.mts +126 -0
  245. package/dist/esm/core/logging/logger.mjs +138 -0
  246. package/dist/esm/core/runtime/index.d.mts +1 -0
  247. package/dist/esm/core/runtime/index.mjs +1 -0
  248. package/dist/esm/core/runtime/runtime.d.mts +9 -0
  249. package/dist/esm/core/runtime/runtime.mjs +100 -0
  250. package/dist/esm/core/url/encodePathParam.d.mts +1 -0
  251. package/dist/esm/core/url/encodePathParam.mjs +18 -0
  252. package/dist/esm/core/url/index.d.mts +3 -0
  253. package/dist/esm/core/url/index.mjs +3 -0
  254. package/dist/esm/core/url/join.d.mts +1 -0
  255. package/dist/esm/core/url/join.mjs +65 -0
  256. package/dist/esm/core/url/qs.d.mts +6 -0
  257. package/dist/esm/core/url/qs.mjs +61 -0
  258. package/dist/esm/environments.d.mts +5 -0
  259. package/dist/esm/environments.mjs +5 -0
  260. package/dist/esm/errors/FernPostmanError.d.mts +12 -0
  261. package/dist/esm/errors/FernPostmanError.mjs +28 -0
  262. package/dist/esm/errors/FernPostmanTimeoutError.d.mts +3 -0
  263. package/dist/esm/errors/FernPostmanTimeoutError.mjs +11 -0
  264. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  265. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  266. package/dist/esm/errors/index.d.mts +2 -0
  267. package/dist/esm/errors/index.mjs +2 -0
  268. package/dist/esm/exports.d.mts +1 -0
  269. package/dist/esm/exports.mjs +1 -0
  270. package/dist/esm/index.d.mts +6 -0
  271. package/dist/esm/index.mjs +5 -0
  272. package/dist/esm/version.d.mts +1 -0
  273. package/dist/esm/version.mjs +1 -0
  274. package/package.json +69 -0
  275. package/reference.md +193 -0
package/README.md ADDED
@@ -0,0 +1,271 @@
1
+ # Fern TypeScript Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Ffern-api%2Fpostman-sdk)
4
+ [![npm shield](https://img.shields.io/npm/v/@fern-api/postman)](https://www.npmjs.com/package/@fern-api/postman)
5
+
6
+ The Fern TypeScript library provides convenient access to the Fern APIs from TypeScript.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Request and Response Types](#request-and-response-types)
14
+ - [Exception Handling](#exception-handling)
15
+ - [Advanced](#advanced)
16
+ - [Additional Headers](#additional-headers)
17
+ - [Additional Query String Parameters](#additional-query-string-parameters)
18
+ - [Retries](#retries)
19
+ - [Timeouts](#timeouts)
20
+ - [Aborting Requests](#aborting-requests)
21
+ - [Access Raw Response Data](#access-raw-response-data)
22
+ - [Logging](#logging)
23
+ - [Runtime Compatibility](#runtime-compatibility)
24
+ - [Contributing](#contributing)
25
+
26
+ ## Installation
27
+
28
+ ```sh
29
+ npm i -s @fern-api/postman
30
+ ```
31
+
32
+ ## Reference
33
+
34
+ A full reference for this library is available [here](https://github.com/fern-api/postman-sdk/blob/HEAD/./reference.md).
35
+
36
+ ## Usage
37
+
38
+ Instantiate and use the client with the following:
39
+
40
+ ```typescript
41
+ import { FernPostmanClient } from "@fern-api/postman";
42
+
43
+ const client = new FernPostmanClient({ token: "YOUR_TOKEN" });
44
+ await client.collection.publish("collectionId", {
45
+ userId: "userId",
46
+ teamId: "teamId"
47
+ });
48
+ ```
49
+
50
+ ## Request and Response Types
51
+
52
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
53
+ following namespace:
54
+
55
+ ```typescript
56
+ import { FernPostman } from "@fern-api/postman";
57
+
58
+ const request: FernPostman.PublishCollectionRequest = {
59
+ ...
60
+ };
61
+ ```
62
+
63
+ ## Exception Handling
64
+
65
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
66
+ will be thrown.
67
+
68
+ ```typescript
69
+ import { FernPostmanError } from "@fern-api/postman";
70
+
71
+ try {
72
+ await client.collection.publish(...);
73
+ } catch (err) {
74
+ if (err instanceof FernPostmanError) {
75
+ console.log(err.statusCode);
76
+ console.log(err.message);
77
+ console.log(err.body);
78
+ console.log(err.rawResponse);
79
+ }
80
+ }
81
+ ```
82
+
83
+ ## Advanced
84
+
85
+ ### Additional Headers
86
+
87
+ If you would like to send additional headers as part of the request, use the `headers` request option.
88
+
89
+ ```typescript
90
+ import { FernPostmanClient } from "@fern-api/postman";
91
+
92
+ const client = new FernPostmanClient({
93
+ ...
94
+ headers: {
95
+ 'X-Custom-Header': 'custom value'
96
+ }
97
+ });
98
+
99
+ const response = await client.collection.publish(..., {
100
+ headers: {
101
+ 'X-Custom-Header': 'custom value'
102
+ }
103
+ });
104
+ ```
105
+
106
+ ### Additional Query String Parameters
107
+
108
+ If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
109
+
110
+ ```typescript
111
+ const response = await client.collection.publish(..., {
112
+ queryParams: {
113
+ 'customQueryParamKey': 'custom query param value'
114
+ }
115
+ });
116
+ ```
117
+
118
+ ### Retries
119
+
120
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
121
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
122
+ retry limit (default: 2).
123
+
124
+ A request is deemed retryable when any of the following HTTP status codes is returned:
125
+
126
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
127
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
128
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
129
+
130
+ Use the `maxRetries` request option to configure this behavior.
131
+
132
+ ```typescript
133
+ const response = await client.collection.publish(..., {
134
+ maxRetries: 0 // override maxRetries at the request level
135
+ });
136
+ ```
137
+
138
+ ### Timeouts
139
+
140
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
141
+
142
+ ```typescript
143
+ const response = await client.collection.publish(..., {
144
+ timeoutInSeconds: 30 // override timeout to 30s
145
+ });
146
+ ```
147
+
148
+ ### Aborting Requests
149
+
150
+ The SDK allows users to abort requests at any point by passing in an abort signal.
151
+
152
+ ```typescript
153
+ const controller = new AbortController();
154
+ const response = await client.collection.publish(..., {
155
+ abortSignal: controller.signal
156
+ });
157
+ controller.abort(); // aborts the request
158
+ ```
159
+
160
+ ### Access Raw Response Data
161
+
162
+ The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
163
+ The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
164
+
165
+ ```typescript
166
+ const { data, rawResponse } = await client.collection.publish(...).withRawResponse();
167
+
168
+ console.log(data);
169
+ console.log(rawResponse.headers['X-My-Header']);
170
+ ```
171
+
172
+ ### Logging
173
+
174
+ The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.
175
+
176
+ ```typescript
177
+ import { FernPostmanClient, logging } from "@fern-api/postman";
178
+
179
+ const client = new FernPostmanClient({
180
+ ...
181
+ logging: {
182
+ level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
183
+ logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
184
+ silent: false, // defaults to true, set to false to enable logging
185
+ }
186
+ });
187
+ ```
188
+ The `logging` object can have the following properties:
189
+ - `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
190
+ - `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
191
+ - `silent`: Whether to silence the logger. Defaults to `true`.
192
+
193
+ The `level` property can be one of the following values:
194
+ - `logging.LogLevel.Debug`
195
+ - `logging.LogLevel.Info`
196
+ - `logging.LogLevel.Warn`
197
+ - `logging.LogLevel.Error`
198
+
199
+ To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.
200
+
201
+ <details>
202
+ <summary>Custom logger examples</summary>
203
+
204
+ Here's an example using the popular `winston` logging library.
205
+ ```ts
206
+ import winston from 'winston';
207
+
208
+ const winstonLogger = winston.createLogger({...});
209
+
210
+ const logger: logging.ILogger = {
211
+ debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
212
+ info: (msg, ...args) => winstonLogger.info(msg, ...args),
213
+ warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
214
+ error: (msg, ...args) => winstonLogger.error(msg, ...args),
215
+ };
216
+ ```
217
+
218
+ Here's an example using the popular `pino` logging library.
219
+
220
+ ```ts
221
+ import pino from 'pino';
222
+
223
+ const pinoLogger = pino({...});
224
+
225
+ const logger: logging.ILogger = {
226
+ debug: (msg, ...args) => pinoLogger.debug(args, msg),
227
+ info: (msg, ...args) => pinoLogger.info(args, msg),
228
+ warn: (msg, ...args) => pinoLogger.warn(args, msg),
229
+ error: (msg, ...args) => pinoLogger.error(args, msg),
230
+ };
231
+ ```
232
+ </details>
233
+
234
+
235
+ ### Runtime Compatibility
236
+
237
+
238
+ The SDK works in the following runtimes:
239
+
240
+
241
+
242
+ - Node.js 18+
243
+ - Vercel
244
+ - Cloudflare Workers
245
+ - Deno v1.25+
246
+ - Bun 1.0+
247
+ - React Native
248
+
249
+ ### Customizing Fetch Client
250
+
251
+ The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
252
+ unsupported environment, this provides a way for you to break glass and ensure the SDK works.
253
+
254
+ ```typescript
255
+ import { FernPostmanClient } from "@fern-api/postman";
256
+
257
+ const client = new FernPostmanClient({
258
+ ...
259
+ fetcher: // provide your implementation here
260
+ });
261
+ ```
262
+
263
+ ## Contributing
264
+
265
+ While we value open-source contributions to this SDK, this library is generated programmatically.
266
+ Additions made directly to this library would have to be moved over to our generation code,
267
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
268
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
269
+ an issue first to discuss with us!
270
+
271
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,39 @@
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 BaseClientOptions = {
5
+ environment?: core.Supplier<environments.FernPostmanEnvironment | string>;
6
+ /** Specify a custom URL to connect the client to. */
7
+ baseUrl?: core.Supplier<string>;
8
+ /** Additional headers to include in requests. */
9
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
10
+ /** The default maximum time to wait for a response in seconds. */
11
+ timeoutInSeconds?: number;
12
+ /** The default number of times to retry the request. Defaults to 2. */
13
+ maxRetries?: number;
14
+ /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
15
+ fetch?: typeof fetch;
16
+ /** Configure logging for the client. */
17
+ logging?: core.logging.LogConfig | core.logging.Logger;
18
+ } & BearerAuthProvider.AuthOptions;
19
+ export interface BaseRequestOptions {
20
+ /** The maximum time to wait for a response in seconds. */
21
+ timeoutInSeconds?: number;
22
+ /** The number of times to retry the request. Defaults to 2. */
23
+ maxRetries?: number;
24
+ /** A hook to abort the request. */
25
+ abortSignal?: AbortSignal;
26
+ /** Additional query string parameters to include in the request. */
27
+ queryParams?: Record<string, unknown>;
28
+ /** Additional headers to include in the request. */
29
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
30
+ }
31
+ export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
32
+ logging: core.logging.Logger;
33
+ authProvider?: core.AuthProvider;
34
+ };
35
+ export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
36
+ authProvider: core.AuthProvider;
37
+ };
38
+ export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
39
+ export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
@@ -0,0 +1,62 @@
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": "@fern-api/postman",
46
+ "X-Fern-SDK-Version": "0.0.2",
47
+ "User-Agent": "@fern-api/postman/0.0.2",
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
+ const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
57
+ (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new BearerAuthProvider_js_1.BearerAuthProvider(normalizedWithNoOpAuthProvider));
58
+ return normalized;
59
+ }
60
+ function withNoOpAuthProvider(options) {
61
+ return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
62
+ }
@@ -0,0 +1,25 @@
1
+ import { CollectionClient } from "./api/resources/collection/client/Client.js";
2
+ import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
3
+ import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
4
+ import * as core from "./core/index.js";
5
+ export declare namespace FernPostmanClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class FernPostmanClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<FernPostmanClient.Options>;
12
+ protected _collection: CollectionClient | undefined;
13
+ constructor(options: FernPostmanClient.Options);
14
+ get collection(): CollectionClient;
15
+ /**
16
+ * Check endpoint to verify the API key is valid.
17
+ *
18
+ * @param {FernPostmanClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @example
21
+ * await client.check()
22
+ */
23
+ check(requestOptions?: FernPostmanClient.RequestOptions): core.HttpResponsePromise<void>;
24
+ private __check;
25
+ }
@@ -0,0 +1,103 @@
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.FernPostmanClient = void 0;
47
+ const Client_js_1 = require("./api/resources/collection/client/Client.js");
48
+ const BaseClient_js_1 = require("./BaseClient.js");
49
+ const headers_js_1 = require("./core/headers.js");
50
+ const core = __importStar(require("./core/index.js"));
51
+ const environments = __importStar(require("./environments.js"));
52
+ const handleNonStatusCodeError_js_1 = require("./errors/handleNonStatusCodeError.js");
53
+ const errors = __importStar(require("./errors/index.js"));
54
+ class FernPostmanClient {
55
+ constructor(options) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ get collection() {
59
+ var _a;
60
+ return ((_a = this._collection) !== null && _a !== void 0 ? _a : (this._collection = new Client_js_1.CollectionClient(this._options)));
61
+ }
62
+ /**
63
+ * Check endpoint to verify the API key is valid.
64
+ *
65
+ * @param {FernPostmanClient.RequestOptions} requestOptions - Request-specific configuration.
66
+ *
67
+ * @example
68
+ * await client.check()
69
+ */
70
+ check(requestOptions) {
71
+ return core.HttpResponsePromise.fromPromise(this.__check(requestOptions));
72
+ }
73
+ __check(requestOptions) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
77
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
78
+ const _response = yield core.fetcher({
79
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernPostmanEnvironment.Production, "/api/postman/check"),
80
+ method: "GET",
81
+ headers: _headers,
82
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
83
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
84
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
85
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
86
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
87
+ logging: this._options.logging,
88
+ });
89
+ if (_response.ok) {
90
+ return { data: undefined, rawResponse: _response.rawResponse };
91
+ }
92
+ if (_response.error.reason === "status-code") {
93
+ throw new errors.FernPostmanError({
94
+ statusCode: _response.error.statusCode,
95
+ body: _response.error.body,
96
+ rawResponse: _response.rawResponse,
97
+ });
98
+ }
99
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/api/postman/check");
100
+ });
101
+ }
102
+ }
103
+ exports.FernPostmanClient = FernPostmanClient;
@@ -0,0 +1 @@
1
+ export * from "./resources/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./resources/index.js"), exports);
@@ -0,0 +1,43 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as FernPostman from "../../../index.js";
5
+ export declare namespace CollectionClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class CollectionClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<CollectionClient.Options>;
12
+ constructor(options: CollectionClient.Options);
13
+ /**
14
+ * Returns the publishing status of the Postman collection as documentation.
15
+ *
16
+ * @param {FernPostman.CollectionId} collectionId
17
+ * @param {CollectionClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link FernPostman.CollectionDoesNotExistError}
20
+ *
21
+ * @example
22
+ * await client.collection.getStatus("collectionId")
23
+ */
24
+ getStatus(collectionId: FernPostman.CollectionId, requestOptions?: CollectionClient.RequestOptions): core.HttpResponsePromise<FernPostman.GetCollectionStatusResponse>;
25
+ private __getStatus;
26
+ /**
27
+ * Initiates a request to publish the Postman collection as a Fern documentation site.
28
+ *
29
+ * @param {FernPostman.CollectionId} collectionId
30
+ * @param {FernPostman.PublishCollectionRequest} request
31
+ * @param {CollectionClient.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @throws {@link FernPostman.CollectionDoesNotExistError}
34
+ *
35
+ * @example
36
+ * await client.collection.publish("collectionId", {
37
+ * userId: "userId",
38
+ * teamId: "teamId"
39
+ * })
40
+ */
41
+ publish(collectionId: FernPostman.CollectionId, request: FernPostman.PublishCollectionRequest, requestOptions?: CollectionClient.RequestOptions): core.HttpResponsePromise<void>;
42
+ private __publish;
43
+ }