node-behind-api-client 2.0.48 → 2.0.49

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 +153 -48
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,65 +1,170 @@
1
- # node-zecamp-api
1
+ # Node Behind API Client
2
2
 
3
- # API-requests
4
- Create a class instance
3
+ A comprehensive Node.js client library for interacting with the Behind.ai API ecosystem. This package provides seamless integration with multiple Behind.ai services including EasyJob recruitment management, GPT services, payments, storage, and more.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install node-behind-api-client
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Basic Setup
5
14
 
6
15
  ```javascript
7
- let zecamp = new BehindApiClient('https://127.0.0.1:4013', 'access_token_here');
16
+ const BehindApiClient = require('node-behind-api-client');
17
+
18
+ // Initialize the client
19
+ const behindAPI = new BehindApiClient('https://api.app.behind.ai', 'your-access-token');
20
+
21
+ // For self-signed certificates (development)
22
+ behindAPI.selfsigned = true;
8
23
  ```
9
24
 
10
- ## RefargCRMGetRecords
25
+ ### Simple Usage Example
11
26
 
12
27
  ```javascript
13
- let res = zecamp.RefargCRMGetRecords(
14
- 'eniro',// Database
15
- 'bygg', // Search query(string)
16
- {
17
- has_homepage: true, // Select profiles having homepage
18
- has_facebook: true, // Select profiles having email
19
- has_description: true, // Select profiles having textual description
20
- has_email: true, // Select profiles having email
21
- region: "STOCKHOLMS LÄN", // Filter companies by specific municipality.
22
- municipality: "Ekerö",
23
- postal_area: "FARSTA", // Example: ALBY, FARSTA
24
- },
25
- 0, // Page number
26
- 25 // Page size
27
- );
28
+ // Example: Create a company in EasyJob
29
+ async function createCompany() {
30
+ try {
31
+ const result = await behindAPI.easyjob.V10.companies.create("My Company");
32
+ console.log('Company created:', result);
33
+ } catch (error) {
34
+ console.error('Error:', error);
35
+ }
36
+ }
37
+
38
+ createCompany();
28
39
  ```
29
40
 
41
+ ## Available Services
42
+
43
+ The client provides access to the following Behind.ai services:
44
+
45
+ - **easyjob** - Recruitment and candidate management
46
+ - **gpt** - AI and language model services
47
+ - **payments** - Payment processing (Payture, Stripe)
48
+ - **storage** - File storage and management
49
+ - **mailer** - Email services
50
+ - **chat** - Chat and messaging
51
+ - **sales** - Sales management
52
+ - **monitor** - System monitoring
53
+ - **tools** - Utility tools (PDF processing, etc.)
54
+ - **oauth** - OAuth authentication
55
+ - **rag** - Retrieval-Augmented Generation
56
+ - **global** - Global services
57
+ - **mastogram** - Social media integration
58
+ - **tests** - Testing utilities
59
+
60
+ ## Event Handlers
61
+
62
+ The client provides event handlers for common scenarios:
30
63
 
31
- ## GptPromptGet
32
64
  ```javascript
33
- let params = [
34
- {name: "CompanyName", value: "Rosersbergs Golv AB"},
35
- {name: "CompanyDescription", value: "Rosersbergs Golv AB är ett familjeföretag som grundades 1969 av Göte Brodin. Idag leds verksamheten av sönerna Fredrik och Joakim. I företaget finns förutom administration och arbetsledning, 16 montörer (golvläggare, plattsättare, snickare) och 2 butiksmedarbetare. Vi arbetar med både kommunavtal, riksbyggare/mindre byggare och privata kunder. Vi är miljöcertifierade enligt ISO 14001."},
36
- {name: "SenderName", value: "Henry Fisher"},
37
- {name: "SenderCompanyName", value: "Refärg AB"},
38
- {name: "SenderCompanyDescription", value: 'Refärg AB is a company that that experienced on searching for talented specialists in construction and focuese on the quick solution in finding personal for our partners.Refärg AB that has a good experience of running construction work projects.Refärg AB består av erfarna målare, snickare, murare, plattsättare, betong- och armeringsarbetare. Refärg AB right now have several fully equiped teams of snickare and gypsarbetare. '},
39
- ];
40
-
41
- let res = zecamp.GptPromptGet('functions.write_partnership_letter', params);
65
+ // Handle expired tokens
66
+ behindAPI.onExpired(() => {
67
+ console.log('Token expired, please refresh');
68
+ });
69
+
70
+ // Handle rejected requests
71
+ behindAPI.onReject((response) => {
72
+ console.log('Request rejected:', response);
73
+ });
74
+
75
+ // Handle rate limiting
76
+ behindAPI.onTooManyRequests((response) => {
77
+ console.log('Rate limit exceeded:', response);
78
+ });
42
79
  ```
43
80
 
44
- ## MailerMessageSend
81
+ ## Direct API Requests
82
+
83
+ You can also make direct API requests using the generic request method:
84
+
45
85
  ```javascript
46
- let message = {
47
- title: "Hello there!",
48
- body: "Hi! <br>This is Henry. <br>Please, text me asap! <br>Best regards, <br>Henry Fisher."
49
- };
50
-
51
- let res = await zecamp.MailerMessageSend(
52
- 'test@behind.ai',
53
- 'James',
54
- '_smtp_sales_behind_ai_default',
55
- '_template_behind_ai_default',
56
- message);
86
+ // Direct request format: /app/version/module/method
87
+ const result = await behindAPI.request('/easyjob/V10/companies/create', {
88
+ name: 'Company Name'
89
+ });
57
90
  ```
58
91
 
59
- ```json
60
- {
61
- "success": true,
62
- "message_id": "3e0c39d1-cb06-4b4e-bb27-6b55a8c768a3",
63
- "requestId": "#af121eb5-9b3c-47dd-be03-c576f118ac80"
64
- }
92
+ ## Authentication
93
+
94
+ The client supports multiple authentication methods:
95
+
96
+ 1. **Bearer Token** (recommended)
97
+ 2. **Access Token** in request headers
98
+ 3. **Access Token** in request body
99
+
100
+ Authentication is handled automatically when you provide the access token during initialization.
101
+
102
+ ## Documentation
103
+
104
+ For detailed API documentation and examples for each service, refer to the documentation in the `docs/behind-api-client/` directory:
105
+
106
+ ### EasyJob Documentation
107
+ - [EasyJob Overview](docs/behind-api-client/easyjob/README.md) - Complete recruitment management API
108
+ - [Job Descriptions](docs/behind-api-client/easyjob/JobDescriptions/README.md) - Job posting management
109
+ - [Candidate Profiles](docs/behind-api-client/easyjob/candidateProfiles/README.md) - Candidate management
110
+ - [Applications](docs/behind-api-client/easyjob/applications/README.md) - Application processing
111
+ - [Applicants](docs/behind-api-client/easyjob/applicants/README.md) - Applicant management
112
+ - [Candidate Questions](docs/behind-api-client/easyjob/jd-candidate-questions/README.md) - Interview questions
113
+
114
+ ### Payment Documentation
115
+ - [Payture Integration](docs/behind-api-client/payments/payture/README.md) - Standard payment processing
116
+ - [Payture Cards](docs/behind-api-client/payments/payture/README.cards.md) - Card payment processing
117
+ - [Payture Subscriptions](docs/behind-api-client/payments/payture/README.subscriptions.md) - Subscription management
118
+ - [Payture v2.1](docs/behind-api-client/payments/payture/README.21.md) - Enhanced payment features
119
+ - [RuKitchen Integration](docs/behind-api-client/payments/payture/README.rukitchen.md) - Restaurant-specific payments
120
+ - [Stripe Flow](docs/behind-api-client/payments/stripe/README.flow.md) - Stripe payment integration
121
+
122
+ ### Storage Documentation
123
+ - [RAG Storage](docs/behind-api-client/rag/storage/README.md) - Retrieval-Augmented Generation storage
124
+
125
+ ## Error Handling
126
+
127
+ All API methods return promises and should be wrapped in try-catch blocks:
128
+
129
+ ```javascript
130
+ try {
131
+ const result = await behindAPI.easyjob.V10.companies.create("Company Name");
132
+ if (result.success) {
133
+ console.log('Success:', result.data);
134
+ } else {
135
+ console.log('Failed:', result.message);
136
+ }
137
+ } catch (error) {
138
+ console.error('Exception:', error);
139
+ }
140
+ ```
141
+
142
+ ## Response Format
143
+
144
+ All API responses follow a consistent format:
145
+
146
+ **Success Response:**
147
+ ```javascript
148
+ {
149
+ success: true,
150
+ data: { /* response data */ }
151
+ }
152
+ ```
153
+
154
+ **Error Response:**
155
+ ```javascript
156
+ {
157
+ success: false,
158
+ message: "Error description",
159
+ code: 1001 // Error code
160
+ }
65
161
  ```
162
+
163
+ ## License
164
+
165
+ ISC
166
+
167
+ ## Repository
168
+
169
+ This package is maintained in the Behind.ai private repository. For issues and contributions, contact the development team.
170
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-behind-api-client",
3
- "version": "2.0.48",
3
+ "version": "2.0.49",
4
4
  "description": "",
5
5
  "main": "lib/behind-api-auth-client/behind-api-client.js",
6
6
  "scripts": {