reactive/data-client / .agents/skills/data-client-rest-setup
data-client-rest-setup
VerifiedSet up and migrate to @data-client/rest for REST APIs. Detects existing HTTP patterns (axios, fetch, ky, superagent, got) and migrates them. Creates custom RestEndpoint base class with common behaviors. Use when adopting @data-client/rest in a new or existing project.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.5 KB |
| evals/evals.json | config | 2.8 KB |
| references.json | config | 386 B |
| references/RestEndpoint.md | markdown | 45.2 KB |
| references/RestEndpoint.vue.md | markdown | 46.1 KB |
| references/auth.md | markdown | 9.4 KB |
| references/auth.vue.md | markdown | 9.7 KB |
| references/axios-migration.md | markdown | 25.4 KB |
| references/axios-migration.vue.md | markdown | 25.5 KB |
| references/django.md | markdown | 2.3 KB |
| references/fetch-migration.md | markdown | 3.8 KB |
| references/got-migration.md | markdown | 4.3 KB |
| references/hookifyResource.md | markdown | 6.0 KB |
| references/hookifyResource.vue.md | markdown | 6.3 KB |
| references/ky-migration.md | markdown | 3.8 KB |
| references/resource.md | markdown | 27.0 KB |
| references/resource.vue.md | markdown | 27.1 KB |
| references/superagent-migration.md | markdown | 4.0 KB |
references/resource.md
View on GitHub<!-- Generated by `yarn build:skills` from docs/rest/api/resource.md (react). Edit the source doc, not this file. -->
# Resource
`Resources` are a collection of [RestEndpoints](./RestEndpoint.md) that operate on a common
data by sharing a [schema](https://dataclient.io/rest/api/schema)
## Usage
```ts title="resources/Todo.ts"
export class Todo extends Entity {
id = '';
title = '';
completed = false;
static key = 'Todo';
}
const TodoResource = resource({
urlPrefix: 'https://jsonplaceholder.typicode.com',
path: '/todos/:id',
schema: Todo,
});
```
```ts title="Resources start with 6 Endpoints"
const todo = useSuspense(TodoResource.get, { id: '5' });
const todos = useSuspense(TodoResource.getList);
controller.fetch(TodoResource.getList.push, {
title: 'finish installing reactive data client',
});
controller.fetch(
TodoResource.update,
{ id: '5' },
{ ...todo, completed: true },
);
controller.fetch(
TodoResource.partialUpdate,
{ id: '5' },
{ completed: true },
);
controller.fetch(TodoResource.delete, { id: '5' });
```
## Arguments
```ts
{
path: string;
schema: Schema;
urlPrefix?: string;
body?: any;
searchParams?: any;
paginationField?: string;
optimistic?: boolean;
Endpoint?: typeof RestEndpoint;
Collection?: typeof Collection;
} & EndpointExtraOptions
```
### path
Passed to [RestEndpoint.path](./RestEndpoint.md#path) for single item [endpoints](#members).
Uses [path-to-regexp v8](https://github.com/pillarjs/path-to-regexp) syntax — see
[RestEndpoint.path](./RestEndpoint.md#path) for full details on
[optional parameters](./RestEndpoint.md#path), [wildcards](./RestEndpoint.md#path),
[quoted names](./RestEndpoint.md#path), and [escaping](./RestEndpoint.md#path).
Create ([getList.push](#push)/[getList.unshift](#unshift)) and [getList](#getlist) remove the last `:param` or `*wildcard` token.
```ts
const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
});
// GET /react/posts/abc
PostResource.get({ group: 'react', id: 'abc' });
// PATCH /react/posts/abc
PostResource.partialUpdate({ group: 'react', id: 'abc' }, { title: 'This new title' });
// GET /react/posts
PostResource.getList({ group: 'react' });
```
Optional parameters use `{}` syntax:
```ts
const PostResource = resource({
schema: Post,
path: '/:group/posts{/:id}',
});
PostResource.get({ group: 'react', id: 'abc' });
PostResource.getList({ group: 'react' });
```
Wildcard parameters are also supported as the last token:
```ts
const FileResource = resource({
schema: File,
path: '/repos/:owner/*path',
});
// GET /repos/john/src/index.ts
FileResource.get({ owner: 'john', path: ['src', 'index.ts'] });
// GET /repos/john
FileResource.getList({ owner: 'john' });
```
### schema
Passed to [RestEndpoint.schema](./RestEndpoint.md#schema) representing a single item. This is usually
an [Entity](https://dataclient.io/rest/api/Entity) or [Union](https://dataclient.io/rest/api/Union).
- [getList](#getlist) uses an [Array](https://dataclient.io/rest/api/Array) [Collection](https://dataclient.io/rest/api/Collection) of the schema.
- [delete](#delete) uses a [Invalidate](https://dataclient.io/rest/api/Invalidate) of the schema.
### urlPrefix
Passed to [RestEndpoint.urlPrefix](./RestEndpoint.md#urlPrefix)
### searchParams
Passed to [RestEndpoint.searchParams](./RestEndpoint.md#searchParams) for [getList](#getlist) and [getList.push](#push)
### body
Passed to [RestEndpoint.body](./RestEndpoint.md#body) for [getList.push](#push) [update](#update) and [partialUpdate](#partialupdate)
### paginationField
If specified, will add [Resource.getList.getPage](#getpage) method on the `Resource`.
### nonFilterArgumentKeys
Pass-through option to [Collection.nonFilterArgumentKeys](https://dataclient.io/rest/api/Collection#nonFilterArgumentKeys)
for [getList](#getlist) schema.
```ts
const PostResource = resource({
path: '/:group/posts/:id',
searchParams: {} as { orderBy?: string; author?: string },
schema: Post,
nonFilterArgumentKeys: ['orderBy'],
});
```
`RegExp` and function forms are also supported:
```ts
resource({
path: '/:group/posts/:id',
searchParams: {} as { orderBy?: string; author?: string },
schema: Post,
nonFilterArgumentKeys: /orderBy/,
});
```
### optimistic
`true` makes all mutation endpoints [optimistic](https://dataclient.io/rest/guides/optimistic-updates), making UI
updates immediate, even before fetch completion.
### Endpoint
Class used to construct the members.
```ts
import { RestEndpoint } from '@data-client/rest';
export default class AuthdEndpoint<
O extends RestGenerics = any,
> extends RestEndpoint<O> {
async getRequestInit(body: any): Promise<RequestInit> {
return {
...(await super.getRequestInit(body)),
credentials: 'same-origin',
};
}
}
const TodoResource = resource({
path: '/todos/:id',
schema: Todo,
Endpoint: AuthdEndpoint,
});
```
### Collection
[Collection Class](https://dataclient.io/rest/api/Collection) used to construct [getList](#getlist) schema.
Use this when you need to customize collection behavior beyond
[`nonFilterArgumentKeys`](#nonfilterargumentkeys), like changing move merge logic.
```ts
import { resource, Collection, unshift } from '@data-client/rest';
class MyCollection<
S extends any[] | PolymorphicInterface = any,
Parent extends any[] = [urlParams: any, body?: any],
> extends Collection<S, Parent> {
constructor(schema: S) {
super(schema);
// prepend moved items instead of appending
this.move = this.moveWith(unshift);
}
}
const TodoResource = resource({
path: '/todos/:id',
searchParams: {} as { userId?: string; orderBy?: string } | undefined,
schema: Todo,
Collection: MyCollection,
});
```
### [EndpointExtraOptions](./RestEndpoint.md#dataexpirylength)
dataExpiryLength, errorExpiryLength, errorPolicy, invalidIfStale, pollFrequency
## Members
These provide the standard [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete)
[endpoints](https://dataclient.io/rest/api/Endpoint)s common in [REST](https://www.restapitutorial.com/) APIs. Feel free to [customize or add
new endpoints](#extend-new) based to match your API.
```ts
const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
paginationField: 'page',
});
```
| Name | Method | Args | Schema |
| --------------------------- | -------------------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------- |
| [get](#get) | [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) | `[{group: string; id: string}]` | [Post](https://dataclient.io/rest/api/Entity) |
| [getList](#getlist) | [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) | `[{group: string; author?: string}]` | [Collection(\[Post\])](https://dataclient.io/rest/api/Collection) |
| [getList.push](#push) | [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) | `[{group: string; author?: string}, Partial<Post>]` | [Collection(\[Post\]).push](https://dataclient.io/rest/api/Collection#push) |
| [getList.unshift](#unshift) | [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) | `[{group: string; author?: string}, Partial<Post>]` | [Collection(\[Post\]).unshift](https://dataclient.io/rest/api/Collection#unshift) |
| [getList.getPage](#getpage) | [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) | `[{group: string; author?: string; page: string}]` | [Collection(\[Post\]).addWith](https://dataclient.io/rest/api/Collection#addWith) |
| [getList.move](#move) | [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) | `[{group: string; id: string }, Partial<Post>]` | [Collection(\[Post\]).move](https://dataclient.io/rest/api/Collection#move) |
| [update](#update) | [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) | `[{group: string; id: string }, Partial<Post>]` | [Post](https://dataclient.io/rest/api/Entity) |
| [partialUpdate](#update) | [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) | `[{group: string; id: string }, Partial<Post>]` | [Post](https://dataclient.io/rest/api/Entity) |
| [delete](#delete) | [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) | `[{group: string; id: string }]` | [Invalidate(Post)](https://dataclient.io/rest/api/Invalidate) |
### get
Retrieve a singular entity.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.get({
group: 'react',
id: '1',
});
```
| Field | Value |
| :----: | ----------------- |
| method | 'GET' |
| path | [path](#path) |
| schema | [schema](#schema) |
Commonly used with [useSuspense()](https://dataclient.io/docs/api/useSuspense), [Controller.invalidate](https://dataclient.io/docs/api/Controller#invalidate), [Controller.expireAll](https://dataclient.io/docs/api/Controller#expireAll)
### getList
Retrieve a list of entities.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.getList({
group: 'react',
author: 'clara',
});
```
| Field | Value |
| :-------------: | ----------------------------------------------------------------------- |
| method | 'GET' |
| path | removeLastArg([path](#path)) |
| searchParams | [searchParams](#searchparams) |
| paginationField | [paginationField](#paginationfield) |
| schema | [new Collection(\[schema\])](https://dataclient.io/rest/api/Collection) |
```ts
resource({ path: '/:first/:second' }).getList.path === '/:first';
resource({ path: '/:first' }).getList.path === '/';
resource({ path: '/:owner/*path' }).getList.path === '/:owner';
```
Commonly used with [useSuspense()](https://dataclient.io/docs/api/useSuspense), [Controller.invalidate](https://dataclient.io/docs/api/Controller#invalidate), [Controller.expireAll](https://dataclient.io/docs/api/Controller#expireAll)
### getList.push {#push}
[RestEndpoint.push](./RestEndpoint.md#push) creates a new entity and pushes it to the end of getList. Use [getList.unshift](#unshift)
to place at the beginning instead. Pass an array as the body to create several at once.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.getList.push(
{ group: 'react', author: 'clara' },
{ title: 'winning' },
);
```
| Field | Value |
| :----------: | --------------------------------------------------------------------- |
| method | 'POST' |
| path | removeLastArg([path](#path)) |
| searchParams | [searchParams](#searchparams) |
| body | [body](#body) |
| schema | getList.[schema.push](https://dataclient.io/rest/api/Collection#push) |
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
### getList.unshift {#unshift}
[RestEndpoint.unshift](./RestEndpoint.md#unshift) creates a new entity and pushes it to the beginning of getList.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.getList.unshift(
{ group: 'react', author: 'clara' },
{ title: 'winning' },
);
```
| Field | Value |
| :----------: | --------------------------------------------------------------------------- |
| method | 'POST' |
| path | removeLastArg([path](#path)) |
| searchParams | [searchParams](#searchparams) |
| body | [body](#body) |
| schema | getList.[schema.unshift](https://dataclient.io/rest/api/Collection#unshift) |
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
### getList.getPage {#getpage}
[RestEndpoint.getPage](./RestEndpoint.md#getpage) retrieves another [page](https://dataclient.io/rest/guides/pagination#infinite-scrolling) appending to getList ensuring there are no duplicates.
This member is only available when [paginationField](#paginationfield) is specified.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
paginationField: 'page',
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.getList.getPage({
group: 'react',
author: 'clara',
page: 2,
});
```
| Field | Value |
| :-------------: | --------------------------------------------------------------------------- |
| method | 'GET' |
| path | removeLastArg([path](#path)) |
| searchParams | [searchParams](#searchparams) |
| paginationField | [paginationField](#paginationfield) |
| schema | [getList.schema.addWith](https://dataclient.io/rest/api/Collection#addWith) |
args: `PathToArgs(shortenPath(path)) & searchParams & \{ [paginationField]: string | number \}`
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
### getList.move {#move}
[RestEndpoint.move](./RestEndpoint.md#move) moves an entity between [Collections](https://dataclient.io/rest/api/Collection) by removing it from
collections matching its old state and adding it to collections matching the new values from the body.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.getList.move(
{ group: 'react', id: '1' },
{ group: 'vue' },
);
```
| Field | Value |
| :----: | --------------------------------------------------------------------- |
| method | 'PATCH' |
| path | [path](#path) |
| body | [body](#body) |
| schema | getList.[schema.move](https://dataclient.io/rest/api/Collection#move) |
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
### update
Update an entity.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.update(
{ group: 'react', id: '1' },
{ title: 'updated title', author: 'clara' },
);
```
| Field | Value |
| :----: | ----------------- |
| method | 'PUT' |
| path | [path](#path) |
| body | [body](#body) |
| schema | [schema](#schema) |
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
### partialUpdate
Update some subset of fields of an entity.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.partialUpdate(
{ group: 'react', id: '1' },
{ title: 'updated title' },
);
```
| Field | Value |
| :----: | ----------------- |
| method | 'PATCH' |
| path | [path](#path) |
| body | [body](#body) |
| schema | [schema](#schema) |
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
### delete
Deletes an entity.
```typescript title="Post"
import { Entity } from '@data-client/rest';
export default class Post extends Entity {
id = '';
title = '';
group = '';
author = '';
}
```
```typescript title="Resource"
import { resource } from '@data-client/rest';
import Post from './Post';
export const PostResource = resource({
schema: Post,
path: '/:group/posts/:id',
searchParams: {} as { author?: string },
});
```
```typescript title="Usage" column
import { PostResource } from './Resource';
PostResource.delete({ group: 'react', id: '1' });
```
| Field | Value |
| :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| method | 'DELETE' |
| path | [path](#path) |
| schema | [new Invalidate(schema)](https://dataclient.io/rest/api/Invalidate) |
| process | ```ts
(value, params) {
// the resource's or Endpoint class's process()
value = value && Object.keys(value).length && super.process(value, params);
return value && Object.keys(value).length ? value : params;
},
``` |
Commonly used with [Controller.fetch](https://dataclient.io/docs/api/Controller#fetch)
#### Response
```json
{ "id": "xyz" }
```
Response should either be the [pk](https://dataclient.io/rest/api/Entity#pk) as a string (like `'xyz'`). Or an object with the members needed to compute
[Entity.pk](https://dataclient.io/rest/api/Entity#pk) (like `{id: 'xyz'}`).
If no response is provided, the `process` implementation will attempt to use the url parameters sent as an object to compute
the [Entity.pk](https://dataclient.io/rest/api/Entity#pk). This enables the default implementation to still work with no response, so long as standard
arguments are used.
This allows [Invalidate](https://dataclient.io/rest/api/Invalidate) to remove the entity from the [entity table](https://dataclient.io/docs/concepts/normalization)
### extend() {#extend}
`resource` builds a great starting point, but often endpoints need to be [further customized](./RestEndpoint.md#typing).
`extend()` is polymorphic with three forms:
#### Function form (to get BaseResource/super) {#extend-function}
This is the most flexible, but also the most verbose.
```ts
export const IssueResource= resource({
path: '/repos/:owner/:repo/issues/:number',
schema: Issue,
pollFrequency: 60000,
searchParams: {} as IssueFilters | undefined,
}).extend(BaseResource => ({
search: BaseResource.getList.extend({
path: '/search/issues?{q=:q}%20repo\\::owner/:repo%20is\\:issue{&page=:page}',
schema: {
results: {
incompleteResults: false,
items: BaseIssueResource.getList.schema.results,
totalCount: 0,
},
link: '',
},
})
)});
```
#### Batch extension of known members {#extend-override}
This only works with existing members.
```ts
export const CommentResource = resource({
path: '/repos/:owner/:repo/issues/comments/:id',
schema: Comment,
}).extend({
getList: { path: '/repos/:owner/:repo/issues/:number/comments' },
update: { body: { body: '' } },
});
```
#### Adding new members {#extend-new}
This can only add one endpoint at a time.
```ts
export const UserResource = createGithubResource({
path: '/users/:login',
schema: User,
}).extend('current', {
path: '/user',
schema: User,
});
```
#### Github CommentResource
Example app: [github-app](https://github.com/reactive/data-client/tree/master/examples/github-app) ([`src/pages/IssueDetail/CommentsList.tsx`](https://github.com/reactive/data-client/blob/master/examples/github-app/src/pages/IssueDetail/CommentsList.tsx), [`src/resources/Comment.ts`](https://github.com/reactive/data-client/blob/master/examples/github-app/src/resources/Comment.ts))
## Function Inheritance Patterns
To reuse code related to `Resource` definitions, you can create your own function that calls resource().
This has similar effects as class-based inheritance, with the added benefit of allowing for complete
typing overrides.
```typescript
import {
resource,
RestEndpoint,
Collection,
type EndpointExtraOptions,
type RestGenerics,
type ResourceGenerics,
type ResourceOptions,
} from '@data-client/rest';
export class AuthdEndpoint<
O extends RestGenerics = any,
> extends RestEndpoint<O> {
urlPrefix = process.env.API_SERVER ?? 'http://localhost:8000';
async getRequestInit(body: any): Promise<RequestInit> {
return {
...(await super.getRequestInit(body)),
credentials: 'same-origin',
};
}
}
export function myResource<O extends ResourceGenerics = any>({
schema,
Endpoint = AuthdEndpoint,
...extraOptions
}: Readonly<O> & ResourceOptions) {
return resource({
Endpoint,
schema,
...extraOptions,
}).extend({
getList: {
schema: {
results: new Collection([schema]),
total: 0,
limit: 0,
skip: 0,
},
},
});
}
```
### GraphQL + REST Hybrid
When your API provides both REST and GraphQL endpoints, you can mix them in a single resource.
Use [Entity.process()](https://dataclient.io/rest/api/Entity#process) to normalize different response shapes.
```typescript
import { GQLEndpoint } from '@data-client/graphql';
import { Entity, resource } from '@data-client/rest';
const gql = new GQLEndpoint('https://api.myservice.com/graphql');
export class Repository extends Entity {
id = '';
name = '';
owner = { login: '' };
stargazersCount = 0;
forksCount = 0;
pk() {
return `${this.owner.login}/${this.name}`;
}
static key = 'Repository';
}
/** Normalizes GraphQL response shape to match REST Entity */
export class GqlRepository extends Repository {
static process(input: any, parent: any, key: string | undefined) {
// GraphQL uses different field names than REST
if ('stargazerCount' in input) {
return {
...input,
stargazersCount: input.stargazerCount,
forksCount: input.forkCount,
};
}
return input;
}
}
export const RepositoryResource = resource({
path: '/repos/:owner/:repo',
schema: Repository,
}).extend(base => ({
// REST endpoint for single repo
get: base.get,
// GraphQL endpoint for user's pinned repos
getByPinned: gql.query(
(v: { login: string }) => `query ($login: String!) {
user(login: $login) {
pinnedItems(first: 6, types: REPOSITORY) {
nodes {
... on Repository {
id
name
owner { login }
stargazerCount
forkCount
}
}
}
}
}`,
{ user: { pinnedItems: { nodes: [GqlRepository] } } },
),
}));
```
#### Github Example
Example app: [github-app](https://github.com/reactive/data-client/tree/master/examples/github-app) ([`src/resources/Base.ts`](https://github.com/reactive/data-client/blob/master/examples/github-app/src/resources/Base.ts))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |