Skip to content

Commit f870d7b

Browse files
stainless-app[bot]meorphis
authored andcommitted
feat(origin_post_quantum_encryption): swap PUT for PATCH operation (#2289)
1 parent cc2ec85 commit f870d7b

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1489
1+
configured_endpoints: 1490
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d52d1344e2e65f3eda2fe8fff8c7d95cebf7cad134af21eaf9d6d5b6a04d783a.yml

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6745,10 +6745,12 @@ Methods:
67456745

67466746
Types:
67476747

6748+
- <code><a href="./src/resources/origin-post-quantum-encryption.ts">OriginPostQuantumEncryptionEditResponse</a></code>
67486749
- <code><a href="./src/resources/origin-post-quantum-encryption.ts">OriginPostQuantumEncryptionGetResponse</a></code>
67496750

67506751
Methods:
67516752

6753+
- <code title="patch /zones/{zone_id}/cache/origin_post_quantum_encryption">client.originPostQuantumEncryption.<a href="./src/resources/origin-post-quantum-encryption.ts">edit</a>({ ...params }) -> OriginPostQuantumEncryptionEditResponse</code>
67526754
- <code title="get /zones/{zone_id}/cache/origin_post_quantum_encryption">client.originPostQuantumEncryption.<a href="./src/resources/origin-post-quantum-encryption.ts">get</a>({ ...params }) -> OriginPostQuantumEncryptionGetResponse</code>
67536755

67546756
# Speed

src/resources/origin-post-quantum-encryption.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ import { APIResource } from '../resource';
44
import * as Core from '../core';
55

66
export class OriginPostQuantumEncryption extends APIResource {
7+
/**
8+
* Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when
9+
* connecting to your origin. Preferred instructs Cloudflare to opportunistically
10+
* send a Post-Quantum keyshare in the first message to the origin (for fastest
11+
* connections when the origin supports and prefers PQ), supported means that PQ
12+
* algorithms are advertised but only used when requested by the origin, and off
13+
* means that PQ algorithms are not advertised
14+
*/
15+
edit(
16+
params: OriginPostQuantumEncryptionEditParams,
17+
options?: Core.RequestOptions,
18+
): Core.APIPromise<OriginPostQuantumEncryptionEditResponse> {
19+
const { zone_id, ...body } = params;
20+
return (
21+
this._client.patch(`/zones/${zone_id}/cache/origin_post_quantum_encryption`, {
22+
body,
23+
...options,
24+
}) as Core.APIPromise<{ result: OriginPostQuantumEncryptionEditResponse }>
25+
)._thenUnwrap((obj) => obj.result);
26+
}
27+
728
/**
829
* Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when
930
* connecting to your origin. Preferred instructs Cloudflare to opportunistically
@@ -25,6 +46,28 @@ export class OriginPostQuantumEncryption extends APIResource {
2546
}
2647
}
2748

49+
export interface OriginPostQuantumEncryptionEditResponse {
50+
/**
51+
* Value of the zone setting.
52+
*/
53+
id: 'origin_pqe';
54+
55+
/**
56+
* Whether the setting is editable
57+
*/
58+
editable: boolean;
59+
60+
/**
61+
* The value of the feature
62+
*/
63+
value: 'preferred' | 'supported' | 'off';
64+
65+
/**
66+
* Last time this setting was modified.
67+
*/
68+
modified_on?: string | null;
69+
}
70+
2871
export interface OriginPostQuantumEncryptionGetResponse {
2972
/**
3073
* Value of the zone setting.
@@ -47,6 +90,18 @@ export interface OriginPostQuantumEncryptionGetResponse {
4790
modified_on?: string | null;
4891
}
4992

93+
export interface OriginPostQuantumEncryptionEditParams {
94+
/**
95+
* Path param: Identifier
96+
*/
97+
zone_id: string;
98+
99+
/**
100+
* Body param: Value of the Origin Post Quantum Encryption Setting.
101+
*/
102+
value: 'preferred' | 'supported' | 'off';
103+
}
104+
50105
export interface OriginPostQuantumEncryptionGetParams {
51106
/**
52107
* Identifier

tests/api-resources/origin-post-quantum-encryption.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,29 @@ const client = new Cloudflare({
1010
});
1111

1212
describe('resource originPostQuantumEncryption', () => {
13+
// TODO: investigate broken test
14+
test.skip('edit: only required params', async () => {
15+
const responsePromise = client.originPostQuantumEncryption.edit({
16+
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
17+
value: 'preferred',
18+
});
19+
const rawResponse = await responsePromise.asResponse();
20+
expect(rawResponse).toBeInstanceOf(Response);
21+
const response = await responsePromise;
22+
expect(response).not.toBeInstanceOf(Response);
23+
const dataAndResponse = await responsePromise.withResponse();
24+
expect(dataAndResponse.data).toBe(response);
25+
expect(dataAndResponse.response).toBe(rawResponse);
26+
});
27+
28+
// TODO: investigate broken test
29+
test.skip('edit: required and optional params', async () => {
30+
const response = await client.originPostQuantumEncryption.edit({
31+
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
32+
value: 'preferred',
33+
});
34+
});
35+
1336
// TODO: investigate broken test
1437
test.skip('get: only required params', async () => {
1538
const responsePromise = client.originPostQuantumEncryption.get({

0 commit comments

Comments
 (0)