diff --git a/README.md b/README.md index 3ec47c7a37..8960c9786b 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ import { fetch } from 'undici'; // as one example import Cloudflare from 'cloudflare'; const client = new Cloudflare({ - fetch: async (url: RequestInfo, init?: RequestInfo): Promise => { + fetch: async (url: RequestInfo, init?: RequestInit): Promise => { console.log('About to make a request', url, init); const response = await fetch(url, init); console.log('Got response', response); diff --git a/src/resources/firewall/access-rules.ts b/src/resources/firewall/access-rules.ts index 6ccd3122be..f5617bcb3a 100644 --- a/src/resources/firewall/access-rules.ts +++ b/src/resources/firewall/access-rules.ts @@ -72,9 +72,9 @@ export class AccessRules extends APIResource { params: AccessRuleEditParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_identifier, ...body } = params; + const { account_id, zone_id, ...body } = params; return ( - this._client.patch(`/${account_identifier}/${identifier}/firewall/access_rules/rules/:identifier`, { + this._client.patch(`/${account_id}/${zone_id}/firewall/access_rules/rules/${identifier}`, { body, ...options, }) as Core.APIPromise<{ result: AccessRuleEditResponse | null }> @@ -323,9 +323,16 @@ export interface AccessRuleDeleteParams { export interface AccessRuleEditParams { /** - * Path param: + * Path param: The Account ID to use for this endpoint. Mutually exclusive with the + * Zone ID. + */ + account_id: string; + + /** + * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the + * Account ID. */ - account_identifier: unknown; + zone_id: string; /** * Body param: The rule configuration. diff --git a/src/resources/rulesets/rules.ts b/src/resources/rulesets/rules.ts index 45bdf0745c..e585ba07b9 100644 --- a/src/resources/rulesets/rules.ts +++ b/src/resources/rulesets/rules.ts @@ -50,9 +50,9 @@ export class Rules extends APIResource { params: RuleEditParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, zone_id, ...body } = params; return ( - this._client.patch(`/${account_id}/${rulesetId}/rulesets/${ruleId}/rules/:rule_id`, { + this._client.patch(`/${account_id}/${zone_id}/rulesets/${rulesetId}/rules/${ruleId}`, { body, ...options, }) as Core.APIPromise<{ result: RuleEditResponse }> @@ -1819,10 +1819,17 @@ export interface RuleDeleteParams { export interface RuleEditParams { /** - * Path param: The unique ID of the account. + * Path param: The Account ID to use for this endpoint. Mutually exclusive with the + * Zone ID. */ account_id: string; + /** + * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the + * Account ID. + */ + zone_id: string; + /** * Body param: An object configuring where the rule will be placed. */ diff --git a/tests/api-resources/firewall/access-rules.test.ts b/tests/api-resources/firewall/access-rules.test.ts index 0e649e5402..a47a2adfff 100644 --- a/tests/api-resources/firewall/access-rules.test.ts +++ b/tests/api-resources/firewall/access-rules.test.ts @@ -100,7 +100,7 @@ describe('resource accessRules', () => { test.skip('edit: only required params', async () => { const responsePromise = cloudflare.firewall.accessRules.edit( {}, - { account_identifier: {}, configuration: {}, mode: 'challenge' }, + { account_id: 'string', zone_id: 'string', configuration: {}, mode: 'challenge' }, ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -116,7 +116,8 @@ describe('resource accessRules', () => { const response = await cloudflare.firewall.accessRules.edit( {}, { - account_identifier: {}, + account_id: 'string', + zone_id: 'string', configuration: { target: 'ip', value: '198.51.100.4' }, mode: 'challenge', notes: 'This rule is enabled because of an event that occurred on date X.', diff --git a/tests/api-resources/rulesets/rules.test.ts b/tests/api-resources/rulesets/rules.test.ts index 51559d34fc..d3183006b0 100644 --- a/tests/api-resources/rulesets/rules.test.ts +++ b/tests/api-resources/rulesets/rules.test.ts @@ -67,7 +67,7 @@ describe('resource rules', () => { const responsePromise = cloudflare.rulesets.rules.edit( '2f2feab2026849078ba485f918791bdc', '3a03d665bac047339bb530ecb439a90d', - { account_id: 'abf9b32d38c5f572afde3336ec0ce302' }, + { account_id: 'string', zone_id: 'string' }, ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -83,10 +83,7 @@ describe('resource rules', () => { const response = await cloudflare.rulesets.rules.edit( '2f2feab2026849078ba485f918791bdc', '3a03d665bac047339bb530ecb439a90d', - { - account_id: 'abf9b32d38c5f572afde3336ec0ce302', - position: { before: 'da5e8e506c8e7877fe06cdf4c41add54' }, - }, + { account_id: 'string', zone_id: 'string', position: { before: 'da5e8e506c8e7877fe06cdf4c41add54' } }, ); }); });