@realforce-software/api-client 0.0.11 → 0.0.12

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 (2) hide show
  1. package/README.md +50 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Realforce API - TypeScript SDK
2
2
 
3
- Auto-generated TypeScript / JavaScript client SDK for the Realforce API.
3
+ TypeScript client SDK for the Realforce API.
4
4
 
5
- **Version:** 0.0.11
5
+ **Version:** 0.0.12
6
6
 
7
7
  ## Installation
8
8
 
@@ -10,34 +10,61 @@ Auto-generated TypeScript / JavaScript client SDK for the Realforce API.
10
10
  npm install @realforce-software/api-client
11
11
  ```
12
12
 
13
- ## Quick Start
13
+ ## Authentication
14
+
15
+ Use a Realforce **Personal Access Token (PAT)** — tokens are prefixed `rfk_`
16
+ or `rfp_`. Generate one in the Realforce dashboard. Send it as a Bearer token
17
+ in the `Authorization` header.
14
18
 
15
19
  ```typescript
16
- import { PropertyClient } from '@realforce-software/api-client';
20
+ import axios from 'axios';
21
+ import { RealforceApiClient } from '@realforce-software/api-client';
17
22
 
18
- const propertyClient = new PropertyClient({
19
- baseURL: 'https://api.realforce.com',
20
- headers: { Authorization: `Bearer ${yourJwtToken}` }
23
+ const http = axios.create({
24
+ headers: { Authorization: 'Bearer rfk_xxxxxxxxxxxxxxxx' }
21
25
  });
22
26
 
23
- const properties = await propertyClient.getProperties(hqId);
27
+ const client = new RealforceApiClient('https://api.realforce.com', http);
24
28
  ```
25
29
 
26
- ## Authentication
30
+ ## Workspace ID
31
+
32
+ Most endpoints are scoped to a workspace. The generated client surfaces this as
33
+ an `x_Workspace_ID` parameter (string GUID) on each method — pass the workspace
34
+ your token has access to on every call:
35
+
36
+ ```typescript
37
+ const workspaceId = '00000000-0000-0000-0000-000000000000';
38
+ const agent = await client.getAgent(agentId, workspaceId);
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ```typescript
44
+ import axios from 'axios';
45
+ import { RealforceApiClient } from '@realforce-software/api-client';
46
+
47
+ const http = axios.create({
48
+ headers: { Authorization: 'Bearer rfk_xxxxxxxxxxxxxxxx' }
49
+ });
50
+
51
+ const client = new RealforceApiClient('https://api.realforce.com', http);
27
52
 
28
- The Realforce API uses JWT Bearer token authentication. Obtain a JWT
29
- by authenticating with your AWS Cognito credentials through the Realforce
30
- authentication system, and include it in the `Authorization` header.
53
+ const workspaceId = '...';
54
+ const agents = await client.queryAgents(workspaceId, {});
55
+ ```
31
56
 
32
57
  ## Error Handling
33
58
 
59
+ The SDK throws `ApiException` for non-2xx responses, surfacing the status code
60
+ and parsed body:
61
+
34
62
  ```typescript
35
63
  try {
36
- const result = await client.someMethod();
64
+ const result = await client.getAgent(agentId, workspaceId);
37
65
  } catch (error: any) {
38
- if (error.response) {
39
- console.error('Status:', error.response.status);
40
- console.error('Body:', error.response.data);
66
+ if (error.status) {
67
+ console.error(`HTTP ${error.status}:`, error.response);
41
68
  } else if (error.request) {
42
69
  console.error('No response received:', error.request);
43
70
  } else {
@@ -48,17 +75,19 @@ try {
48
75
 
49
76
  ## Custom Axios Instance
50
77
 
78
+ The constructor's second argument accepts any pre-configured `AxiosInstance`,
79
+ so you can attach interceptors, set timeouts, retry, etc.:
80
+
51
81
  ```typescript
52
82
  import axios from 'axios';
53
- import { PropertyClient } from '@realforce-software/api-client';
83
+ import { RealforceApiClient } from '@realforce-software/api-client';
54
84
 
55
- const customAxios = axios.create({
56
- baseURL: 'https://api.realforce.com',
85
+ const http = axios.create({
57
86
  timeout: 30000,
58
87
  headers: { Authorization: `Bearer ${token}` }
59
88
  });
60
89
 
61
- const client = new PropertyClient({}, customAxios);
90
+ const client = new RealforceApiClient('https://api.realforce.com', http);
62
91
  ```
63
92
 
64
93
  ## Requirements
@@ -73,4 +102,4 @@ const client = new PropertyClient({}, customAxios);
73
102
 
74
103
  ---
75
104
 
76
- *This SDK was automatically generated. Do not edit the generated code directly.*
105
+ *This SDK is automatically generated from the Realforce OpenAPI spec.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realforce-software/api-client",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Auto-generated TypeScript client SDK for the Realforce API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",