Skip to content

Commit 7c42412

Browse files
committed
[Artifacts] fix type-only code blocks
1 parent c2c65aa commit 7c42412

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

src/content/docs/artifacts/api/rest-api.mdx

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ head:
99
content: REST API · Artifacts
1010
---
1111

12-
import { LinkCard, MetaInfo, Type, TypeScriptExample } from "~/components";
12+
import { LinkCard, MetaInfo, Type } from "~/components";
1313

1414
Use the Artifacts REST API to manage repos, remotes, forks, imports, and tokens from external systems.
1515

@@ -46,8 +46,6 @@ Returned repo tokens are secrets. Do not log them or store them in long-lived re
4646

4747
## Shared types
4848

49-
<TypeScriptExample>
50-
5149
```ts
5250
export type NamespaceName = string;
5351
export type RepoName = string;
@@ -121,8 +119,6 @@ export interface TokenInfo {
121119
}
122120
```
123121

124-
</TypeScriptExample>
125-
126122
## Repos
127123

128124
### Create a repo
@@ -138,8 +134,6 @@ Request body:
138134

139135
Response type:
140136

141-
<TypeScriptExample omitTabs={true}>
142-
143137
```ts
144138
export interface CreateRepoRequest {
145139
name: RepoName;
@@ -161,8 +155,6 @@ export interface CreateRepoResult {
161155
export type CreateRepoResponse = ApiEnvelope<CreateRepoResult>;
162156
```
163157

164-
</TypeScriptExample>
165-
166158
```bash
167159
curl --request POST "$ARTIFACTS_BASE_URL/repos" \
168160
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
@@ -206,8 +198,6 @@ Query parameters:
206198

207199
Response type:
208200

209-
<TypeScriptExample>
210-
211201
```ts
212202
export interface ListReposQuery {
213203
limit?: number;
@@ -220,8 +210,6 @@ export interface ListReposQuery {
220210
export type ListReposResponse = ApiEnvelope<RepoInfo[]>;
221211
```
222212

223-
</TypeScriptExample>
224-
225213
```bash
226214
curl "$ARTIFACTS_BASE_URL/repos?limit=20&sort=updated_at&direction=desc" \
227215
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
@@ -259,14 +247,10 @@ Route: `GET /repos/:name`
259247

260248
Response type:
261249

262-
<TypeScriptExample omitTabs={true}>
263-
264250
```ts
265251
export type GetRepoResponse = ApiEnvelope<RemoteRepoInfo>;
266252
```
267253

268-
</TypeScriptExample>
269-
270254
```bash
271255
curl "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO" \
272256
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
@@ -300,8 +284,6 @@ This route returns `202 Accepted`.
300284

301285
Response type:
302286

303-
<TypeScriptExample omitTabs={true}>
304-
305287
```ts
306288
export interface DeleteRepoResult {
307289
id: string;
@@ -310,8 +292,6 @@ export interface DeleteRepoResult {
310292
export type DeleteRepoResponse = ApiEnvelope<DeleteRepoResult>;
311293
```
312294

313-
</TypeScriptExample>
314-
315295
```bash
316296
curl --request DELETE "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO" \
317297
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
@@ -341,8 +321,6 @@ Request body:
341321

342322
Response type:
343323

344-
<TypeScriptExample omitTabs={true}>
345-
346324
```ts
347325
export interface ForkRepoRequest {
348326
name: RepoName;
@@ -358,8 +336,6 @@ export interface ForkRepoResult extends CreateRepoResult {
358336
export type ForkRepoResponse = ApiEnvelope<ForkRepoResult>;
359337
```
360338

361-
</TypeScriptExample>
362-
363339
```bash
364340
curl --request POST "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO/fork" \
365341
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
@@ -403,8 +379,6 @@ Request body:
403379

404380
Response type:
405381

406-
<TypeScriptExample omitTabs={true}>
407-
408382
```ts
409383
export interface ImportRepoRequest {
410384
url: string;
@@ -416,8 +390,6 @@ export interface ImportRepoRequest {
416390
export type ImportRepoResponse = ApiEnvelope<CreateRepoResult>;
417391
```
418392

419-
</TypeScriptExample>
420-
421393
Pass a full HTTPS Git remote URL, for example `https://github.com/facebook/react` or `https://gitlab.com/group/project.git`.
422394

423395
```bash
@@ -464,8 +436,6 @@ Query parameters:
464436

465437
Response type:
466438

467-
<TypeScriptExample omitTabs={true}>
468-
469439
```ts
470440
export interface ListTokensQuery {
471441
state?: TokenState | "all";
@@ -476,8 +446,6 @@ export interface ListTokensQuery {
476446
export type ListTokensResponse = ApiEnvelope<TokenInfo[]>;
477447
```
478448

479-
</TypeScriptExample>
480-
481449
```bash
482450
curl "$ARTIFACTS_BASE_URL/repos/$ARTIFACTS_REPO/tokens?state=all&per_page=30&page=1" \
483451
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
@@ -519,8 +487,6 @@ Request body:
519487

520488
Response type:
521489

522-
<TypeScriptExample omitTabs={true}>
523-
524490
```ts
525491
export interface CreateTokenRequest {
526492
repo: RepoName;
@@ -538,8 +504,6 @@ export interface CreateTokenResult {
538504
export type CreateTokenResponse = ApiEnvelope<CreateTokenResult>;
539505
```
540506

541-
</TypeScriptExample>
542-
543507
```bash
544508
curl --request POST "$ARTIFACTS_BASE_URL/tokens" \
545509
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
@@ -571,8 +535,6 @@ Route: `DELETE /tokens/:id`
571535

572536
Response type:
573537

574-
<TypeScriptExample omitTabs={true}>
575-
576538
```ts
577539
export interface RevokeTokenResult {
578540
id: string;
@@ -581,8 +543,6 @@ export interface RevokeTokenResult {
581543
export type RevokeTokenResponse = ApiEnvelope<RevokeTokenResult>;
582544
```
583545

584-
</TypeScriptExample>
585-
586546
```bash
587547
curl --request DELETE "$ARTIFACTS_BASE_URL/tokens/tok_123" \
588548
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
@@ -603,8 +563,6 @@ curl --request DELETE "$ARTIFACTS_BASE_URL/tokens/tok_123" \
603563

604564
Application errors also use the v4 envelope:
605565

606-
<TypeScriptExample omitTabs={true}>
607-
608566
```ts
609567
export interface ApiError {
610568
code: number;
@@ -616,8 +574,6 @@ export interface ApiError {
616574
}
617575
```
618576

619-
</TypeScriptExample>
620-
621577
## Next steps
622578

623579
<LinkCard

src/content/docs/artifacts/api/workers-binding.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,12 @@ namespace = "default"
3737

3838
After you run `npx wrangler types`, your Worker environment looks like this:
3939

40-
<TypeScriptExample>
41-
4240
```ts
4341
export interface Env {
4442
ARTIFACTS: Artifacts;
4543
}
4644
```
4745

48-
</TypeScriptExample>
49-
5046
Wrangler generates the `Artifacts` type for consumers and binds it directly in your environment.
5147

5248
If you authenticate with `wrangler login`, Wrangler requests `artifacts:write` by default.

0 commit comments

Comments
 (0)