Skip to content

Commit 6fccfbc

Browse files
committed
docs(demos): createResource -> resource
1 parent a4396b5 commit 6fccfbc

File tree

18 files changed

+39
-39
lines changed

18 files changed

+39
-39
lines changed

examples/coin-app/src/resources/Currency.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Entity, createResource, schema } from '@data-client/rest';
1+
import { Entity, resource, schema } from '@data-client/rest';
22

33
import { iconTable } from './cryptoIconTable';
44
import { Stats } from './Stats';
@@ -57,7 +57,7 @@ export class Currency extends Entity {
5757
};
5858
}
5959

60-
export const CurrencyResource = createResource({
60+
export const CurrencyResource = resource({
6161
urlPrefix: 'https://api.exchange.coinbase.com',
6262
path: '/currencies/:id',
6363
schema: Currency,

examples/coin-app/src/resources/Product.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Entity, createResource, schema } from '@data-client/rest';
1+
import { Entity, resource, schema } from '@data-client/rest';
22

33
import { Stats } from './Stats';
44

@@ -25,7 +25,7 @@ export class Product extends Entity {
2525
}
2626
}
2727

28-
export const ProductResource = createResource({
28+
export const ProductResource = resource({
2929
urlPrefix: 'https://api.exchange.coinbase.com',
3030
path: '/products/:id',
3131
schema: Product,

examples/coin-app/src/resources/Stats.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Entity, createResource, schema } from '@data-client/rest';
1+
import { Entity, resource, schema } from '@data-client/rest';
22

33
export class Stats extends Entity {
44
id = '';
@@ -31,7 +31,7 @@ export class Stats extends Entity {
3131
}
3232
}
3333

34-
export const StatsResource = createResource({
34+
export const StatsResource = resource({
3535
urlPrefix: 'https://api.exchange.coinbase.com',
3636
path: '/products/:id/stats',
3737
schema: Stats,

examples/github-app/src/resources/Base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
RestGenerics,
1212
RestEndpoint,
1313
Resource,
14-
createResource,
14+
resource,
1515
ResourceGenerics,
1616
ResourceOptions,
1717
PaginationFieldEndpoint,
@@ -90,10 +90,10 @@ export class GithubEndpoint<
9090
}
9191
}
9292

93-
export function createGithubResource<O extends ResourceGenerics>(
93+
export function githubResource<O extends ResourceGenerics>(
9494
options: Readonly<O> & ResourceOptions,
9595
): GithubResource<O> {
96-
const baseResource = createResource({
96+
const baseResource = resource({
9797
Endpoint: GithubEndpoint,
9898
paginationField: 'page',
9999
...options,

examples/github-app/src/resources/Comment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Temporal } from '@js-temporal/polyfill';
22

3-
import { GithubEntity, createGithubResource } from './Base';
3+
import { GithubEntity, githubResource } from './Base';
44
import { User } from './User';
55

66
export class Comment extends GithubEntity {
@@ -28,7 +28,7 @@ export class Comment extends GithubEntity {
2828
updatedAt: Temporal.Instant.from,
2929
};
3030
}
31-
export const CommentResource = createGithubResource({
31+
export const CommentResource = githubResource({
3232
path: '/repos/:owner/:repo/issues/comments/:id',
3333
schema: Comment,
3434
optimistic: true,

examples/github-app/src/resources/Event.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { schema } from '@data-client/rest';
99
import { Temporal } from '@js-temporal/polyfill';
1010

11-
import { createGithubResource, GithubEntity } from './Base';
11+
import { githubResource, GithubEntity } from './Base';
1212
import { Issue } from './Issue';
1313
import PreviewEndpoint from './PreviewEndpoint';
1414
import { Pull } from './Pull';
@@ -80,7 +80,7 @@ export class IssuesEvent extends Event {
8080
};
8181
}
8282

83-
export const EventResource = createGithubResource({
83+
export const EventResource = githubResource({
8484
path: '/users/:login/events/public/:id',
8585
schema: new schema.Union(
8686
{

examples/github-app/src/resources/Issue.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Temporal } from '@js-temporal/polyfill';
22

3-
import { GithubEntity, createGithubResource } from './Base';
3+
import { GithubEntity, githubResource } from './Base';
44
import { Label } from './Label';
55
import { stateToIcon } from './stateToIcon';
66
import { User } from './User';
@@ -51,7 +51,7 @@ export class Issue extends GithubEntity {
5151
}
5252
}
5353

54-
export const IssueResource = createGithubResource({
54+
export const IssueResource = githubResource({
5555
path: '/repos/:owner/:repo/issues/:number',
5656
schema: Issue,
5757
pollFrequency: 60000,

examples/github-app/src/resources/Label.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GithubEntity, createGithubResource } from './Base';
1+
import { GithubEntity, githubResource } from './Base';
22
import PreviewEndpoint from './PreviewEndpoint';
33

44
export class Label extends GithubEntity {
@@ -12,7 +12,7 @@ export class Label extends GithubEntity {
1212
return this.id?.toString();
1313
}
1414
}
15-
export const LabelResource = createGithubResource({
15+
export const LabelResource = githubResource({
1616
path: '/repos/:owner/:repo/labels/:name',
1717
schema: Label,
1818
Endpoint: PreviewEndpoint,

examples/github-app/src/resources/Pull.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Temporal } from '@js-temporal/polyfill';
22

3-
import { GithubEntity, createGithubResource } from './Base';
3+
import { GithubEntity, githubResource } from './Base';
44
import { Label } from './Label';
55
import { stateToIcon } from './stateToIcon';
66
import { User } from './User';
@@ -51,7 +51,7 @@ export class Pull extends GithubEntity {
5151
static key = 'Pull';
5252
}
5353

54-
export const PullResource = createGithubResource({
54+
export const PullResource = githubResource({
5555
path: '/repos/:owner/:repo/pulls/:number',
5656
schema: Pull,
5757
pollFrequency: 60000,

examples/github-app/src/resources/Reaction.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { HeartOutlined } from '@ant-design/icons';
22
import { Temporal } from '@js-temporal/polyfill';
33

4-
import { createGithubResource, GithubEntity } from './Base';
4+
import { githubResource, GithubEntity } from './Base';
55
import PreviewEndpoint from './PreviewEndpoint';
66
import { User } from './User';
77

@@ -24,7 +24,7 @@ export class Reaction extends GithubEntity {
2424
};
2525
}
2626

27-
export const ReactionResource = createGithubResource({
27+
export const ReactionResource = githubResource({
2828
path: '/repos/:owner/:repo/issues/:number/reactions/:id',
2929
schema: Reaction,
3030
Endpoint: PreviewEndpoint,

0 commit comments

Comments
 (0)