File tree Expand file tree Collapse file tree 8 files changed +40
-5
lines changed
Expand file tree Collapse file tree 8 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 11{
2- "." : " 0.1.0-alpha.9 "
2+ "." : " 0.1.0-alpha.10 "
33}
Original file line number Diff line number Diff line change 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
513Full 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 )
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export { endpoints } from './tools';
2626export 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 : {
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ import {
5555 parseLogLevel ,
5656} from './internal/utils/log' ;
5757import { isEmptyObj } from './internal/utils/values' ;
58+ import { unwrapFile } from './lib/unwrap' ;
5859
5960const 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 ) ;
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments