@wallaby-cash/api-client 0.0.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/client/client.gen.d.ts +3 -0
  3. package/dist/client/client.gen.d.ts.map +1 -0
  4. package/dist/client/client.gen.js +234 -0
  5. package/dist/client/index.d.ts +9 -0
  6. package/dist/client/index.d.ts.map +1 -0
  7. package/dist/client/index.js +6 -0
  8. package/dist/client/types.gen.d.ts +118 -0
  9. package/dist/client/types.gen.d.ts.map +1 -0
  10. package/dist/client/types.gen.js +2 -0
  11. package/dist/client/utils.gen.d.ts +34 -0
  12. package/dist/client/utils.gen.d.ts.map +1 -0
  13. package/dist/client/utils.gen.js +228 -0
  14. package/dist/client.gen.d.ts +13 -0
  15. package/dist/client.gen.d.ts.map +1 -0
  16. package/dist/client.gen.js +3 -0
  17. package/dist/core/auth.gen.d.ts +19 -0
  18. package/dist/core/auth.gen.d.ts.map +1 -0
  19. package/dist/core/auth.gen.js +14 -0
  20. package/dist/core/bodySerializer.gen.d.ts +26 -0
  21. package/dist/core/bodySerializer.gen.d.ts.map +1 -0
  22. package/dist/core/bodySerializer.gen.js +57 -0
  23. package/dist/core/params.gen.d.ts +44 -0
  24. package/dist/core/params.gen.d.ts.map +1 -0
  25. package/dist/core/params.gen.js +100 -0
  26. package/dist/core/pathSerializer.gen.d.ts +34 -0
  27. package/dist/core/pathSerializer.gen.d.ts.map +1 -0
  28. package/dist/core/pathSerializer.gen.js +106 -0
  29. package/dist/core/queryKeySerializer.gen.d.ts +19 -0
  30. package/dist/core/queryKeySerializer.gen.d.ts.map +1 -0
  31. package/dist/core/queryKeySerializer.gen.js +92 -0
  32. package/dist/core/serverSentEvents.gen.d.ts +72 -0
  33. package/dist/core/serverSentEvents.gen.d.ts.map +1 -0
  34. package/dist/core/serverSentEvents.gen.js +133 -0
  35. package/dist/core/types.gen.d.ts +79 -0
  36. package/dist/core/types.gen.d.ts.map +1 -0
  37. package/dist/core/types.gen.js +2 -0
  38. package/dist/core/utils.gen.d.ts +20 -0
  39. package/dist/core/utils.gen.d.ts.map +1 -0
  40. package/dist/core/utils.gen.js +87 -0
  41. package/dist/index.d.ts +3 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +2 -0
  44. package/dist/sdk.gen.d.ts +494 -0
  45. package/dist/sdk.gen.d.ts.map +1 -0
  46. package/dist/sdk.gen.js +1232 -0
  47. package/dist/startClient.d.ts +24 -0
  48. package/dist/startClient.d.ts.map +1 -0
  49. package/dist/startClient.js +49 -0
  50. package/dist/types.gen.d.ts +14551 -0
  51. package/dist/types.gen.d.ts.map +1 -0
  52. package/dist/types.gen.js +2 -0
  53. package/package.json +54 -0
@@ -0,0 +1,24 @@
1
+ import type { WallabyConfig } from './index';
2
+ /**
3
+ * Creates and configures a Wallaby API client instance
4
+ *
5
+ * @param config - WallabyConfig object containing API credentials and options
6
+ * @returns Configured client instance ready to make API calls
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const client = startClient({
11
+ * apiKey: 'your-api-key',
12
+ * environment: 'staging',
13
+ * network: 'testnet',
14
+ * clientAuthToken: 'your-client-jwt',
15
+ * userId: 'user-123',
16
+ * options: {
17
+ * requestId: 'request-123',
18
+ * headers: { 'Custom-Header': 'value' }
19
+ * }
20
+ * });
21
+ * ```
22
+ */
23
+ export declare const startClient: (config: WallabyConfig) => import("./client").Client;
24
+ //# sourceMappingURL=startClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startClient.d.ts","sourceRoot":"","sources":["../src/startClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,aAAa,8BA6BhD,CAAC"}
@@ -0,0 +1,49 @@
1
+ // This file implements the startClient wrapper for the auto-generated API client
2
+ import { createClient, createConfig } from './client';
3
+ /**
4
+ * Creates and configures a Wallaby API client instance
5
+ *
6
+ * @param config - WallabyConfig object containing API credentials and options
7
+ * @returns Configured client instance ready to make API calls
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const client = startClient({
12
+ * apiKey: 'your-api-key',
13
+ * environment: 'staging',
14
+ * network: 'testnet',
15
+ * clientAuthToken: 'your-client-jwt',
16
+ * userId: 'user-123',
17
+ * options: {
18
+ * requestId: 'request-123',
19
+ * headers: { 'Custom-Header': 'value' }
20
+ * }
21
+ * });
22
+ * ```
23
+ */
24
+ export const startClient = (config) => {
25
+ // Construct baseUrl from environment and network
26
+ const environment = config.environment || 'staging';
27
+ const network = config.network || 'testnet';
28
+ const baseUrl = `https://${environment}-${network}.wallaby.cash`;
29
+ // Construct headers object with required and optional headers
30
+ const headers = {
31
+ 'x-client-jwt': config.clientAuthToken,
32
+ };
33
+ // Add request ID if provided for better traceability in logs
34
+ if (config.options?.requestId) {
35
+ headers['x-client-request-id'] = config.options.requestId;
36
+ }
37
+ // Merge custom headers from options
38
+ if (config.options?.headers) {
39
+ Object.assign(headers, config.options.headers);
40
+ }
41
+ // Create and return the configured client
42
+ return createClient(createConfig({
43
+ baseUrl,
44
+ auth: config.apiKey, // Maps to X-API-KEY header
45
+ headers,
46
+ // Optional: Could add error handling here if needed
47
+ // throwOnError: false, // Default behavior
48
+ }));
49
+ };