@solomonai/stripe-sync-graphql-sdk 1.17.9 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,8 +13,7 @@ bun add @solomonai/stripe-sync-graphql-sdk
13
13
  ## Usage
14
14
 
15
15
  ```typescript
16
- import { createClient } from '@solomonai/stripe-sync-graphql-sdk'
17
- import { gql } from 'graphql-request'
16
+ import { createClient, createSdk } from '@solomonai/stripe-sync-graphql-sdk'
18
17
 
19
18
  // Create client with your API endpoint and credentials
20
19
  const client = createClient({
@@ -25,28 +24,27 @@ const client = createClient({
25
24
  },
26
25
  })
27
26
 
28
- // Query customers
29
- const query = gql`
30
- query GetCustomers($first: Int!) {
31
- customers(first: $first) {
32
- edges {
33
- node {
34
- id
35
- email
36
- name
37
- totalSpend
38
- }
39
- }
40
- pageInfo {
41
- hasNextPage
42
- endCursor
43
- }
44
- }
45
- }
46
- `
47
-
48
- const data = await client.request(query, { first: 10 })
49
- console.log(data.customers)
27
+ // Create typed SDK wrappers for common operations
28
+ const sdk = createSdk(client)
29
+
30
+ const { customers } = await sdk.listCustomers({ first: 10 })
31
+ console.log(customers?.edges?.[0]?.node?.email)
32
+ ```
33
+
34
+ ## React Hooks (Adapter-based)
35
+
36
+ The SDK provides hook factories that can be wired to your query library (for example, React Query):
37
+
38
+ ```typescript
39
+ import { createSdk, createSdkReactHooks } from '@solomonai/stripe-sync-graphql-sdk'
40
+ import { useQuery, useMutation } from '@tanstack/react-query'
41
+
42
+ const sdk = createSdk(client)
43
+ const hooks = createSdkReactHooks(sdk, { useQuery, useMutation })
44
+
45
+ // inside a React component
46
+ const customerQuery = hooks.useCustomer({ id: 'cus_123' })
47
+ const triggerSync = hooks.useTriggerSync()
50
48
  ```
51
49
 
52
50
  ## Available Types