-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): update via SDK Studio (#333)
- Loading branch information
1 parent
c3f1288
commit 94c67b4
Showing
13 changed files
with
359 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
configured_endpoints: 1256 | ||
configured_endpoints: 1259 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from 'cloudflare/resource'; | ||
import * as R2API from 'cloudflare/resources/event-notifications/r2/r2'; | ||
|
||
export class EventNotifications extends APIResource { | ||
r2: R2API.R2 = new R2API.R2(this._client); | ||
} | ||
|
||
export namespace EventNotifications { | ||
export import R2 = R2API.R2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
export { EventNotifications } from './event-notifications'; | ||
export { R2 } from './r2/index'; |
82 changes: 82 additions & 0 deletions
82
src/resources/event-notifications/r2/configuration/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import * as Core from 'cloudflare/core'; | ||
import { APIResource } from 'cloudflare/resource'; | ||
import * as ConfigurationAPI from 'cloudflare/resources/event-notifications/r2/configuration/configuration'; | ||
import * as QueuesAPI from 'cloudflare/resources/event-notifications/r2/configuration/queues'; | ||
|
||
export class Configuration extends APIResource { | ||
queues: QueuesAPI.Queues = new QueuesAPI.Queues(this._client); | ||
|
||
/** | ||
* Returns all notification rules for each queue for which bucket notifications are | ||
* produced. | ||
*/ | ||
get( | ||
bucketName: string, | ||
params: ConfigurationGetParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<ConfigurationGetResponse> { | ||
const { account_id } = params; | ||
return ( | ||
this._client.get( | ||
`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration`, | ||
options, | ||
) as Core.APIPromise<{ result: ConfigurationGetResponse }> | ||
)._thenUnwrap((obj) => obj.result); | ||
} | ||
} | ||
|
||
export type ConfigurationGetResponse = Record<string, Record<string, ConfigurationGetResponse.mq_detail>>; | ||
|
||
export namespace ConfigurationGetResponse { | ||
export interface mq_detail { | ||
/** | ||
* Queue ID that will receive notifications based on the configured rules | ||
*/ | ||
queue: string; | ||
|
||
/** | ||
* Array of rules to drive notifications | ||
*/ | ||
rules: Array<mq_detail.Rule>; | ||
} | ||
|
||
export namespace mq_detail { | ||
export interface Rule { | ||
/** | ||
* Array of R2 object actions that will trigger notifications | ||
*/ | ||
actions: Array< | ||
'PutObject' | 'CopyObject' | 'DeleteObject' | 'CompleteMultipartUpload' | 'AbortMultipartUpload' | ||
>; | ||
|
||
/** | ||
* Notifications will be sent only for objects with this prefix | ||
*/ | ||
prefix?: string; | ||
|
||
/** | ||
* Notifications will be sent only for objects with this suffix | ||
*/ | ||
suffix?: string; | ||
} | ||
} | ||
} | ||
|
||
export interface ConfigurationGetParams { | ||
/** | ||
* Identifier | ||
*/ | ||
account_id: string; | ||
} | ||
|
||
export namespace Configuration { | ||
export import ConfigurationGetResponse = ConfigurationAPI.ConfigurationGetResponse; | ||
export import ConfigurationGetParams = ConfigurationAPI.ConfigurationGetParams; | ||
export import Queues = QueuesAPI.Queues; | ||
export import QueueUpdateResponse = QueuesAPI.QueueUpdateResponse; | ||
export import QueueDeleteResponse = QueuesAPI.QueueDeleteResponse; | ||
export import QueueUpdateParams = QueuesAPI.QueueUpdateParams; | ||
export import QueueDeleteParams = QueuesAPI.QueueDeleteParams; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/resources/event-notifications/r2/configuration/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
export { ConfigurationGetResponse, ConfigurationGetParams, Configuration } from './configuration'; | ||
export { | ||
QueueUpdateResponse, | ||
QueueDeleteResponse, | ||
QueueUpdateParams, | ||
QueueDeleteParams, | ||
Queues, | ||
} from './queues'; |
98 changes: 98 additions & 0 deletions
98
src/resources/event-notifications/r2/configuration/queues.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import * as Core from 'cloudflare/core'; | ||
import { APIResource } from 'cloudflare/resource'; | ||
import * as QueuesAPI from 'cloudflare/resources/event-notifications/r2/configuration/queues'; | ||
|
||
export class Queues extends APIResource { | ||
/** | ||
* Define the rules for a given queue which will determine event notification | ||
* production. | ||
*/ | ||
update( | ||
bucketName: string, | ||
queueId: string, | ||
params: QueueUpdateParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<QueueUpdateResponse> { | ||
const { account_id, ...body } = params; | ||
return ( | ||
this._client.put( | ||
`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, | ||
{ body, ...options }, | ||
) as Core.APIPromise<{ result: QueueUpdateResponse }> | ||
)._thenUnwrap((obj) => obj.result); | ||
} | ||
|
||
/** | ||
* Turn off all event notifications configured for delivery to a given queue. No | ||
* further notifications will be produced for the queue once complete. | ||
*/ | ||
delete( | ||
bucketName: string, | ||
queueId: string, | ||
params: QueueDeleteParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<QueueDeleteResponse> { | ||
const { account_id } = params; | ||
return ( | ||
this._client.delete( | ||
`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, | ||
options, | ||
) as Core.APIPromise<{ result: QueueDeleteResponse }> | ||
)._thenUnwrap((obj) => obj.result); | ||
} | ||
} | ||
|
||
export interface QueueUpdateResponse { | ||
event_notification_detail_id?: string; | ||
} | ||
|
||
export type QueueDeleteResponse = unknown | Array<unknown> | string; | ||
|
||
export interface QueueUpdateParams { | ||
/** | ||
* Path param: Identifier | ||
*/ | ||
account_id: string; | ||
|
||
/** | ||
* Body param: Array of rules to drive notifications | ||
*/ | ||
rules?: Array<QueueUpdateParams.Rule>; | ||
} | ||
|
||
export namespace QueueUpdateParams { | ||
export interface Rule { | ||
/** | ||
* Array of R2 object actions that will trigger notifications | ||
*/ | ||
actions: Array< | ||
'PutObject' | 'CopyObject' | 'DeleteObject' | 'CompleteMultipartUpload' | 'AbortMultipartUpload' | ||
>; | ||
|
||
/** | ||
* Notifications will be sent only for objects with this prefix | ||
*/ | ||
prefix?: string; | ||
|
||
/** | ||
* Notifications will be sent only for objects with this suffix | ||
*/ | ||
suffix?: string; | ||
} | ||
} | ||
|
||
export interface QueueDeleteParams { | ||
/** | ||
* Identifier | ||
*/ | ||
account_id: string; | ||
} | ||
|
||
export namespace Queues { | ||
export import QueueUpdateResponse = QueuesAPI.QueueUpdateResponse; | ||
export import QueueDeleteResponse = QueuesAPI.QueueDeleteResponse; | ||
export import QueueUpdateParams = QueuesAPI.QueueUpdateParams; | ||
export import QueueDeleteParams = QueuesAPI.QueueDeleteParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
export { ConfigurationGetResponse, ConfigurationGetParams, Configuration } from './configuration/index'; | ||
export { R2 } from './r2'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from 'cloudflare/resource'; | ||
import * as ConfigurationAPI from 'cloudflare/resources/event-notifications/r2/configuration/configuration'; | ||
|
||
export class R2 extends APIResource { | ||
configuration: ConfigurationAPI.Configuration = new ConfigurationAPI.Configuration(this._client); | ||
} | ||
|
||
export namespace R2 { | ||
export import Configuration = ConfigurationAPI.Configuration; | ||
export import ConfigurationGetResponse = ConfigurationAPI.ConfigurationGetResponse; | ||
export import ConfigurationGetParams = ConfigurationAPI.ConfigurationGetParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/api-resources/event-notifications/r2/configuration/configuration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Cloudflare from 'cloudflare'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const cloudflare = new Cloudflare({ | ||
apiKey: '144c9defac04969c7bfad8efaa8ea194', | ||
apiEmail: 'user@example.com', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource configuration', () => { | ||
// skipped: tests are disabled for the time being | ||
test.skip('get: only required params', async () => { | ||
const responsePromise = cloudflare.eventNotifications.r2.configuration.get( | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
{ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, | ||
); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
// skipped: tests are disabled for the time being | ||
test.skip('get: required and optional params', async () => { | ||
const response = await cloudflare.eventNotifications.r2.configuration.get( | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
{ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, | ||
); | ||
}); | ||
}); |
69 changes: 69 additions & 0 deletions
69
tests/api-resources/event-notifications/r2/configuration/queues.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Cloudflare from 'cloudflare'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const cloudflare = new Cloudflare({ | ||
apiKey: '144c9defac04969c7bfad8efaa8ea194', | ||
apiEmail: 'user@example.com', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource queues', () => { | ||
// skipped: tests are disabled for the time being | ||
test.skip('update: only required params', async () => { | ||
const responsePromise = cloudflare.eventNotifications.r2.configuration.queues.update( | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
{ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, | ||
); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
// skipped: tests are disabled for the time being | ||
test.skip('update: required and optional params', async () => { | ||
const response = await cloudflare.eventNotifications.r2.configuration.queues.update( | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
{ | ||
account_id: '023e105f4ecef8ad9ca31a8372d0c353', | ||
rules: [ | ||
{ actions: ['PutObject', 'CopyObject'], prefix: 'img/', suffix: '.jpeg' }, | ||
{ actions: ['PutObject', 'CopyObject'], prefix: 'img/', suffix: '.jpeg' }, | ||
{ actions: ['PutObject', 'CopyObject'], prefix: 'img/', suffix: '.jpeg' }, | ||
], | ||
}, | ||
); | ||
}); | ||
|
||
// skipped: tests are disabled for the time being | ||
test.skip('delete: only required params', async () => { | ||
const responsePromise = cloudflare.eventNotifications.r2.configuration.queues.delete( | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
{ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, | ||
); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
// skipped: tests are disabled for the time being | ||
test.skip('delete: required and optional params', async () => { | ||
const response = await cloudflare.eventNotifications.r2.configuration.queues.delete( | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
'023e105f4ecef8ad9ca31a8372d0c353', | ||
{ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, | ||
); | ||
}); | ||
}); |