File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed
Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1- configured_endpoints : 18
1+ configured_endpoints : 19
22openapi_spec_url : https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-b92143ddb16135de4ff65ce8bcdfe9991d11c73570f42f07ea27e0da86209a44.yml
33openapi_spec_hash : 16eb6e6c9687f01d2a791775b27dc315
4- config_hash : b3ca4ec5b02e5333af51ebc2e9fdef1b
4+ config_hash : b01d72cbe03bd762a73b05744086b2ec
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Methods:
1111- <code title =" post /v1/contexts " >client.contexts.<a href =" ./src/resources/contexts.ts " >create</a >({ ...params }) -> ContextCreateResponse</code >
1212- <code title =" get /v1/contexts/{id} " >client.contexts.<a href =" ./src/resources/contexts.ts " >retrieve</a >(id) -> Context</code >
1313- <code title =" put /v1/contexts/{id} " >client.contexts.<a href =" ./src/resources/contexts.ts " >update</a >(id) -> ContextUpdateResponse</code >
14+ - <code title =" delete /v1/contexts/{id} " >client.contexts.<a href =" ./src/resources/contexts.ts " >delete</a >(id) -> void</code >
1415
1516# Extensions
1617
Original file line number Diff line number Diff line change @@ -24,6 +24,16 @@ export class Contexts extends APIResource {
2424 update ( id : string , options ?: Core . RequestOptions ) : Core . APIPromise < ContextUpdateResponse > {
2525 return this . _client . put ( `/v1/contexts/${ id } ` , options ) ;
2626 }
27+
28+ /**
29+ * Delete Context
30+ */
31+ delete ( id : string , options ?: Core . RequestOptions ) : Core . APIPromise < void > {
32+ return this . _client . delete ( `/v1/contexts/${ id } ` , {
33+ ...options ,
34+ headers : { Accept : '*/*' , ...options ?. headers } ,
35+ } ) ;
36+ }
2737}
2838
2939export interface Context {
Original file line number Diff line number Diff line change @@ -55,4 +55,22 @@ describe('resource contexts', () => {
5555 Browserbase . NotFoundError ,
5656 ) ;
5757 } ) ;
58+
59+ test ( 'delete' , async ( ) => {
60+ const responsePromise = client . contexts . delete ( 'id' ) ;
61+ const rawResponse = await responsePromise . asResponse ( ) ;
62+ expect ( rawResponse ) . toBeInstanceOf ( Response ) ;
63+ const response = await responsePromise ;
64+ expect ( response ) . not . toBeInstanceOf ( Response ) ;
65+ const dataAndResponse = await responsePromise . withResponse ( ) ;
66+ expect ( dataAndResponse . data ) . toBe ( response ) ;
67+ expect ( dataAndResponse . response ) . toBe ( rawResponse ) ;
68+ } ) ;
69+
70+ test ( 'delete: request options instead of params are passed correctly' , async ( ) => {
71+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
72+ await expect ( client . contexts . delete ( 'id' , { path : '/_stainless_unknown_path' } ) ) . rejects . toThrow (
73+ Browserbase . NotFoundError ,
74+ ) ;
75+ } ) ;
5876} ) ;
You can’t perform that action at this time.
0 commit comments