Skip to content

Commit

Permalink
feat(api): update internal path (#2396)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Feb 9, 2025
1 parent 4ee3552 commit 6948a0b
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1524
configured_endpoints: 1525
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-201a9d77b2e238cb2f8c2c952b00b976608e2a53fe4230369e801971fda29edc.yml
8 changes: 8 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,14 @@ Methods:

## Recommendations

Types:

- <code><a href="./src/resources/ssl/recommendations.ts">RecommendationGetResponse</a></code>

Methods:

- <code title="get /zones/{zone_id}/ssl/recommendation">client.ssl.recommendations.<a href="./src/resources/ssl/recommendations.ts">get</a>({ ...params }) -> RecommendationGetResponse</code>

## Universal

### Settings
Expand Down
6 changes: 5 additions & 1 deletion src/resources/ssl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export {
type CertificatePackEditParams,
type CertificatePackGetParams,
} from './certificate-packs/index';
export { Recommendations } from './recommendations';
export {
Recommendations,
type RecommendationGetResponse,
type RecommendationGetParams,
} from './recommendations';
export { SSL } from './ssl';
export { Universal } from './universal/index';
export {
Expand Down
43 changes: 42 additions & 1 deletion src/resources/ssl/recommendations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';

export class Recommendations extends APIResource {}
export class Recommendations extends APIResource {
/**
* Retrieve the SSL/TLS Recommender's recommendation for a zone.
*/
get(
params: RecommendationGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<RecommendationGetResponse> {
const { zone_id } = params;
return (
this._client.get(`/zones/${zone_id}/ssl/recommendation`, options) as Core.APIPromise<{
result: RecommendationGetResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
}

export interface RecommendationGetResponse {
/**
* Identifier of a recommendation result.
*/
id?: string;

modified_on?: string;

value?: 'flexible' | 'full' | 'strict';
}

export interface RecommendationGetParams {
/**
* Identifier
*/
zone_id: string;
}

export declare namespace Recommendations {
export {
type RecommendationGetResponse as RecommendationGetResponse,
type RecommendationGetParams as RecommendationGetParams,
};
}
8 changes: 6 additions & 2 deletions src/resources/ssl/ssl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { APIResource } from '../../resource';
import * as AnalyzeAPI from './analyze';
import { Analyze, AnalyzeCreateParams, AnalyzeCreateResponse } from './analyze';
import * as RecommendationsAPI from './recommendations';
import { Recommendations } from './recommendations';
import { RecommendationGetParams, RecommendationGetResponse, Recommendations } from './recommendations';
import * as VerificationAPI from './verification';
import {
Verification,
Expand Down Expand Up @@ -79,7 +79,11 @@ export declare namespace SSL {
type CertificatePackGetParams as CertificatePackGetParams,
};

export { Recommendations as Recommendations };
export {
Recommendations as Recommendations,
type RecommendationGetResponse as RecommendationGetResponse,
type RecommendationGetParams as RecommendationGetParams,
};

export { Universal as Universal };

Expand Down
27 changes: 27 additions & 0 deletions tests/api-resources/ssl/recommendations.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Cloudflare from 'cloudflare';
import { Response } from 'node-fetch';

const client = new Cloudflare({
apiKey: '144c9defac04969c7bfad8efaa8ea194',
apiEmail: '[email protected]',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource recommendations', () => {
test('get: only required params', async () => {
const responsePromise = client.ssl.recommendations.get({ zone_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);
});

test('get: required and optional params', async () => {
const response = await client.ssl.recommendations.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' });
});
});

0 comments on commit 6948a0b

Please sign in to comment.