Skip to content

Commit

Permalink
chore: update all examples (#1640)
Browse files Browse the repository at this point in the history
* chore: update all examples

* Add additional examples to script

* Update docs deps
  • Loading branch information
drwpow committed Apr 28, 2024
1 parent 8c350ab commit 627138c
Show file tree
Hide file tree
Showing 362 changed files with 225,987 additions and 263,938 deletions.
2 changes: 1 addition & 1 deletion docs/data/contributors.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"update-contributors": "node scripts/update-contributors.js"
},
"devDependencies": {
"vitepress": "1.1.3"
"vitepress": "1.1.4"
}
}
1 change: 1 addition & 0 deletions docs/scripts/update-contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ async function main() {
upsert(contributors[repo], userData);
console.log(`Updated old contributor data for ${username}`); // biome-disable-line no-console
fs.writeFileSync(new URL("../data/contributors.json", import.meta.url), JSON.stringify(contributors)); // update file while fetching (sync happens safely in between fetches)
await new Promise((resolve) => setTimeout(resolve, 500)); // sleep to prevent 429
} catch (err) {
throw new Error(err);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/openapi-fetch/examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"dev": "next dev"
},
"dependencies": {
"next": "14.2.2",
"next": "14.2.3",
"openapi-fetch": "workspace:^",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "20.12.7",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"openapi-typescript": "workspace:^",
"typescript": "5.4.5"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi-fetch/examples/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "bundler",
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true,
"paths": {
"@/*": ["./*"]
Expand Down
8 changes: 4 additions & 4 deletions packages/openapi-fetch/examples/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"@tanstack/react-query": "^5.32.0",
"openapi-fetch": "workspace:^",
"openapi-typescript": "workspace:^",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"typescript": "^5.4.5",
"vite": "^5.2.10"
Expand Down
15 changes: 7 additions & 8 deletions packages/openapi-fetch/examples/react-query/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ function Fact() {
<code>{JSON.stringify(fact.data, undefined, 2)}</code>
</pre>
)}
<button
type="button"
onClick={() => fact.refetch()}
>
<button type="button" onClick={() => fact.refetch()}>
Another fact!
</button>
</div>
Expand All @@ -39,7 +36,7 @@ function App() {
refetchOnWindowFocus: false, // don’t refetch on window focus
},
},
}),
})
);
return (
<QueryClientProvider client={reactQueryClient}>
Expand All @@ -48,6 +45,8 @@ function App() {
);
}

const domNode = document.getElementById("app")!;
const root = createRoot(domNode);
root.render(<App />);
const domNode = document.getElementById("app");
if (domNode) {
const root = createRoot(domNode);
root.render(<App />);
}
6 changes: 3 additions & 3 deletions packages/openapi-fetch/examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"dependencies": {
"openapi-fetch": "workspace:^",
"openapi-typescript": "workspace:^"
"openapi-fetch": "workspace:^"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.2.0",
"@sveltejs/kit": "^2.5.7",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"openapi-typescript": "workspace:^",
"svelte": "^4.2.15",
"svelte-check": "^3.6.9",
"svelte-check": "^3.7.0",
"tslib": "^2.6.2",
"typescript": "^5.4.5",
"vite": "^5.2.10"
Expand Down
8 changes: 0 additions & 8 deletions packages/openapi-fetch/tsconfig.build.json

This file was deleted.

713 changes: 663 additions & 50 deletions packages/openapi-typescript/examples/digital-ocean-api.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -159,50 +159,8 @@ tags:
which is used in some of the following requests. Each slug denotes the node's identifier,
CPU count, and amount of RAM, in that order.
For **Basic nodes**, reference the following table for its slug:
Slug | CPU | RAM
-------------------|---------|---------
db-s-1vcpu-1gb | 1 vCPU | 1 GB
db-s-1vcpu-2gb | 1 vCPU | 2 GB
db-s-2vcpu-4gb | 2 vCPU | 4 GB
db-s-4vcpu-8gb | 4 vCPU | 8 GB
db-s-6vcpu-16gb | 6 vCPU | 16 GB
db-s-8vcpu-32gb | 8 vCPU | 32 GB
db-s-16vcpu-64gb | 16 vCPU | 64 GB
For **General Purpose nodes**, reference the following table for its slug:
Slug | CPU | RAM
-------------------|---------|---------
gd-2vcpu-8gb | 2 vCPU | 8 GB
gd-4vcpu-16gb | 4 vCPU | 16 GB
gd-8vcpu-32gb | 8 vCPU | 32 GB
gd-16vcpu-64gb | 16 vCPU | 64 GB
gd-32vcpu-128gb | 32 vCPU | 128 GB
gd-40vcpu-160gb | 40 vCPU | 160 GB
For **Storage-Optimized nodes**, reference the following table for its slug:
Slug | CPU | RAM
-------------------|---------|---------
so1_5-2vcpu-16gb | 2 vCPU | 16 GB
so1_5-4vcpu-32gb | 4 vCPU | 32 GB
so1_5-8vcpu-64gb | 8 vCPU | 64 GB
so1_5-16vcpu-128gb | 16 vCPU | 128 GB
so1_5-24vcpu-192gb | 24 vCPU | 192 GB
so1_5-32vcpu-256gb | 32 vCPU | 256 GB
For **Memory-Optimized nodes**, reference the following table for its slug:
Slug | CPU | RAM
-------------------|---------|---------
m-2vcpu-16gb | 2 vCPU | 16 GB
m-4vcpu-32gb | 4 vCPU | 32 GB
m-8vcpu-64gb | 8 vCPU | 64 GB
m-16vcpu-128gb | 16 vCPU | 128 GB
m-24vcpu-192gb | 24 vCPU | 192 GB
m-32vcpu-256gb | 32 vCPU | 256 GB
For a list of currently available database slugs and options, use the `/v2/databases/options` endpoint or use the
`doctl databases options` [command](https://docs.digitalocean.com/reference/doctl/reference/databases/options).
- name: Domain Records
description: |-
Expand Down Expand Up @@ -793,6 +751,10 @@ paths:
$ref: 'resources/databases/databases_list_replicas.yml'
post:
$ref: 'resources/databases/databases_create_replica.yml'

/v2/databases/{database_cluster_uuid}/events:
get:
$ref: 'resources/databases/databases_events_logs.yml'

/v2/databases/{database_cluster_uuid}/replicas/{replica_name}:
get:
Expand All @@ -815,6 +777,8 @@ paths:
$ref: 'resources/databases/databases_get_user.yml'
delete:
$ref: 'resources/databases/databases_delete_user.yml'
put:
$ref: 'resources/databases/databases_update_user.yml'

/v2/databases/{database_cluster_uuid}/users/{username}/reset_auth:
post:
Expand Down Expand Up @@ -876,6 +840,12 @@ paths:
delete:
$ref: 'resources/databases/databases_delete_kafka_topic.yml'

/v2/databases/metrics/credentials:
get:
$ref: 'resources/databases/databases_get_cluster_metrics_credentials.yml'
put:
$ref: 'resources/databases/databases_update_cluster_metrics_credentials.yml'

/v2/domains:
get:
$ref: 'resources/domains/domains_list.yml'
Expand Down Expand Up @@ -1577,8 +1547,9 @@ components:
authenticate.
The DigitalOcean API handles this through OAuth, an open standard for
authorization. OAuth allows you to delegate access to your account in full
or in read-only mode.
authorization. OAuth allows you to delegate access to your account.
Scopes can be used to grant full access, read-only access, or access to
a specific set of endpoints.
You can generate an OAuth token by visiting the [Apps & API](https://cloud.digitalocean.com/account/api/tokens)
section of the DigitalOcean control panel for your account.
Expand All @@ -1597,6 +1568,31 @@ components:
- `doo_v1_` for tokens generated by applications using [the OAuth flow](https://docs.digitalocean.com/reference/api/oauth-api/)
- `dor_v1_` for OAuth refresh tokens
### Scopes
Scopes act like permissions assigned to an API token. These permissions
determine what actions the token can perform. You can create API
tokens that grant read-only access, full access, or limited access to
specific endpoints by using custom scopes.
Generally, scopes are designed to match HTTP verbs and common CRUD
operations (Create, Read, Update, Delete).
| HTTP Verb | CRUD Operation | Scope |
|---|---|---|
| GET | Read | `<resource>:read` |
| POST | Create | `<resource>:create` |
| PUT/PATCH | Update | `<resource>:update` |
| DELETE | Delete | `<resource>:delete` |
For example, creating a new Droplet by making a `POST` request to the
`/v2/droplets` endpoint requires the `droplet:create` scope while
listing Droplets by making a `GET` request to the `/v2/droplets`
endpoint requires the `droplet:read` scope.
Each endpoint below specifies which scope is required to access it when
using custom scopes.
### How to Authenticate with OAuth
In order to make an authenticated request, include a bearer-type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- '1click:create'
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- '1click:read'

Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'account:read'

Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'actions:read'

Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'actions:read'

Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:update'
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:update'
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:update'
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:create'
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:create'
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:update'
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ x-codeSamples:

security:
- bearer_auth:
- 'write'
- 'app:delete'
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ x-codeSamples:

security:
- bearer_auth:
- read
- app:read
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ x-codeSamples:

security:
- bearer_auth:
- 'read'
- 'app:read'

0 comments on commit 627138c

Please sign in to comment.