Skip to content

Commit e4ab4f1

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#461)
1 parent ed49803 commit e4ab4f1

File tree

11 files changed

+205
-44
lines changed

11 files changed

+205
-44
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1268
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ca9f3bf36e4be37e5ff9fff004f125665870f7b965d04ba56aea67a98964371.yml
1+
configured_endpoints: 1269
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-35412fd158c3e184d9aa368a2fd1c169ec542af1a1892f41155afe8df8ad79bf.yml

api.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3162,11 +3162,21 @@ Types:
31623162
Methods:
31633163

31643164
- <code title="post /accounts/{account_id}/intel/indicator-feeds">client.intel.indicatorFeeds.<a href="./src/resources/intel/indicator-feeds/indicator-feeds.ts">create</a>({ ...params }) -> IndicatorFeedCreateResponse</code>
3165-
- <code title="put /accounts/{account_id}/intel/indicator-feeds/{feed_id}/snapshot">client.intel.indicatorFeeds.<a href="./src/resources/intel/indicator-feeds/indicator-feeds.ts">update</a>(feedId, { ...params }) -> IndicatorFeedUpdateResponse</code>
3165+
- <code title="put /accounts/{account_id}/intel/indicator-feeds/{feed_id}">client.intel.indicatorFeeds.<a href="./src/resources/intel/indicator-feeds/indicator-feeds.ts">update</a>(feedId, { ...params }) -> IndicatorFeedUpdateResponse</code>
31663166
- <code title="get /accounts/{account_id}/intel/indicator-feeds">client.intel.indicatorFeeds.<a href="./src/resources/intel/indicator-feeds/indicator-feeds.ts">list</a>({ ...params }) -> IndicatorFeedListResponsesSinglePage</code>
31673167
- <code title="get /accounts/{account_id}/intel/indicator-feeds/{feed_id}/data">client.intel.indicatorFeeds.<a href="./src/resources/intel/indicator-feeds/indicator-feeds.ts">data</a>(feedId, { ...params }) -> string</code>
31683168
- <code title="get /accounts/{account_id}/intel/indicator-feeds/{feed_id}">client.intel.indicatorFeeds.<a href="./src/resources/intel/indicator-feeds/indicator-feeds.ts">get</a>(feedId, { ...params }) -> IndicatorFeedGetResponse</code>
31693169

3170+
### Snapshots
3171+
3172+
Types:
3173+
3174+
- <code><a href="./src/resources/intel/indicator-feeds/snapshots.ts">SnapshotUpdateResponse</a></code>
3175+
3176+
Methods:
3177+
3178+
- <code title="put /accounts/{account_id}/intel/indicator-feeds/{feed_id}/snapshot">client.intel.indicatorFeeds.snapshots.<a href="./src/resources/intel/indicator-feeds/snapshots.ts">update</a>(feedId, { ...params }) -> SnapshotUpdateResponse</code>
3179+
31703180
### Permissions
31713181

31723182
Types:

src/resources/cloudforce-one/requests/message.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import * as Core from 'cloudflare/core';
44
import { APIResource } from 'cloudflare/resource';
55
import * as MessageAPI from 'cloudflare/resources/cloudforce-one/requests/message';
6+
import * as Shared from 'cloudflare/resources/shared';
67

78
export class MessageResource extends APIResource {
89
/**
@@ -51,12 +52,10 @@ export class MessageResource extends APIResource {
5152
messageIdentifer: number,
5253
options?: Core.RequestOptions,
5354
): Core.APIPromise<MessageDeleteResponse> {
54-
return (
55-
this._client.delete(
56-
`/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/message/${messageIdentifer}`,
57-
options,
58-
) as Core.APIPromise<{ result: MessageDeleteResponse }>
59-
)._thenUnwrap((obj) => obj.result);
55+
return this._client.delete(
56+
`/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/message/${messageIdentifer}`,
57+
options,
58+
);
6059
}
6160

6261
/**
@@ -109,7 +108,16 @@ export interface Message {
109108
created?: string;
110109
}
111110

112-
export type MessageDeleteResponse = unknown | Array<unknown> | string;
111+
export interface MessageDeleteResponse {
112+
errors: Array<Shared.ResponseInfo>;
113+
114+
messages: Array<Shared.ResponseInfo>;
115+
116+
/**
117+
* Whether the API call was successful
118+
*/
119+
success: true;
120+
}
113121

114122
export type MessageGetResponse = Array<Message>;
115123

src/resources/cloudforce-one/requests/priority.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import * as Core from 'cloudflare/core';
44
import { APIResource } from 'cloudflare/resource';
55
import * as PriorityAPI from 'cloudflare/resources/cloudforce-one/requests/priority';
6+
import * as Shared from 'cloudflare/resources/shared';
67
import * as RequestsAPI from 'cloudflare/resources/cloudforce-one/requests/requests';
78

89
export class PriorityResource extends APIResource {
@@ -47,12 +48,10 @@ export class PriorityResource extends APIResource {
4748
priorityIdentifer: string,
4849
options?: Core.RequestOptions,
4950
): Core.APIPromise<PriorityDeleteResponse> {
50-
return (
51-
this._client.delete(
52-
`/accounts/${accountIdentifier}/cloudforce-one/requests/priority/${priorityIdentifer}`,
53-
options,
54-
) as Core.APIPromise<{ result: PriorityDeleteResponse }>
55-
)._thenUnwrap((obj) => obj.result);
51+
return this._client.delete(
52+
`/accounts/${accountIdentifier}/cloudforce-one/requests/priority/${priorityIdentifer}`,
53+
options,
54+
);
5655
}
5756

5857
/**
@@ -147,7 +146,16 @@ export interface PriorityEdit {
147146
tlp: 'clear' | 'amber' | 'amber-strict' | 'green' | 'red';
148147
}
149148

150-
export type PriorityDeleteResponse = unknown | Array<unknown> | string;
149+
export interface PriorityDeleteResponse {
150+
errors: Array<Shared.ResponseInfo>;
151+
152+
messages: Array<Shared.ResponseInfo>;
153+
154+
/**
155+
* Whether the API call was successful
156+
*/
157+
success: true;
158+
}
151159

152160
export interface PriorityCreateParams {
153161
/**

src/resources/cloudforce-one/requests/requests.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import * as Core from 'cloudflare/core';
44
import { APIResource } from 'cloudflare/resource';
55
import * as RequestsAPI from 'cloudflare/resources/cloudforce-one/requests/requests';
6+
import * as Shared from 'cloudflare/resources/shared';
67
import * as MessageAPI from 'cloudflare/resources/cloudforce-one/requests/message';
78
import * as PriorityAPI from 'cloudflare/resources/cloudforce-one/requests/priority';
89
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination';
@@ -71,12 +72,10 @@ export class Requests extends APIResource {
7172
requestIdentifier: string,
7273
options?: Core.RequestOptions,
7374
): Core.APIPromise<RequestDeleteResponse> {
74-
return (
75-
this._client.delete(
76-
`/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}`,
77-
options,
78-
) as Core.APIPromise<{ result: RequestDeleteResponse }>
79-
)._thenUnwrap((obj) => obj.result);
75+
return this._client.delete(
76+
`/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}`,
77+
options,
78+
);
8079
}
8180

8281
/**
@@ -280,7 +279,16 @@ export interface RequestConstants {
280279

281280
export type RequestTypes = Array<string>;
282281

283-
export type RequestDeleteResponse = unknown | Array<unknown> | string;
282+
export interface RequestDeleteResponse {
283+
errors: Array<Shared.ResponseInfo>;
284+
285+
messages: Array<Shared.ResponseInfo>;
286+
287+
/**
288+
* Whether the API call was successful
289+
*/
290+
success: true;
291+
}
284292

285293
export interface RequestCreateParams {
286294
/**

src/resources/intel/indicator-feeds/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ export {
2323
PermissionDeleteParams,
2424
Permissions,
2525
} from './permissions';
26+
export { SnapshotUpdateResponse, SnapshotUpdateParams, Snapshots } from './snapshots';

src/resources/intel/indicator-feeds/indicator-feeds.ts

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import * as Core from 'cloudflare/core';
44
import { APIResource } from 'cloudflare/resource';
55
import * as IndicatorFeedsAPI from 'cloudflare/resources/intel/indicator-feeds/indicator-feeds';
66
import * as PermissionsAPI from 'cloudflare/resources/intel/indicator-feeds/permissions';
7-
import { multipartFormRequestOptions } from 'cloudflare/core';
7+
import * as SnapshotsAPI from 'cloudflare/resources/intel/indicator-feeds/snapshots';
88
import { SinglePage } from 'cloudflare/pagination';
99

1010
export class IndicatorFeeds extends APIResource {
11+
snapshots: SnapshotsAPI.Snapshots = new SnapshotsAPI.Snapshots(this._client);
1112
permissions: PermissionsAPI.Permissions = new PermissionsAPI.Permissions(this._client);
1213

1314
/**
@@ -27,7 +28,7 @@ export class IndicatorFeeds extends APIResource {
2728
}
2829

2930
/**
30-
* Update indicator feed data
31+
* Update indicator feed metadata
3132
*/
3233
update(
3334
feedId: number,
@@ -36,10 +37,10 @@ export class IndicatorFeeds extends APIResource {
3637
): Core.APIPromise<IndicatorFeedUpdateResponse> {
3738
const { account_id, ...body } = params;
3839
return (
39-
this._client.put(
40-
`/accounts/${account_id}/intel/indicator-feeds/${feedId}/snapshot`,
41-
multipartFormRequestOptions({ body, ...options }),
42-
) as Core.APIPromise<{ result: IndicatorFeedUpdateResponse }>
40+
this._client.put(`/accounts/${account_id}/intel/indicator-feeds/${feedId}`, {
41+
body,
42+
...options,
43+
}) as Core.APIPromise<{ result: IndicatorFeedUpdateResponse }>
4344
)._thenUnwrap((obj) => obj.result);
4445
}
4546

@@ -132,19 +133,39 @@ export interface IndicatorFeedCreateResponse {
132133

133134
export interface IndicatorFeedUpdateResponse {
134135
/**
135-
* Feed id
136+
* The unique identifier for the indicator feed
137+
*/
138+
id?: number;
139+
140+
/**
141+
* The date and time when the data entry was created
142+
*/
143+
created_on?: string;
144+
145+
/**
146+
* The description of the example test
147+
*/
148+
description?: string;
149+
150+
/**
151+
* Whether the indicator feed can be attributed to a provider
152+
*/
153+
is_attributable?: boolean;
154+
155+
/**
156+
* Whether the indicator feed is exposed to customers
136157
*/
137-
file_id?: number;
158+
is_public?: boolean;
138159

139160
/**
140-
* Name of the file unified in our system
161+
* The date and time when the data entry was last modified
141162
*/
142-
filename?: string;
163+
modified_on?: string;
143164

144165
/**
145-
* Current status of upload, should be unified
166+
* The name of the indicator feed
146167
*/
147-
status?: string;
168+
name?: string;
148169
}
149170

150171
export interface IndicatorFeedListResponse {
@@ -242,9 +263,19 @@ export interface IndicatorFeedUpdateParams {
242263
account_id: string;
243264

244265
/**
245-
* Body param: The file to upload
266+
* Body param: The new description of the feed
246267
*/
247-
source?: string;
268+
feed_description?: string;
269+
270+
/**
271+
* Body param: The new is_attributable value of the feed
272+
*/
273+
is_attributable?: boolean;
274+
275+
/**
276+
* Body param: The new is_public value of the feed
277+
*/
278+
is_public?: boolean;
248279
}
249280

250281
export interface IndicatorFeedListParams {
@@ -280,6 +311,9 @@ export namespace IndicatorFeeds {
280311
export import IndicatorFeedListParams = IndicatorFeedsAPI.IndicatorFeedListParams;
281312
export import IndicatorFeedDataParams = IndicatorFeedsAPI.IndicatorFeedDataParams;
282313
export import IndicatorFeedGetParams = IndicatorFeedsAPI.IndicatorFeedGetParams;
314+
export import Snapshots = SnapshotsAPI.Snapshots;
315+
export import SnapshotUpdateResponse = SnapshotsAPI.SnapshotUpdateResponse;
316+
export import SnapshotUpdateParams = SnapshotsAPI.SnapshotUpdateParams;
283317
export import Permissions = PermissionsAPI.Permissions;
284318
export import PermissionCreateResponse = PermissionsAPI.PermissionCreateResponse;
285319
export import PermissionListResponse = PermissionsAPI.PermissionListResponse;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import * as Core from 'cloudflare/core';
4+
import { APIResource } from 'cloudflare/resource';
5+
import * as SnapshotsAPI from 'cloudflare/resources/intel/indicator-feeds/snapshots';
6+
import { multipartFormRequestOptions } from 'cloudflare/core';
7+
8+
export class Snapshots extends APIResource {
9+
/**
10+
* Update indicator feed data
11+
*/
12+
update(
13+
feedId: number,
14+
params: SnapshotUpdateParams,
15+
options?: Core.RequestOptions,
16+
): Core.APIPromise<SnapshotUpdateResponse> {
17+
const { account_id, ...body } = params;
18+
return (
19+
this._client.put(
20+
`/accounts/${account_id}/intel/indicator-feeds/${feedId}/snapshot`,
21+
multipartFormRequestOptions({ body, ...options }),
22+
) as Core.APIPromise<{ result: SnapshotUpdateResponse }>
23+
)._thenUnwrap((obj) => obj.result);
24+
}
25+
}
26+
27+
export interface SnapshotUpdateResponse {
28+
/**
29+
* Feed id
30+
*/
31+
file_id?: number;
32+
33+
/**
34+
* Name of the file unified in our system
35+
*/
36+
filename?: string;
37+
38+
/**
39+
* Current status of upload, should be unified
40+
*/
41+
status?: string;
42+
}
43+
44+
export interface SnapshotUpdateParams {
45+
/**
46+
* Path param: Identifier
47+
*/
48+
account_id: string;
49+
50+
/**
51+
* Body param: The file to upload
52+
*/
53+
source?: string;
54+
}
55+
56+
export namespace Snapshots {
57+
export import SnapshotUpdateResponse = SnapshotsAPI.SnapshotUpdateResponse;
58+
export import SnapshotUpdateParams = SnapshotsAPI.SnapshotUpdateParams;
59+
}

src/resources/workers/ai.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export class AI extends APIResource {
3131
export type AIRunResponse =
3232
| Array<AIRunResponse.TextClassification>
3333
| Uploadable
34-
| Uploadable
3534
| Array<number>
3635
| AIRunResponse.TextEmbeddings
3736
| AIRunResponse.SpeechRecognition

tests/api-resources/intel/indicator-feeds/indicator-feeds.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ describe('resource indicatorFeeds', () => {
3131
});
3232
});
3333

34-
// TODO: investigate broken test
35-
test.skip('update: only required params', async () => {
34+
test('update: only required params', async () => {
3635
const responsePromise = cloudflare.intel.indicatorFeeds.update(12, {
3736
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
3837
});
@@ -45,11 +44,12 @@ describe('resource indicatorFeeds', () => {
4544
expect(dataAndResponse.response).toBe(rawResponse);
4645
});
4746

48-
// TODO: investigate broken test
49-
test.skip('update: required and optional params', async () => {
47+
test('update: required and optional params', async () => {
5048
const response = await cloudflare.intel.indicatorFeeds.update(12, {
5149
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
52-
source: '@/Users/me/test.stix2',
50+
feed_description: 'This is an example description',
51+
is_attributable: true,
52+
is_public: true,
5353
});
5454
});
5555

0 commit comments

Comments
 (0)