Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Sachs <[email protected]>
  • Loading branch information
paul-sachs committed Oct 9, 2024
1 parent 60077ef commit 4a215e4
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function useQuery<
>(
schema: DescMethodUnary<I, O>,
input?: SkipToken | MessageInitShape<I>,
{ transport, ...queryOptions }: UseQueryOptions<I, O, SelectOutData> = {},
{ transport, ...queryOptions }: UseQueryOptions<I, O, SelectOutData> = {}
): UseQueryResult<SelectOutData, ConnectError>;
```

Expand Down Expand Up @@ -232,7 +232,7 @@ function useInfiniteQuery<
pageParamKey,
getNextPageParam,
...queryOptions
}: UseInfiniteQueryOptions<I, O, ParamKey>,
}: UseInfiniteQueryOptions<I, O, ParamKey>
): UseInfiniteQueryResult<InfiniteData<MessageShape<O>>, ConnectError>;
```

Expand All @@ -249,7 +249,7 @@ Identical to useInfiniteQuery but mapping to the `useSuspenseInfiniteQuery` hook
```ts
function useMutation<I extends DescMessage, O extends DescMessage>(
schema: DescMethodUnary<I, O>,
{ transport, ...queryOptions }: UseMutationOptions<I, O, Ctx> = {},
{ transport, ...queryOptions }: UseMutationOptions<I, O, Ctx> = {}
): UseMutationResult<MessageShape<O>, ConnectError, PartialMessage<I>>;
```

Expand All @@ -261,7 +261,7 @@ Any additional `options` you pass to `useMutation` will be merged with the optio

```ts
function createConnectQueryKey<Desc extends DescMethod | DescService>(
params: KeyParams<Desc>,
params: KeyParams<Desc>
): ConnectQueryKey;
```

Expand All @@ -286,6 +286,7 @@ const queryKey = createConnectQueryKey({
transport: myTransport,
// You can provide a partial message here.
input: { sentence: "hello" },
cardinality: "finite",
});

// queryKey:
Expand All @@ -309,6 +310,7 @@ import { ElizaService } from "./gen/eliza_pb";

const queryKey = createConnectQueryKey({
schema: ElizaService,
cardinality: "finite",
});

// queryKey:
Expand Down Expand Up @@ -346,7 +348,7 @@ function callUnaryMethod<I extends DescMessage, O extends DescMessage>(
input: MessageInitShape<I> | undefined,
options?: {
signal?: AbortSignal;
},
}
): Promise<O>;
```

Expand All @@ -369,6 +371,7 @@ queryClient.setQueryData(
schema: example,
transport,
input: {},
cardinality: "finite",
}),
createProtobufSafeUpdater(example, (prev) => {
if (prev === undefined) {
Expand All @@ -393,7 +396,7 @@ function createQueryOptions<I extends DescMessage, O extends DescMessage>(
transport,
}: {
transport: Transport;
},
}
): {
queryKey: ConnectQueryKey;
queryFn: QueryFunction<MessageShape<O>, ConnectQueryKey> | SkipToken;
Expand Down Expand Up @@ -436,7 +439,7 @@ function createInfiniteQueryOptions<
transport,
getNextPageParam,
pageParamKey,
}: ConnectInfiniteQueryOptions<I, O, ParamKey>,
}: ConnectInfiniteQueryOptions<I, O, ParamKey>
): {
getNextPageParam: ConnectInfiniteQueryOptions<
I,
Expand Down Expand Up @@ -470,7 +473,7 @@ const transport = addStaticKeyToTransport(
createConnectTransport({
baseUrl: "https://demo.connectrpc.com",
}),
"demo",
"demo"
);
```

Expand Down Expand Up @@ -606,6 +609,7 @@ function prefetch() {
schema: say,
transport: myTransport,
input: { sentence: "Hello" },
cardinality: "finite",
}),
queryFn: () => callUnaryMethod(myTransport, say, { sentence: "Hello" }),
});
Expand Down

0 comments on commit 4a215e4

Please sign in to comment.