@@ -18,14 +18,13 @@ your React app at the root or layout component. For example:
1818
1919``` tsx
2020import { QueryClient , QueryClientProvider } from " @tanstack/react-query" ;
21- import { SDKCore } from " @speakeasyapi/code-samples" ;
22- import { SDKProvider } from " @speakeasyapi/code-samples/react-query" ;
21+ import { SpeakeasyCodeSamplesCore } from " @speakeasyapi/code-samples" ;
22+ import { SpeakeasyCodeSamplesProvider } from " @speakeasyapi/code-samples/react-query" ;
2323
2424const queryClient = new QueryClient ();
25- const sdk = new SDKCore ({
26- security: {
27- apiKey: " <YOUR_API_KEY_HERE>" ,
28- },
25+ const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore ({
26+ apiKey: " <YOUR_API_KEY_HERE>" ,
27+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source" ,
2928});
3029
3130// Retries are handled by the underlying SDK.
@@ -35,9 +34,9 @@ queryClient.setMutationDefaults(["@speakeasyapi/code-samples"], { retry: false }
3534export function App() {
3635 return (
3736 <QueryClientProvider client = { queryClient } >
38- <SDKProvider client = { sdk } >
37+ <SpeakeasyCodeSamplesProvider client = { speakeasyCodeSamples } >
3938 { /* Your app logic starts here */ }
40- </SDKProvider >
39+ </SpeakeasyCodeSamplesProvider >
4140 </QueryClientProvider >
4241 );
4342}
@@ -56,7 +55,7 @@ import { useCodeSamplesGet } from "@speakeasyapi/code-samples/react-query/codeSa
5655
5756export function Example() {
5857 const { data, error, status } = useCodeSamplesGet ({
59- registryUrl: " https://normal-making.name " ,
58+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source " ,
6059 });
6160
6261 // Render the UI here...
@@ -76,7 +75,7 @@ export function ExampleWithOptions() {
7675 const [enabled, setEnabled] = useState (true );
7776 const { data, error, status } = useCodeSamplesGet (
7877 {
79- registryUrl: " https://normal-making.name " ,
78+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source " ,
8079 },
8180 {
8281 // TanStack Query options:
@@ -158,21 +157,20 @@ hooks that integrate neatly with React Suspense.
158157import { QueryClient , QueryClientProvider } from " @tanstack/react-query" ;
159158import { ErrorBoundary } from " react-error-boundary" ;
160159
161- import { SDKCore } from " @speakeasyapi/code-samples" ;
162- import { SDKProvider } from " @speakeasyapi/code-samples/react-query" ;
160+ import { SpeakeasyCodeSamplesCore } from " @speakeasyapi/code-samples" ;
161+ import { SpeakeasyCodeSamplesProvider } from " @speakeasyapi/code-samples/react-query" ;
163162import { useCodeSamplesGetSuspense } from " @speakeasyapi/code-samples/react-query/codeSamplesGet.js" ;
164163
165164const queryClient = new QueryClient ();
166- const sdk = new SDKCore ({
167- security: {
168- apiKey: " <YOUR_API_KEY_HERE>" ,
169- },
165+ const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore ({
166+ apiKey: " <YOUR_API_KEY_HERE>" ,
167+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source" ,
170168});
171169
172170export function App() {
173171 return (
174172 <QueryClientProvider client = { queryClient } >
175- <SDKProvider client = { sdk } >
173+ <SpeakeasyCodeSamplesProvider client = { speakeasyCodeSamples } >
176174 <QueryErrorResetBoundary >
177175 { ({ reset }) => (
178176 <ErrorBoundary
@@ -191,14 +189,14 @@ export function App() {
191189 </ErrorBoundary >
192190 )}
193191 </QueryErrorResetBoundary >
194- </SDKProvider >
192+ </SpeakeasyCodeSamplesProvider >
195193 </QueryClientProvider >
196194 );
197195}
198196
199197function Example() {
200198 const { data } = useCodeSamplesGetSuspense ({
201- registryUrl: " https://normal-making.name " ,
199+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source " ,
202200 });
203201
204202 // Render the UI here...
@@ -218,19 +216,18 @@ import {
218216 HydrationBoundary ,
219217 QueryClient ,
220218} from " @tanstack/react-query" ;
221- import { SDKCore } from " @speakeasyapi/code-samples" ;
219+ import { SpeakeasyCodeSamplesCore } from " @speakeasyapi/code-samples" ;
222220import { prefetchCodeSamplesGet } from " @speakeasyapi/code-samples/react-query/codeSamplesGet.js" ;
223221
224222export default async function Page() {
225223 const queryClient = new QueryClient ();
226- const sdk = new SDKCore ({
227- security: {
228- apiKey: " <YOUR_API_KEY_HERE>" ,
229- },
224+ const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore ({
225+ apiKey: " <YOUR_API_KEY_HERE>" ,
226+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source" ,
230227 });
231228
232- await prefetchCodeSamplesGet (queryClient , sdk , {
233- registryUrl: " https://normal-making.name " ,
229+ await prefetchCodeSamplesGet (queryClient , speakeasyCodeSamples , {
230+ registryUrl: " https://spec.speakeasy.com/org/ws/my-source " ,
234231 });
235232
236233 return (
0 commit comments