Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 19, 2024
1 parent 3adb31d commit fefab1e
Show file tree
Hide file tree
Showing 43 changed files with 7,916 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1235
configured_endpoints: 1288
30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,36 +65,6 @@ main();

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

## File Uploads

Request parameters that correspond to file uploads can be passed in many different forms:

- `File` (or an object with the same structure)
- a `fetch` `Response` (or an object with the same structure)
- an `fs.ReadStream`
- the return value of our `toFile` helper

```ts
import fs from 'fs';
import fetch from 'node-fetch';
import Cloudflare, { toFile } from 'cloudflare';

const cloudflare = new Cloudflare();

// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await cloudflare.images.v1.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });

// Or if you have the web `File` API you can pass a `File` instance:
await cloudflare.images.v1.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });

// You can also pass a `fetch` `Response`:
await cloudflare.images.v1.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });

// Finally, if none of the above are convenient, you can use our `toFile` helper:
await cloudflare.images.v1.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });
await cloudflare.images.v1.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });
```

## Handling errors

When the library is unable to connect to the API,
Expand Down
173 changes: 173 additions & 0 deletions api.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,14 @@ export namespace Cloudflare {

export import Healthchecks = API.Healthchecks;
export import HealthchecksHealthchecks = API.HealthchecksHealthchecks;
export import HealthcheckListResponse = API.HealthcheckListResponse;
export import HealthcheckDeleteResponse = API.HealthcheckDeleteResponse;
export import HealthcheckCreateParams = API.HealthcheckCreateParams;
export import HealthcheckUpdateParams = API.HealthcheckUpdateParams;
export import HealthcheckListParams = API.HealthcheckListParams;
export import HealthcheckDeleteParams = API.HealthcheckDeleteParams;
export import HealthcheckEditParams = API.HealthcheckEditParams;
export import HealthcheckGetParams = API.HealthcheckGetParams;

export import KeylessCertificates = API.KeylessCertificates;
export import TLSCertificatesAndHostnamesBase = API.TLSCertificatesAndHostnamesBase;
Expand Down
2 changes: 2 additions & 0 deletions src/resources/dns/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export class Analytics extends APIResource {

export namespace Analytics {
export import Reports = ReportsAPI.Reports;
export import DNSDNSAnalyticsAPIReport = ReportsAPI.DNSDNSAnalyticsAPIReport;
export import ReportGetParams = ReportsAPI.ReportGetParams;
}
2 changes: 1 addition & 1 deletion src/resources/dns/analytics/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Analytics } from './analytics';
export { Reports } from './reports/index';
export { DNSDNSAnalyticsAPIReport, ReportGetParams, Reports } from './reports/index';
200 changes: 199 additions & 1 deletion src/resources/dns/analytics/reports/bytimes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,203 @@
// 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 BytimesAPI from 'cloudflare/resources/dns/analytics/reports/bytimes';

export class Bytimes extends APIResource {}
export class Bytimes extends APIResource {
/**
* Retrieves a list of aggregate metrics grouped by time interval.
*
* See
* [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
* for detailed information about the available query parameters.
*/
get(
params: BytimeGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<DNSDNSAnalyticsAPIReportBytime> {
const { zone_id, ...query } = params;
return (
this._client.get(`/zones/${zone_id}/dns_analytics/report/bytime`, {
query,
...options,
}) as Core.APIPromise<{ result: DNSDNSAnalyticsAPIReportBytime }>
)._thenUnwrap((obj) => obj.result);
}
}

export interface DNSDNSAnalyticsAPIReportBytime {
/**
* Array with one row per combination of dimension values.
*/
data: Array<DNSDNSAnalyticsAPIReportBytime.Data>;

/**
* Number of seconds between current time and last processed event, in another
* words how many seconds of data could be missing.
*/
data_lag: number;

/**
* Maximum results for each metric (object mapping metric names to values).
* Currently always an empty object.
*/
max: unknown;

/**
* Minimum results for each metric (object mapping metric names to values).
* Currently always an empty object.
*/
min: unknown;

query: DNSDNSAnalyticsAPIReportBytime.Query;

/**
* Total number of rows in the result.
*/
rows: number;

/**
* Array of time intervals in the response data. Each interval is represented as an
* array containing two values: the start time, and the end time.
*/
time_intervals: Array<Array<string>>;

/**
* Total results for metrics across all data (object mapping metric names to
* values).
*/
totals: unknown;
}

export namespace DNSDNSAnalyticsAPIReportBytime {
export interface Data {
/**
* Array of dimension values, representing the combination of dimension values
* corresponding to this row.
*/
dimensions: Array<string>;

/**
* Array with one item per requested metric. Each item is an array of values,
* broken down by time interval.
*/
metrics: Array<Array<unknown>>;
}

export interface Query {
/**
* Array of dimension names.
*/
dimensions: Array<string>;

/**
* Limit number of returned metrics.
*/
limit: number;

/**
* Array of metric names.
*/
metrics: Array<string>;

/**
* Start date and time of requesting data period in ISO 8601 format.
*/
since: string;

/**
* Unit of time to group data by.
*/
time_delta:
| 'all'
| 'auto'
| 'year'
| 'quarter'
| 'month'
| 'week'
| 'day'
| 'hour'
| 'dekaminute'
| 'minute';

/**
* End date and time of requesting data period in ISO 8601 format.
*/
until: string;

/**
* Segmentation filter in 'attribute operator value' format.
*/
filters?: string;

/**
* Array of dimensions to sort by, where each dimension may be prefixed by -
* (descending) or + (ascending).
*/
sort?: Array<string>;
}
}

export interface BytimeGetParams {
/**
* Path param: Identifier
*/
zone_id: string;

/**
* Query param: A comma-separated list of dimensions to group results by.
*/
dimensions?: string;

/**
* Query param: Segmentation filter in 'attribute operator value' format.
*/
filters?: string;

/**
* Query param: Limit number of returned metrics.
*/
limit?: number;

/**
* Query param: A comma-separated list of metrics to query.
*/
metrics?: string;

/**
* Query param: Start date and time of requesting data period in ISO 8601 format.
*/
since?: string;

/**
* Query param: A comma-separated list of dimensions to sort by, where each
* dimension may be prefixed by - (descending) or + (ascending).
*/
sort?: string;

/**
* Query param: Unit of time to group data by.
*/
time_delta?:
| 'all'
| 'auto'
| 'year'
| 'quarter'
| 'month'
| 'week'
| 'day'
| 'hour'
| 'dekaminute'
| 'minute';

/**
* Query param: End date and time of requesting data period in ISO 8601 format.
*/
until?: string;
}

export namespace Bytimes {
export import DNSDNSAnalyticsAPIReportBytime = BytimesAPI.DNSDNSAnalyticsAPIReportBytime;
export import BytimeGetParams = BytimesAPI.BytimeGetParams;
}
4 changes: 2 additions & 2 deletions src/resources/dns/analytics/reports/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Bytimes } from './bytimes';
export { Reports } from './reports';
export { DNSDNSAnalyticsAPIReport, ReportGetParams, Reports } from './reports';
export { DNSDNSAnalyticsAPIReportBytime, BytimeGetParams, Bytimes } from './bytimes';
Loading

0 comments on commit fefab1e

Please sign in to comment.