@stainless-api/docs 0.1.0-beta.99 → 1.0.0-beta.140

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 (136) hide show
  1. package/CHANGELOG.md +390 -0
  2. package/ambient.d.ts +6 -0
  3. package/eslint-suppressions.json +22 -6
  4. package/{eslint.config.js → eslint.config.ts} +1 -7
  5. package/package.json +57 -40
  6. package/plugin/buildAlgoliaIndex.ts +6 -12
  7. package/plugin/components/SDKSelect.astro +0 -6
  8. package/plugin/components/SnippetCode.tsx +6 -37
  9. package/plugin/components/search/SearchAlgolia.astro +1 -1
  10. package/plugin/components/search/SearchIsland.tsx +19 -13
  11. package/plugin/generateAPIReferenceLink.ts +0 -40
  12. package/plugin/globalJs/ai-dropdown-options.ts +22 -9
  13. package/plugin/globalJs/code-snippets.ts +5 -5
  14. package/plugin/globalJs/copy.ts +20 -91
  15. package/plugin/globalJs/navigation.ts +13 -13
  16. package/plugin/globalJs/summary-selection-tweak.ts +29 -0
  17. package/plugin/index.ts +107 -163
  18. package/plugin/loadPluginConfig.ts +49 -151
  19. package/plugin/markdown/highlighter.ts +100 -0
  20. package/plugin/markdown/index.ts +39 -0
  21. package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +2 -0
  22. package/plugin/react/Routing.tsx +10 -244
  23. package/plugin/referencePlaceholderUtils.ts +1 -1
  24. package/plugin/replaceSidebarPlaceholderMiddleware.ts +1 -1
  25. package/plugin/routes/Docs.astro +3 -1
  26. package/plugin/routes/Overview.astro +14 -7
  27. package/plugin/routes/llms.ts +186 -0
  28. package/plugin/routes/markdown.ts +62 -13
  29. package/plugin/sidebar-utils/sidebar-builder.ts +38 -12
  30. package/plugin/specs/defaultSpecLoader.ts +192 -0
  31. package/plugin/specs/fetchSpecSSR.ts +1 -1
  32. package/plugin/specs/utils.ts +86 -0
  33. package/shared/conditionalIntegration.ts +28 -0
  34. package/shared/getProsePages.ts +6 -7
  35. package/shared/virtualModule.ts +1 -26
  36. package/stl-docs/aiChatExamples.ts +31 -0
  37. package/stl-docs/chat/docs-chat-handler.ts +17 -0
  38. package/stl-docs/chat/hook.ts +225 -0
  39. package/stl-docs/chat/schemas.ts +27 -0
  40. package/stl-docs/chat/ui/AiChat.module.css +591 -0
  41. package/stl-docs/chat/ui/AiChat.tsx +175 -0
  42. package/stl-docs/chat/ui/Trigger.tsx +154 -0
  43. package/stl-docs/chat/ui/components/ChatControls.tsx +51 -0
  44. package/stl-docs/chat/ui/components/ChatEmpty.tsx +42 -0
  45. package/stl-docs/chat/ui/components/ChatLog.tsx +93 -0
  46. package/stl-docs/chat/ui/components/ChatMessage.tsx +47 -0
  47. package/stl-docs/chat/ui/components/CodeBlock.tsx +33 -0
  48. package/stl-docs/chat/ui/components/MessageFeedback.tsx +106 -0
  49. package/stl-docs/chat/ui/components/Table.tsx +15 -0
  50. package/stl-docs/chat/ui/components/ToolCall.tsx +34 -0
  51. package/stl-docs/chat/ui/components/hljs-github.css +81 -0
  52. package/stl-docs/chat/ui/scroll-manager.ts +86 -0
  53. package/stl-docs/chat/ui/types.ts +45 -0
  54. package/stl-docs/components/AiChatIsland.tsx +10 -12
  55. package/stl-docs/components/ContentPanel.astro +9 -0
  56. package/stl-docs/components/Footer.astro +89 -0
  57. package/stl-docs/components/Header.astro +0 -5
  58. package/stl-docs/components/PageFrame.astro +23 -8
  59. package/stl-docs/components/PageSidebar.astro +11 -0
  60. package/stl-docs/components/StainlessLogo.svg +4 -0
  61. package/stl-docs/components/TwoColumnContent.astro +2 -0
  62. package/stl-docs/components/headers/DefaultHeader.astro +6 -8
  63. package/stl-docs/components/headers/StackedHeader.astro +5 -53
  64. package/stl-docs/components/mintlify-compat/Accordion.astro +2 -2
  65. package/stl-docs/components/mintlify-compat/AccordionGroup.astro +0 -4
  66. package/stl-docs/components/mintlify-compat/Columns.astro +2 -2
  67. package/stl-docs/components/mintlify-compat/Frame.astro +2 -2
  68. package/stl-docs/components/mintlify-compat/Tab.astro +2 -2
  69. package/stl-docs/components/mintlify-compat/callouts/Callout.astro +2 -2
  70. package/stl-docs/components/mintlify-compat/callouts/Check.astro +0 -4
  71. package/stl-docs/components/mintlify-compat/callouts/Danger.astro +0 -4
  72. package/stl-docs/components/mintlify-compat/callouts/Info.astro +0 -4
  73. package/stl-docs/components/mintlify-compat/callouts/Note.astro +0 -4
  74. package/stl-docs/components/mintlify-compat/callouts/Tip.astro +0 -4
  75. package/stl-docs/components/mintlify-compat/callouts/Warning.astro +0 -4
  76. package/stl-docs/components/nav-tabs/NavDropdown.astro +12 -7
  77. package/stl-docs/components/nav-tabs/NavTabs.astro +5 -3
  78. package/stl-docs/components/nav-tabs/buildNavLinks.ts +2 -0
  79. package/stl-docs/components/pagination/Pagination.astro +4 -2
  80. package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +2 -2
  81. package/stl-docs/components/pagination/PaginationLinkQuiet.astro +2 -2
  82. package/stl-docs/components/pagination/util.ts +3 -3
  83. package/stl-docs/components/sidebars/BaseSidebar.astro +72 -1
  84. package/stl-docs/disableCalloutSyntax.ts +1 -1
  85. package/stl-docs/fonts.ts +5 -5
  86. package/stl-docs/index.ts +76 -53
  87. package/stl-docs/loadStlDocsConfig.ts +38 -8
  88. package/stl-docs/og-image/components/OpenGraphFunctionSignature.tsx +64 -0
  89. package/stl-docs/og-image/components/OpenGraphImage.tsx +126 -0
  90. package/stl-docs/og-image/config.ts +56 -0
  91. package/stl-docs/og-image/image-gen/generate-api-reference-og-image.tsx +188 -0
  92. package/stl-docs/og-image/image-gen/generate-og-image.tsx +119 -0
  93. package/stl-docs/og-image/image-gen/get-logo-url.ts +47 -0
  94. package/stl-docs/og-image/index.ts +135 -0
  95. package/stl-docs/og-image/routes/add-og-image.ts +45 -0
  96. package/stl-docs/og-image/routes/get-api-reference-og-image.ts +36 -0
  97. package/stl-docs/og-image/routes/get-og-image.ts +28 -0
  98. package/stl-docs/og-image/theme.ts +43 -0
  99. package/stl-docs/og-image/utils.ts +14 -0
  100. package/stl-docs/proseDocSync.test.ts +74 -0
  101. package/stl-docs/proseDocSync.ts +344 -0
  102. package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +4 -12
  103. package/stl-docs/schema-extension.ts +12 -0
  104. package/stl-docs/tabsMiddleware.ts +1 -1
  105. package/styles/overrides.css +2 -14
  106. package/styles/page.css +210 -71
  107. package/styles/sidebar.css +30 -17
  108. package/styles/sl-variables.css +3 -8
  109. package/styles/stldocs-variables.css +2 -2
  110. package/styles/toc.css +8 -0
  111. package/tsconfig.json +1 -1
  112. package/virtual-module.d.ts +35 -11
  113. package/playground-virtual-modules.d.ts +0 -96
  114. package/plugin/globalJs/create-playground.shim.ts +0 -3
  115. package/plugin/globalJs/playground-data.shim.ts +0 -1
  116. package/plugin/globalJs/playground-data.ts +0 -14
  117. package/plugin/specs/FileCache.ts +0 -99
  118. package/plugin/specs/generateSpec.ts +0 -112
  119. package/plugin/specs/index.ts +0 -132
  120. package/plugin/specs/inputResolver.ts +0 -146
  121. package/plugin/specs/worker.ts +0 -199
  122. package/plugin/vendor/preview.worker.docs.js +0 -26108
  123. package/plugin/vendor/templates/cli.md +0 -1
  124. package/plugin/vendor/templates/go.md +0 -316
  125. package/plugin/vendor/templates/java.md +0 -89
  126. package/plugin/vendor/templates/kotlin.md +0 -89
  127. package/plugin/vendor/templates/node.md +0 -235
  128. package/plugin/vendor/templates/python.md +0 -251
  129. package/plugin/vendor/templates/ruby.md +0 -147
  130. package/plugin/vendor/templates/terraform.md +0 -60
  131. package/plugin/vendor/templates/typescript.md +0 -319
  132. package/scripts/vendor_deps.ts +0 -50
  133. package/stl-docs/components/ClientRouterHead.astro +0 -41
  134. package/stl-docs/components/content-panel/ContentPanel.astro +0 -42
  135. package/stl-docs/components/headers/SplashMobileMenuToggle.astro +0 -65
  136. package/stl-docs/proseSearchIndexing.ts +0 -606
@@ -1,235 +0,0 @@
1
- # SDK_PackageTitle API Library
2
-
3
- [![NPM version](https://img.shields.io/npm/v/SDK_NPMPackage.svg)](https://npmjs.org/package/SDK_NPMPackage) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/SDK_NPMPackage)SDK_JSRShield
4
-
5
- SDK_ReadmeOpening
6
-
7
- SDK_ScreencastURL
8
-
9
- SDK_DocumentationReference
10
-
11
- SDK_GeneratedByStainless
12
-
13
- SDK_MCPReadmeSection
14
-
15
- ## Installation
16
-
17
- SDK_NPMInstallInstructions
18
-
19
- SDK_JSRInstallation
20
-
21
- ## Usage
22
-
23
- SDK_APIReference
24
-
25
- <!-- prettier-ignore -->
26
- ```js
27
- SDK_Usage
28
- ```
29
-
30
- SDK_StreamingUsage
31
-
32
- ### Request & Response types
33
-
34
- This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
35
-
36
- <!-- prettier-ignore -->
37
- ```ts
38
- SDK_TypeScriptUsage
39
- ```
40
-
41
- Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
42
-
43
- SDK_FileUploadsUsage
44
-
45
- SDK_BinaryUploadsUsage
46
-
47
- ## Handling errors
48
-
49
- When the library is unable to connect to the API,
50
- or if the API returns a non-success status code (i.e., 4xx or 5xx response),
51
- a subclass of `APIError` will be thrown:
52
-
53
- <!-- prettier-ignore -->
54
- ```ts
55
- SDK_ErrorsExample
56
- ```
57
-
58
- Error codes are as follows:
59
-
60
- | Status Code | Error Type |
61
- | ----------- | -------------------------- |
62
- | 400 | `BadRequestError` |
63
- | 401 | `AuthenticationError` |
64
- | 403 | `PermissionDeniedError` |
65
- | 404 | `NotFoundError` |
66
- | 422 | `UnprocessableEntityError` |
67
- | 429 | `RateLimitError` |
68
- | >=500 | `InternalServerError` |
69
- | N/A | `APIConnectionError` |
70
-
71
- ### Retries
72
-
73
- Certain errors will be automatically retried SDK_DefaultMaxRetries times by default, with a short exponential backoff.
74
- Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
75
- 429 Rate Limit, and >=500 Internal errors will all be retried by default.
76
-
77
- You can use the `maxRetries` option to configure or disable this:
78
-
79
- <!-- prettier-ignore -->
80
- ```js
81
- SDK_RetriesExample
82
- ```
83
-
84
- ### Timeouts
85
-
86
- Requests time out after SDK_HumanReadableDefaultTimeout by default. You can configure this with a `timeout` option:
87
-
88
- <!-- prettier-ignore -->
89
- ```ts
90
- SDK_TimeoutsExample
91
- ```
92
-
93
- On timeout, an `APIConnectionTimeoutError` is thrown.
94
-
95
- Note that requests which time out will be [retried twice by default](#retries).
96
-
97
- SDK_Pagination
98
-
99
- SDK_DefaultHeaders
100
-
101
- ## Advanced Usage
102
-
103
- ### Accessing raw Response data (e.g., headers)
104
-
105
- The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
106
-
107
- You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
108
-
109
- <!-- prettier-ignore -->
110
- ```ts
111
- SDK_RawResponseExample
112
- ```
113
-
114
- ### Making custom/undocumented requests
115
-
116
- This library is typed for convenient access to the documented API. If you need to access undocumented
117
- endpoints, params, or response properties, the library can still be used.
118
-
119
- #### Undocumented endpoints
120
-
121
- To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
122
- Options on the client, such as retries, will be respected when making these requests.
123
-
124
- ```ts
125
- await SDK_ClientName.post('/some/path', {
126
- body: { some_prop: 'foo' },
127
- query: { some_query_arg: 'bar' },
128
- });
129
- ```
130
-
131
- #### Undocumented request params
132
-
133
- To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
134
- parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
135
- send will be sent as-is.
136
-
137
- ```ts
138
- SDK_ClientName.foo.create({
139
- foo: 'my_param',
140
- bar: 12,
141
- // @ts-expect-error baz is not yet public
142
- baz: 'undocumented option',
143
- });
144
- ```
145
-
146
- For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
147
- extra param in the body.
148
-
149
- If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
150
- options.
151
-
152
- #### Undocumented response properties
153
-
154
- To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
155
- the response object, or cast the response object to the requisite type. Like the request params, we do not
156
- validate or strip extra properties from the response from the API.
157
-
158
- ### Customizing the fetch client
159
-
160
- By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.
161
-
162
- If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
163
- (for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
164
- add the following import before your first import `from "SDK_PackageName"`:
165
-
166
- ```ts
167
- // Tell TypeScript and the package to use the global web fetch instead of node-fetch.
168
- // Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
169
- import 'SDK_NPMPackage/shims/web';
170
- import SDK_PackageName from 'SDK_NPMPackage';
171
- ```
172
-
173
- To do the inverse, add `import "SDK_NPMPackage/shims/node"` (which does import polyfills).
174
- This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](SDK_RepoCodeURL/src/_shims#readme)).
175
-
176
- ### Logging and middleware
177
-
178
- You may also provide a custom `fetch` function when instantiating the client,
179
- which can be used to inspect or alter the `Request` or `Response` before/after each request:
180
-
181
- ```ts
182
- import { fetch } from 'undici'; // as one example
183
- import SDK_PackageName from 'SDK_NPMPackage';
184
-
185
- const SDK_ClientName = new SDK_PackageName({
186
- fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
187
- console.log('About to make a request', url, init);
188
- const response = await fetch(url, init);
189
- console.log('Got response', response);
190
- return response;
191
- },
192
- });
193
- ```
194
-
195
- Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically.
196
- This is intended for debugging purposes only and may change in the future without notice.
197
-
198
- ### Configuring an HTTP(S) Agent (e.g., for proxies)
199
-
200
- By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
201
-
202
- If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
203
-
204
- <!-- prettier-ignore -->
205
- ```ts
206
- SDK_HTTPAgentExample
207
- ```
208
-
209
- ## Semantic versioning
210
-
211
- This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
212
-
213
- 1. Changes that only affect static types, without breaking runtime behavior.
214
- 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
215
- 3. Changes that we do not expect to impact the vast majority of users in practice.
216
-
217
- We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
218
-
219
- We are keen for your feedback; please open an [issue](SDK_RepoURL/issues) with questions, bugs, or suggestions.
220
-
221
- ## Requirements
222
-
223
- TypeScript >= 4.5 is supported.
224
-
225
- The following runtimes are supported:
226
-
227
- SDK_SupportedRuntimes
228
-
229
- Note that React Native is not supported at this time.
230
-
231
- If you are interested in other runtime environments, please open or upvote an issue on GitHub.
232
-
233
- ## Contributing
234
-
235
- See [the contributing documentation](./CONTRIBUTING.md).
@@ -1,251 +0,0 @@
1
- # SDK_PackageTitle API library
2
-
3
- <!-- prettier-ignore -->
4
- [![PyPI version](https://img.shields.io/pypi/v/SDK_PythonPackageName.svg?label=pypi%20(stable))](https://pypi.org/project/SDK_PythonPackageName/)
5
-
6
- SDK_ReadmeOpening
7
-
8
- SDK_ScreencastURL
9
-
10
- SDK_GeneratedByStainless
11
-
12
- SDK_MCPReadmeSection
13
-
14
- ## Documentation
15
-
16
- SDK_DocumentationCallout SDK_APIReferenceCallout
17
-
18
- ## Installation
19
-
20
- SDK_PythonPackageInstallInstructions
21
-
22
- ## Usage
23
-
24
- SDK_APIReferenceCallout
25
-
26
- ```python
27
- SDK_Usage
28
- ```
29
-
30
- SDK_AuthenticationDocs
31
-
32
- ## Async usage
33
-
34
- Simply import `SDK_AsyncPackageClassName` instead of `SDK_PackageClassName` and use `await` with each API call:
35
-
36
- ```python
37
- SDK_AsyncUsage
38
- ```
39
-
40
- Functionality between the synchronous and asynchronous clients is otherwise identical.
41
-
42
- ### With aiohttp
43
-
44
- By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
45
-
46
- You can enable this by installing `aiohttp`:
47
-
48
- SDK_AioHttpInstallDocs
49
-
50
- Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
51
-
52
- ```python
53
- SDK_AioHttpUsage
54
- ```
55
-
56
- SDK_StreamingUsage
57
-
58
- ## Using types
59
-
60
- Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
61
-
62
- - Serializing back into JSON, `model.to_json()`
63
- - Converting to a dictionary, `model.to_dict()`
64
-
65
- Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
66
-
67
- SDK_Pagination
68
-
69
- SDK_NestedParams
70
-
71
- SDK_FileUploadsUsage
72
-
73
- ## Handling errors
74
-
75
- When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `SDK_PackageImportName.APIConnectionError` is raised.
76
-
77
- When the API returns a non-success status code (that is, 4xx or 5xx
78
- response), a subclass of `SDK_PackageImportName.APIStatusError` is raised, containing `status_code` and `response` properties.
79
-
80
- All errors inherit from `SDK_PackageImportName.APIError`.
81
-
82
- ```python
83
- SDK_ErrorsExample
84
- ```
85
-
86
- Error codes are as follows:
87
-
88
- | Status Code | Error Type |
89
- | ----------- | -------------------------- |
90
- | 400 | `BadRequestError` |
91
- | 401 | `AuthenticationError` |
92
- | 403 | `PermissionDeniedError` |
93
- | 404 | `NotFoundError` |
94
- | 422 | `UnprocessableEntityError` |
95
- | 429 | `RateLimitError` |
96
- | >=500 | `InternalServerError` |
97
- | N/A | `APIConnectionError` |
98
-
99
- ### Retries
100
-
101
- Certain errors are automatically retried SDK_DefaultMaxRetries times by default, with a short exponential backoff.
102
- Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
103
- 429 Rate Limit, and >=500 Internal errors are all retried by default.
104
-
105
- You can use the `max_retries` option to configure or disable retry settings:
106
-
107
- ```python
108
- SDK_RetriesExample
109
- ```
110
-
111
- ### Timeouts
112
-
113
- By default requests time out after SDK_HumanReadableDefaultTimeout. You can configure this with a `timeout` option,
114
- which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
115
-
116
- ```python
117
- SDK_TimeoutsExample
118
- ```
119
-
120
- On timeout, an `APITimeoutError` is thrown.
121
-
122
- Note that requests that time out are [retried twice by default](#retries).
123
-
124
- SDK_DefaultHeaders
125
-
126
- ## Advanced
127
-
128
- ### Logging
129
-
130
- We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
131
-
132
- You can enable logging by setting the environment variable `SDK_PackageLoggingEnvVar` to `info`.
133
-
134
- ```shell
135
- $ export SDK_PackageLoggingEnvVar=info
136
- ```
137
-
138
- Or to `debug` for more verbose logging.
139
-
140
- ### How to tell whether `None` means `null` or missing
141
-
142
- In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
143
-
144
- ```py
145
- if response.my_field is None:
146
- if 'my_field' not in response.model_fields_set:
147
- print('Got json like {}, without a "my_field" key present at all.')
148
- else:
149
- print('Got json like {"my_field": null}.')
150
- ```
151
-
152
- ### Accessing raw response data (e.g. headers)
153
-
154
- The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
155
-
156
- ```py
157
- SDK_RawResponseExample
158
- ```
159
-
160
- SDK_WithStreamingResponseReadme
161
-
162
- ### Making custom/undocumented requests
163
-
164
- This library is typed for convenient access to the documented API.
165
-
166
- If you need to access undocumented endpoints, params, or response properties, the library can still be used.
167
-
168
- #### Undocumented endpoints
169
-
170
- To make requests to undocumented endpoints, you can make requests using `SDK_ClientName.get`, `SDK_ClientName.post`, and other
171
- http verbs. Options on the client will be respected (such as retries) when making this request.
172
-
173
- ```py
174
- import httpx
175
-
176
- response = SDK_ClientName.post(
177
- "/foo",
178
- cast_to=httpx.Response,
179
- body={"my_param": True},
180
- )
181
-
182
- print(response.headers.get("x-foo"))
183
- ```
184
-
185
- #### Undocumented request params
186
-
187
- If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
188
- options.
189
-
190
- #### Undocumented response properties
191
-
192
- To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
193
- can also get all the extra fields on the Pydantic model as a dict with
194
- [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
195
-
196
- ### Configuring the HTTP client
197
-
198
- You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
199
-
200
- - Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
201
- - Custom [transports](https://www.python-httpx.org/advanced/transports/)
202
- - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
203
-
204
- ```python
205
- SDK_CustomHTTPClientExample
206
- ```
207
-
208
- You can also customize the client on a per-request basis by using `with_options()`:
209
-
210
- ```python
211
- SDK_ClientName.with_options(http_client=DefaultHttpxClient(...))
212
- ```
213
-
214
- ### Managing HTTP resources
215
-
216
- By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
217
-
218
- ```py
219
- SDK_HTTPClientManagementExample
220
- ```
221
-
222
- ## Versioning
223
-
224
- This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
225
-
226
- 1. Changes that only affect static types, without breaking runtime behavior.
227
- 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
228
- 3. Changes that we do not expect to impact the vast majority of users in practice.
229
-
230
- We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
231
-
232
- We are keen for your feedback; please open an [issue](SDK_RepoURL/issues) with questions, bugs, or suggestions.
233
-
234
- ### Determining the installed version
235
-
236
- If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
237
-
238
- You can determine the version that is being used at runtime with:
239
-
240
- ```py
241
- import SDK_PythonPackageImportName
242
- print(SDK_PythonPackageImportName.__version__)
243
- ```
244
-
245
- ## Requirements
246
-
247
- Python 3.9 or higher.
248
-
249
- ## Contributing
250
-
251
- See [the contributing documentation](./CONTRIBUTING.md).
@@ -1,147 +0,0 @@
1
- # SDK_PackageTitle API library
2
-
3
- SDK_ReadmeOpening It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](SDK_RepoURL#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
-
5
- SDK_ScreencastURL
6
-
7
- SDK_GeneratedByStainless
8
-
9
- SDK_MCPReadmeSection
10
-
11
- ## Documentation
12
-
13
- Documentation for releases of this gem can be found [on RubyDoc](SDK_RubyDocInfoURL).
14
-
15
- SDK_DocumentationCallout
16
-
17
- SDK_Installation
18
-
19
- SDK_Usage
20
-
21
- SDK_StreamingUsage
22
-
23
- SDK_Pagination
24
-
25
- SDK_FileUploadsUsage
26
-
27
- ### Handling errors
28
-
29
- When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `SDK_ModuleName::Errors::APIError` will be thrown:
30
-
31
- ```ruby
32
- SDK_ErrorsExample
33
- ```
34
-
35
- Error codes are as follows:
36
-
37
- SDK_ErrorsTable
38
-
39
- ### Retries
40
-
41
- Certain errors will be automatically retried SDK_DefaultMaxRetries times by default, with a short exponential backoff.
42
-
43
- Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.
44
-
45
- You can use the `max_retries` option to configure or disable this:
46
-
47
- ```ruby
48
- SDK_RetriesExample
49
- ```
50
-
51
- ### Timeouts
52
-
53
- By default, requests will time out after SDK_DefaultTimeoutInSeconds seconds. You can use the timeout option to configure or disable this:
54
-
55
- ```ruby
56
- SDK_TimeoutsExample
57
- ```
58
-
59
- On timeout, `SDK_ModuleName::Errors::APITimeoutError` is raised.
60
-
61
- Note that requests that time out are retried by default.
62
-
63
- ## Advanced concepts
64
-
65
- ### BaseModel
66
-
67
- All parameter and response objects inherit from `SDK_ModuleName::Internal::Type::BaseModel`, which provides several conveniences, including:
68
-
69
- 1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.
70
-
71
- 2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
72
-
73
- 3. Both instances and the classes themselves can be pretty-printed.
74
-
75
- 4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.
76
-
77
- ### Making custom or undocumented requests
78
-
79
- #### Undocumented properties
80
-
81
- You can send undocumented parameters to any endpoint, and read undocumented response properties, like so:
82
-
83
- Note: the `extra_` parameters of the same name overrides the documented parameters.
84
-
85
- ```ruby
86
- SDK_UndocumentedProperties
87
- ```
88
-
89
- #### Undocumented request params
90
-
91
- If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.
92
-
93
- #### Undocumented endpoints
94
-
95
- To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:
96
-
97
- ```ruby
98
- response = client.request(
99
- method: :post,
100
- path: '/undocumented/endpoint',
101
- query: {"dog": "woof"},
102
- headers: {"useful-header": "interesting-value"},
103
- body: {"hello": "world"}
104
- )
105
- ```
106
-
107
- ### Concurrency & connection pooling
108
-
109
- The `SDK_ModuleName::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.
110
-
111
- Each instance of `SDK_ModuleName::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.
112
-
113
- When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.
114
-
115
- Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.
116
-
117
- ## Sorbet
118
-
119
- This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.
120
-
121
- You can provide typesafe request parameters like so:
122
-
123
- ```ruby
124
- SDK_SorbetParamPassing
125
- ```
126
-
127
- Or, equivalently:
128
-
129
- ```ruby
130
- SDK_SorbetParamTrick
131
- ```
132
-
133
- SDK_SorbetEnums
134
-
135
- ## Versioning
136
-
137
- This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
138
-
139
- This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
140
-
141
- ## Requirements
142
-
143
- Ruby SDK_RubyMinVersion or higher.
144
-
145
- ## Contributing
146
-
147
- See [the contributing documentation](SDK_RepoAssetURL/CONTRIBUTING.md).
@@ -1,60 +0,0 @@
1
- # SDK_PackageTitle Provider
2
-
3
- The [SDK_PackageTitle provider](SDK_TerraformDocumentationUrl) provides convenient access to
4
- the SDK_RestAPIName from Terraform.
5
-
6
- SDK_GeneratedByStainless
7
-
8
- ## Requirements
9
-
10
- This provider requires Terraform CLI 1.0 or later. You can [install it for your system](https://developer.hashicorp.com/terraform/install)
11
- on Hashicorp's website.
12
-
13
- ## Usage
14
-
15
- Add the following to your `main.tf` file:
16
-
17
- SDK_ReleasePleaseMarkdownBlockStart
18
-
19
- ```hcl
20
- # Declare the provider and version
21
- terraform {
22
- required_providers {
23
- SDK_ProviderTypeName = {
24
- source = "SDK_ProviderImportPath"
25
- version = "~> SDK_Version"
26
- }
27
- }
28
- }
29
-
30
- # Initialize the provider
31
- SDK_ProviderExample
32
-
33
- # Configure a resource
34
- SDK_ResourceExample
35
- ```
36
-
37
- SDK_ReleasePleaseMarkdownBlockEnd
38
-
39
- Initialize your project by running `terraform init` in the directory.
40
-
41
- Additional examples can be found in the [./examples](./examples) folder within this repository, and you can
42
- refer to the full documentation on [the Terraform Registry](SDK_TerraformDocumentationUrl).
43
-
44
- SDK_ConfigOptionsSection
45
-
46
-
47
- ## Semantic versioning
48
-
49
- This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
50
-
51
- 1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
52
- 2. Changes that we do not expect to impact the vast majority of users in practice.
53
-
54
- We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
55
-
56
- We are keen for your feedback; please open an [issue](SDK_RepoURL/issues) with questions, bugs, or suggestions.
57
-
58
- ## Contributing
59
-
60
- See [the contributing documentation](./CONTRIBUTING.md).