Skip to content

Commit 7371e67

Browse files
release: 0.1.0-alpha.10 (#11)
* feat: add unwrapFile (#2) * release: 0.1.0-alpha.10 --------- Co-authored-by: CJ Quines <[email protected]> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 31c2bcd commit 7371e67

File tree

8 files changed

+40
-5
lines changed

8 files changed

+40
-5
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.9"
2+
".": "0.1.0-alpha.10"
33
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.1.0-alpha.10 (2025-07-02)
4+
5+
Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/stainless-api/stainless-api-typescript/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)
6+
7+
### Features
8+
9+
* add unwrapFile ([#2](https://github.com/stainless-api/stainless-api-typescript/issues/2)) ([75f71a2](https://github.com/stainless-api/stainless-api-typescript/commit/75f71a2486ef8db3c6c3c2684bf4edaba6fc758b))
10+
311
## 0.1.0-alpha.9 (2025-07-02)
412

513
Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/stainless-api/stainless-api-typescript/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stainless-api/sdk",
3-
"version": "0.1.0-alpha.9",
3+
"version": "0.1.0-alpha.10",
44
"description": "The official TypeScript library for the Stainless API",
55
"author": "Stainless <>",
66
"types": "dist/index.d.ts",

packages/mcp-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stainless-api/mcp",
3-
"version": "0.1.0-alpha.9",
3+
"version": "0.1.0-alpha.10",
44
"description": "The official MCP Server for the Stainless API",
55
"author": "Stainless <>",
66
"types": "dist/index.d.ts",

packages/mcp-server/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export { endpoints } from './tools';
2626
export const server = new McpServer(
2727
{
2828
name: 'stainless_api_sdk_api',
29-
version: '0.1.0-alpha.9',
29+
version: '0.1.0-alpha.10',
3030
},
3131
{
3232
capabilities: {

src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {
5555
parseLogLevel,
5656
} from './internal/utils/log';
5757
import { isEmptyObj } from './internal/utils/values';
58+
import { unwrapFile } from './lib/unwrap';
5859

5960
const environments = {
6061
production: 'https://api.stainless.com',
@@ -775,6 +776,7 @@ export class Stainless {
775776
static UnprocessableEntityError = Errors.UnprocessableEntityError;
776777

777778
static toFile = Uploads.toFile;
779+
static unwrapFile = unwrapFile;
778780

779781
projects: API.Projects = new API.Projects(this);
780782
builds: API.Builds = new API.Builds(this);

src/lib/unwrap.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Unwrap a file value from a union type, like the build object's `documented_spec`.
3+
*
4+
* @example
5+
* const build = await client.builds.retrieve(buildID);
6+
* const spec = await Stainless.unwrapFile(build.documented_spec);
7+
*/
8+
export async function unwrapFile(
9+
value: { type: 'content'; content: string } | { type: 'url'; url: string },
10+
): Promise<string>;
11+
export async function unwrapFile(
12+
value: { type: 'content'; content: string } | { type: 'url'; url: string } | null,
13+
): Promise<string | null>;
14+
export async function unwrapFile(
15+
value: { type: 'content'; content: string } | { type: 'url'; url: string } | null,
16+
): Promise<string | null> {
17+
if (value === null) {
18+
return null;
19+
}
20+
if (value.type === 'content') {
21+
return value.content;
22+
}
23+
const response = await fetch(value.url);
24+
return response.text();
25+
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '0.1.0-alpha.9'; // x-release-please-version
1+
export const VERSION = '0.1.0-alpha.10'; // x-release-please-version

0 commit comments

Comments
 (0)