File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ export class OneCLI {
4343 this . provisionClient = new ProvisionClient ( url , apiKey , timeout ) ;
4444 }
4545
46+ /**
47+ * Fetch the gateway skill markdown from OneCLI.
48+ */
49+ getGatewaySkill = ( ) : Promise < string > => {
50+ return this . containerClient . getGatewaySkill ( ) ;
51+ } ;
52+
4653 /**
4754 * Fetch the raw container configuration from OneCLI.
4855 */
Original file line number Diff line number Diff line change @@ -13,6 +13,41 @@ export class ContainerClient {
1313 this . timeout = timeout ;
1414 }
1515
16+ /**
17+ * Fetch the gateway skill markdown from OneCLI.
18+ */
19+ getGatewaySkill = async ( ) : Promise < string > => {
20+ const url = `${ this . baseUrl } /api/skill/gateway` ;
21+ try {
22+ const headers : Record < string , string > = { } ;
23+ if ( this . apiKey ) {
24+ headers [ "Authorization" ] = `Bearer ${ this . apiKey } ` ;
25+ }
26+
27+ const res = await fetch ( url , {
28+ headers,
29+ signal : AbortSignal . timeout ( this . timeout ) ,
30+ } ) ;
31+
32+ if ( ! res . ok ) {
33+ throw new OneCLIRequestError (
34+ `OneCLI returned ${ res . status } ${ res . statusText } ` ,
35+ { url, statusCode : res . status } ,
36+ ) ;
37+ }
38+
39+ return await res . text ( ) ;
40+ } catch ( error ) {
41+ if (
42+ error instanceof OneCLIError ||
43+ error instanceof OneCLIRequestError
44+ ) {
45+ throw error ;
46+ }
47+ throw toOneCLIError ( error ) ;
48+ }
49+ } ;
50+
1651 /**
1752 * Fetch the raw container configuration from OneCLI.
1853 */
You can’t perform that action at this time.
0 commit comments