@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.
- package/CHANGELOG.md +7 -0
- package/dist/client/client.gen.d.ts +3 -0
- package/dist/client/client.gen.d.ts.map +1 -0
- package/dist/client/client.gen.js +234 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +6 -0
- package/dist/client/types.gen.d.ts +118 -0
- package/dist/client/types.gen.d.ts.map +1 -0
- package/dist/client/types.gen.js +2 -0
- package/dist/client/utils.gen.d.ts +34 -0
- package/dist/client/utils.gen.d.ts.map +1 -0
- package/dist/client/utils.gen.js +228 -0
- package/dist/client.gen.d.ts +13 -0
- package/dist/client.gen.d.ts.map +1 -0
- package/dist/client.gen.js +3 -0
- package/dist/core/auth.gen.d.ts +19 -0
- package/dist/core/auth.gen.d.ts.map +1 -0
- package/dist/core/auth.gen.js +14 -0
- package/dist/core/bodySerializer.gen.d.ts +26 -0
- package/dist/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/core/bodySerializer.gen.js +57 -0
- package/dist/core/params.gen.d.ts +44 -0
- package/dist/core/params.gen.d.ts.map +1 -0
- package/dist/core/params.gen.js +100 -0
- package/dist/core/pathSerializer.gen.d.ts +34 -0
- package/dist/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/core/pathSerializer.gen.js +106 -0
- package/dist/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/core/queryKeySerializer.gen.js +92 -0
- package/dist/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/core/serverSentEvents.gen.js +133 -0
- package/dist/core/types.gen.d.ts +79 -0
- package/dist/core/types.gen.d.ts.map +1 -0
- package/dist/core/types.gen.js +2 -0
- package/dist/core/utils.gen.d.ts +20 -0
- package/dist/core/utils.gen.d.ts.map +1 -0
- package/dist/core/utils.gen.js +87 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/sdk.gen.d.ts +494 -0
- package/dist/sdk.gen.d.ts.map +1 -0
- package/dist/sdk.gen.js +1232 -0
- package/dist/startClient.d.ts +24 -0
- package/dist/startClient.d.ts.map +1 -0
- package/dist/startClient.js +49 -0
- package/dist/types.gen.d.ts +14551 -0
- package/dist/types.gen.d.ts.map +1 -0
- package/dist/types.gen.js +2 -0
- 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
|
+
};
|