node-behind-api-client 2.0.48

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 (157) hide show
  1. package/.gitlab-ci.yml +20 -0
  2. package/README.md +65 -0
  3. package/docs/behind-api-client/easyjob/JobDescriptions/README.md +654 -0
  4. package/docs/behind-api-client/easyjob/README.md +647 -0
  5. package/docs/behind-api-client/easyjob/applicants/README.md +494 -0
  6. package/docs/behind-api-client/easyjob/applications/README.md +754 -0
  7. package/docs/behind-api-client/easyjob/candidateProfiles/README.md +940 -0
  8. package/docs/behind-api-client/easyjob/jd-candidate-questions/README.md +372 -0
  9. package/docs/behind-api-client/payments/payture/README.21.md +901 -0
  10. package/docs/behind-api-client/payments/payture/README.cards.md +1497 -0
  11. package/docs/behind-api-client/payments/payture/README.md +1497 -0
  12. package/docs/behind-api-client/payments/payture/README.rukitchen.md +396 -0
  13. package/docs/behind-api-client/payments/payture/README.subscriptions.md +1266 -0
  14. package/docs/behind-api-client/payments/stripe/README.flow.md +254 -0
  15. package/docs/behind-api-client/rag/storage/README.md +519 -0
  16. package/example.js +35 -0
  17. package/index.cjs +14 -0
  18. package/index.js +15 -0
  19. package/lib/behind-api-auth-client/BehindApiAuthClient.js +91 -0
  20. package/lib/behind-api-auth-client/authorisation/AuthorisationApp.js +9 -0
  21. package/lib/behind-api-auth-client/authorisation/AuthorisationV10.js +9 -0
  22. package/lib/behind-api-auth-client/authorisation/AuthorisationV10Code.js +30 -0
  23. package/lib/behind-api-auth-client/example.js +47 -0
  24. package/lib/behind-api-auth-client/package.json +9 -0
  25. package/lib/behind-api-client/BehindApiClient.js +137 -0
  26. package/lib/behind-api-client/chat/ChatApp.js +11 -0
  27. package/lib/behind-api-client/chat/ChatV10.js +13 -0
  28. package/lib/behind-api-client/chat/ChatV10Chat.js +87 -0
  29. package/lib/behind-api-client/chat/ChatV10Chats.js +14 -0
  30. package/lib/behind-api-client/chat/ChatV10Message.js +57 -0
  31. package/lib/behind-api-client/chat/ChatV20.js +11 -0
  32. package/lib/behind-api-client/chat/ChatV20Chat.js +14 -0
  33. package/lib/behind-api-client/chat/ChatV20Message.js +27 -0
  34. package/lib/behind-api-client/easyjob/EasyjobApp.js +9 -0
  35. package/lib/behind-api-client/easyjob/EasyjobV10.js +31 -0
  36. package/lib/behind-api-client/easyjob/EasyjobV10Answers.js +16 -0
  37. package/lib/behind-api-client/easyjob/EasyjobV10Applicants.js +29 -0
  38. package/lib/behind-api-client/easyjob/EasyjobV10Applications.js +39 -0
  39. package/lib/behind-api-client/easyjob/EasyjobV10CandidateProfileArtifacts.js +31 -0
  40. package/lib/behind-api-client/easyjob/EasyjobV10CandidateProfiles.js +99 -0
  41. package/lib/behind-api-client/easyjob/EasyjobV10Companies.js +36 -0
  42. package/lib/behind-api-client/easyjob/EasyjobV10Cv.js +15 -0
  43. package/lib/behind-api-client/easyjob/EasyjobV10Departments.js +37 -0
  44. package/lib/behind-api-client/easyjob/EasyjobV10JobDescriptionArtifacts.js +29 -0
  45. package/lib/behind-api-client/easyjob/EasyjobV10JobDescriptionCandidateQuestions.js +63 -0
  46. package/lib/behind-api-client/easyjob/EasyjobV10JobDescriptions.js +93 -0
  47. package/lib/behind-api-client/easyjob/EasyjobV10Reports.js +35 -0
  48. package/lib/behind-api-client/example.js +47 -0
  49. package/lib/behind-api-client/global/GlobalApp.js +9 -0
  50. package/lib/behind-api-client/global/GlobalV10.js +11 -0
  51. package/lib/behind-api-client/global/GlobalV10Sockets.js +16 -0
  52. package/lib/behind-api-client/global/GlobalV10Storage.js +29 -0
  53. package/lib/behind-api-client/gpt/GptApp.js +15 -0
  54. package/lib/behind-api-client/gpt/GptV10.js +15 -0
  55. package/lib/behind-api-client/gpt/GptV10Prompt.js +17 -0
  56. package/lib/behind-api-client/gpt/GptV10Request.js +16 -0
  57. package/lib/behind-api-client/gpt/GptV10Storedprompts.js +14 -0
  58. package/lib/behind-api-client/gpt/GptV10Whisper.js +23 -0
  59. package/lib/behind-api-client/gpt/GptV20.js +9 -0
  60. package/lib/behind-api-client/gpt/GptV20Prompt.js +15 -0
  61. package/lib/behind-api-client/gpt/GptV30.js +13 -0
  62. package/lib/behind-api-client/gpt/GptV30Chat.js +19 -0
  63. package/lib/behind-api-client/gpt/GptV30Prompt.js +41 -0
  64. package/lib/behind-api-client/gpt/GptV30Prompts.js +32 -0
  65. package/lib/behind-api-client/gpt/GptV40.js +11 -0
  66. package/lib/behind-api-client/gpt/GptV40Prompt.js +24 -0
  67. package/lib/behind-api-client/gpt/GptV40Prompts.js +30 -0
  68. package/lib/behind-api-client/mailer/MailerApp.js +11 -0
  69. package/lib/behind-api-client/mailer/MailerV10.js +15 -0
  70. package/lib/behind-api-client/mailer/MailerV10Bulk.js +21 -0
  71. package/lib/behind-api-client/mailer/MailerV10Message.js +83 -0
  72. package/lib/behind-api-client/mailer/MailerV10Settings.js +44 -0
  73. package/lib/behind-api-client/mailer/MailerV10Template.js +23 -0
  74. package/lib/behind-api-client/mailer/MailerV20.js +9 -0
  75. package/lib/behind-api-client/mailer/MailerV20Message.js +21 -0
  76. package/lib/behind-api-client/mastogram/MastogramApp.js +9 -0
  77. package/lib/behind-api-client/mastogram/MastogramV10.js +13 -0
  78. package/lib/behind-api-client/mastogram/MastogramV10Bluesky.js +42 -0
  79. package/lib/behind-api-client/mastogram/MastogramV10Mastodon.js +45 -0
  80. package/lib/behind-api-client/mastogram/MastogramV10Telegram.js +39 -0
  81. package/lib/behind-api-client/monitor/MonitorApp.js +9 -0
  82. package/lib/behind-api-client/monitor/MonitorV10.js +13 -0
  83. package/lib/behind-api-client/monitor/MonitorV10Finances.js +39 -0
  84. package/lib/behind-api-client/monitor/MonitorV10Record.js +15 -0
  85. package/lib/behind-api-client/monitor/MonitorV10Records.js +22 -0
  86. package/lib/behind-api-client/oauth/OauthApp.js +9 -0
  87. package/lib/behind-api-client/oauth/OauthV10.js +9 -0
  88. package/lib/behind-api-client/oauth/OauthV10Authorisation.js +15 -0
  89. package/lib/behind-api-client/package.json +9 -0
  90. package/lib/behind-api-client/payments/PaymentsApp.js +13 -0
  91. package/lib/behind-api-client/payments/PaymentsV10.js +15 -0
  92. package/lib/behind-api-client/payments/PaymentsV10Gift.js +32 -0
  93. package/lib/behind-api-client/payments/PaymentsV10Payture.js +30 -0
  94. package/lib/behind-api-client/payments/PaymentsV10Product.js +15 -0
  95. package/lib/behind-api-client/payments/PaymentsV10Telegram.js +44 -0
  96. package/lib/behind-api-client/payments/PaymentsV20.js +9 -0
  97. package/lib/behind-api-client/payments/PaymentsV20Payture.js +32 -0
  98. package/lib/behind-api-client/payments/PaymentsV21.js +15 -0
  99. package/lib/behind-api-client/payments/PaymentsV21Cards.js +14 -0
  100. package/lib/behind-api-client/payments/PaymentsV21Payture.js +29 -0
  101. package/lib/behind-api-client/payments/PaymentsV21Stripe.js +28 -0
  102. package/lib/behind-api-client/payments/PaymentsV21Subscriptions.js +21 -0
  103. package/lib/behind-api-client/questionnaire/QuestionnaireApp.js +9 -0
  104. package/lib/behind-api-client/questionnaire/QuestionnaireV10.js +9 -0
  105. package/lib/behind-api-client/questionnaire/QuestionnaireV10Form.js +22 -0
  106. package/lib/behind-api-client/raet/RaetApp.js +11 -0
  107. package/lib/behind-api-client/raet/RaetV10.js +21 -0
  108. package/lib/behind-api-client/raet/RaetV10Cv.js +87 -0
  109. package/lib/behind-api-client/raet/RaetV10Individual.js +43 -0
  110. package/lib/behind-api-client/raet/RaetV10Individuals.js +38 -0
  111. package/lib/behind-api-client/raet/RaetV10Jd.js +47 -0
  112. package/lib/behind-api-client/raet/RaetV10Project.js +61 -0
  113. package/lib/behind-api-client/raet/RaetV10Projects.js +14 -0
  114. package/lib/behind-api-client/raet/RaetV10Report.js +39 -0
  115. package/lib/behind-api-client/raet/RaetV20.js +11 -0
  116. package/lib/behind-api-client/raet/RaetV20Cv.js +31 -0
  117. package/lib/behind-api-client/raet/RaetV20Individuals.js +25 -0
  118. package/lib/behind-api-client/rag/RagApp.js +9 -0
  119. package/lib/behind-api-client/rag/RagV10.js +9 -0
  120. package/lib/behind-api-client/rag/RagV10Storage.js +27 -0
  121. package/lib/behind-api-client/ruKitchen/RuKitchenApp.js +9 -0
  122. package/lib/behind-api-client/ruKitchen/RuKitchenV10.js +11 -0
  123. package/lib/behind-api-client/ruKitchen/RuKitchenV10Importer.js +29 -0
  124. package/lib/behind-api-client/ruKitchen/RuKitchenV10SeoArticle.js +14 -0
  125. package/lib/behind-api-client/sales/SalesApp.js +11 -0
  126. package/lib/behind-api-client/sales/SalesV10.js +23 -0
  127. package/lib/behind-api-client/sales/SalesV10Catalogue.js +58 -0
  128. package/lib/behind-api-client/sales/SalesV10Categories.js +15 -0
  129. package/lib/behind-api-client/sales/SalesV10Companies.js +55 -0
  130. package/lib/behind-api-client/sales/SalesV10Company.js +120 -0
  131. package/lib/behind-api-client/sales/SalesV10Group.js +70 -0
  132. package/lib/behind-api-client/sales/SalesV10Groups.js +21 -0
  133. package/lib/behind-api-client/sales/SalesV10Logs.js +14 -0
  134. package/lib/behind-api-client/sales/SalesV10Notes.js +38 -0
  135. package/lib/behind-api-client/sales/SalesV20.js +11 -0
  136. package/lib/behind-api-client/sales/SalesV20Companies.js +26 -0
  137. package/lib/behind-api-client/sales/SalesV20Notes.js +17 -0
  138. package/lib/behind-api-client/sip/SipApp.js +9 -0
  139. package/lib/behind-api-client/sip/SipV10.js +15 -0
  140. package/lib/behind-api-client/sip/SipV10Call.js +83 -0
  141. package/lib/behind-api-client/sip/SipV10Phone.js +44 -0
  142. package/lib/behind-api-client/sip/SipV10Transcript.js +21 -0
  143. package/lib/behind-api-client/sip/SipV10Transcripts.js +21 -0
  144. package/lib/behind-api-client/storage/StorageApp.js +9 -0
  145. package/lib/behind-api-client/storage/StorageV10.js +11 -0
  146. package/lib/behind-api-client/storage/StorageV10File.js +35 -0
  147. package/lib/behind-api-client/storage/StorageV10Upload.js +21 -0
  148. package/lib/behind-api-client/tests/TestsApp.js +9 -0
  149. package/lib/behind-api-client/tests/TestsV10.js +15 -0
  150. package/lib/behind-api-client/tests/TestsV10Cases.js +29 -0
  151. package/lib/behind-api-client/tests/TestsV10CasesExtended.js +14 -0
  152. package/lib/behind-api-client/tests/TestsV10Core.js +14 -0
  153. package/lib/behind-api-client/tests/TestsV10Mail.js +14 -0
  154. package/lib/behind-api-client/tools/ToolsApp.js +9 -0
  155. package/lib/behind-api-client/tools/ToolsV10.js +9 -0
  156. package/lib/behind-api-client/tools/ToolsV10Pdf.js +30 -0
  157. package/package.json +25 -0
@@ -0,0 +1,754 @@
1
+ # Applications API Extension
2
+
3
+ This document extends the main EasyJob JavaScript API Client Documentation with detailed information about the Applications API methods.
4
+
5
+ ## Overview
6
+
7
+ The Applications API allows you to manage job applications and interact with application-related data throughout the hiring process. This includes creating new applications, retrieving existing applications, getting application questions, and managing the application workflow.
8
+
9
+ ---
10
+
11
+ ## Applications API
12
+
13
+ ### behindAPI.easyjob.V10.applications.create(candidateProfileId, jobDescriptionId, message)
14
+ Creates a new job application for a candidate applying to a specific job posting.
15
+
16
+ **Parameters:**
17
+ - `candidateProfileId` (string, required) - The candidate profile UUID who is applying
18
+ - `jobDescriptionId` (string, required) - The job description UUID they are applying for
19
+ - `message` (string, optional) - Optional cover letter or application message from the candidate
20
+
21
+ **Usage:**
22
+ ```javascript
23
+ const result = await behindAPI.easyjob.V10.applications.create(
24
+ "aa0e8400-e29b-41d4-a716-446655440005", // candidate_profile_id
25
+ "770e8400-e29b-41d4-a716-446655440002", // job_description_id
26
+ "I am very interested in this position and believe my experience in React and Node.js makes me a great fit..."
27
+ );
28
+
29
+ // Response:
30
+ {
31
+ success: true,
32
+ data: {
33
+ application_id: "dd0e8400-e29b-41d4-a716-446655440008"
34
+ }
35
+ }
36
+
37
+ // Error Response:
38
+ {
39
+ success: false,
40
+ message: "Can not create job application"
41
+ }
42
+ ```
43
+
44
+ ### behindAPI.easyjob.V10.applications.get(jobDescriptionId)
45
+ Retrieves a candidate's job application for a specific job description. Returns only one record as each candidate can have only one application per job description.
46
+
47
+ **Parameters:**
48
+ - `jobDescriptionId` (string, required) - The job description UUID to get the application for
49
+
50
+ **Usage:**
51
+ ```javascript
52
+ const result = await behindAPI.easyjob.V10.applications.get(
53
+ "770e8400-e29b-41d4-a716-446655440002"
54
+ );
55
+
56
+ // Response (application found):
57
+ {
58
+ success: true,
59
+ data: {
60
+ application_id: "dd0e8400-e29b-41d4-a716-446655440008",
61
+ candidate_profile_id: "aa0e8400-e29b-41d4-a716-446655440005",
62
+ job_description_id: "770e8400-e29b-41d4-a716-446655440002",
63
+ message: "I am very interested in this position and believe my experience...",
64
+ status: "submitted",
65
+ created_at: "2024-01-15T10:30:00Z",
66
+ updated_at: "2024-01-15T10:30:00Z"
67
+ }
68
+ }
69
+
70
+ // Error Response (no application found):
71
+ {
72
+ success: false,
73
+ message: "No application found for this job description"
74
+ }
75
+ ```
76
+
77
+ ### behindAPI.easyjob.V10.applications.getQuestions(jobDescriptionId, category)
78
+ Retrieves application questions for a specific job description filtered by category. This allows you to get custom questions that candidates need to answer when applying for specific positions.
79
+
80
+ **Parameters:**
81
+ - `jobDescriptionId` (string, required) - The job description UUID to get questions for
82
+ - `category` (string, required) - The category to filter questions by (e.g., "technical", "behavioral", "experience")
83
+
84
+ **Usage:**
85
+ ```javascript
86
+ const result = await behindAPI.easyjob.V10.applications.getQuestions(
87
+ "770e8400-e29b-41d4-a716-446655440002",
88
+ "technical"
89
+ );
90
+
91
+ // Response:
92
+ {
93
+ success: true,
94
+ data: [
95
+ {
96
+ id: "qq0e8400-e29b-41d4-a716-446655440001",
97
+ job_description_id: "770e8400-e29b-41d4-a716-446655440002",
98
+ question: "Describe your experience with React and state management",
99
+ requirement: "Must have at least 2 years of React experience",
100
+ category: "technical",
101
+ type: "text",
102
+ created_at: "2024-01-15T10:30:00Z"
103
+ },
104
+ {
105
+ id: "qq0e8400-e29b-41d4-a716-446655440002",
106
+ job_description_id: "770e8400-e29b-41d4-a716-446655440002",
107
+ question: "What is your preferred approach to testing React components?",
108
+ requirement: "Knowledge of testing frameworks required",
109
+ category: "technical",
110
+ type: "text",
111
+ created_at: "2024-01-15T10:35:00Z"
112
+ }
113
+ ]
114
+ }
115
+
116
+ // Error Response:
117
+ {
118
+ success: false,
119
+ message: "Can't finish request"
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Data Structure Reference
126
+
127
+ ### Application Creation Response
128
+ The `create()` method returns:
129
+
130
+ **Success Response:**
131
+ - `success` (boolean) - Always `true` for successful requests
132
+ - `data` (object) - Container for response data
133
+ - `application_id` (UUID) - The newly created application's unique identifier
134
+
135
+ **Error Response:**
136
+ - `success` (boolean) - Always `false` for failed requests
137
+ - `message` (string) - Error description
138
+
139
+ ### Application Retrieval Response
140
+ The `get()` method returns:
141
+
142
+ **Success Response:**
143
+ - `success` (boolean) - Always `true` for successful requests
144
+ - `data` (object) - The application record
145
+ - `application_id` (UUID) - Unique identifier for the application
146
+ - `candidate_profile_id` (UUID) - The candidate who submitted the application
147
+ - `job_description_id` (UUID) - The job posting this application is for
148
+ - `message` (string) - Application message/cover letter from the candidate
149
+ - `status` (string) - Current status of the application
150
+ - `created_at` (timestamp) - When the application was submitted
151
+ - `updated_at` (timestamp) - When the application was last modified
152
+
153
+ **Error Response:**
154
+ - `success` (boolean) - Always `false` for failed requests
155
+ - `message` (string) - Error description (e.g., "No application found for this job description")
156
+
157
+ ### Application Questions Response
158
+ The `getQuestions()` method returns an array of question objects:
159
+
160
+ **Question Object Structure:**
161
+ - `id` (UUID) - Unique identifier for the question
162
+ - `job_description_id` (UUID) - The job posting this question belongs to
163
+ - `question` (string) - The actual question text
164
+ - `requirement` (string) - Any specific requirements or context for the question
165
+ - `category` (string) - Question category (technical, behavioral, experience, etc.)
166
+ - `type` (string) - Question type (text, multiple_choice, rating, etc.)
167
+ - `created_at` (timestamp) - When the question was created
168
+
169
+ ---
170
+
171
+ ## Complete Usage Examples
172
+
173
+ ### Checking for Existing Applications
174
+
175
+ ```javascript
176
+ // Example: Check if candidate has already applied before creating new application
177
+ async function checkAndCreateApplication(candidateProfileId, jobDescriptionId, message) {
178
+ try {
179
+ // First, check if an application already exists
180
+ console.log("Checking for existing application...");
181
+ const existingApplication = await behindAPI.easyjob.V10.applications.get(jobDescriptionId);
182
+
183
+ if (existingApplication.success) {
184
+ console.log("✓ Application already exists!");
185
+ console.log(`Application ID: ${existingApplication.data.application_id}`);
186
+ console.log(`Status: ${existingApplication.data.status}`);
187
+ console.log(`Submitted: ${existingApplication.data.created_at}`);
188
+
189
+ return {
190
+ success: true,
191
+ status: 'existing',
192
+ applicationId: existingApplication.data.application_id,
193
+ data: existingApplication.data
194
+ };
195
+ } else {
196
+ // No existing application found, create a new one
197
+ console.log("No existing application found. Creating new application...");
198
+ const newApplication = await behindAPI.easyjob.V10.applications.create(
199
+ candidateProfileId,
200
+ jobDescriptionId,
201
+ message
202
+ );
203
+
204
+ if (newApplication.success) {
205
+ console.log("✓ New application created successfully!");
206
+ console.log(`Application ID: ${newApplication.data.application_id}`);
207
+
208
+ return {
209
+ success: true,
210
+ status: 'created',
211
+ applicationId: newApplication.data.application_id
212
+ };
213
+ } else {
214
+ console.log(`✗ Failed to create application: ${newApplication.message}`);
215
+ return {
216
+ success: false,
217
+ error: newApplication.message
218
+ };
219
+ }
220
+ }
221
+ } catch (error) {
222
+ console.error("Error in application workflow:", error);
223
+ return {
224
+ success: false,
225
+ error: error.message
226
+ };
227
+ }
228
+ }
229
+
230
+ // Usage
231
+ const result = await checkAndCreateApplication(
232
+ "aa0e8400-e29b-41d4-a716-446655440005",
233
+ "770e8400-e29b-41d4-a716-446655440002",
234
+ "I am very interested in this position..."
235
+ );
236
+
237
+ console.log("Application Result:", result);
238
+ ```
239
+
240
+ ### Creating Job Applications
241
+
242
+ ```javascript
243
+ // Example: Candidate applying for multiple positions
244
+ async function applyToMultipleJobs(candidateProfileId, jobIds, applicationMessage) {
245
+ const results = [];
246
+
247
+ for (const jobId of jobIds) {
248
+ try {
249
+ const application = await behindAPI.easyjob.V10.applications.create(
250
+ candidateProfileId,
251
+ jobId,
252
+ applicationMessage
253
+ );
254
+
255
+ if (application.success) {
256
+ console.log(`✓ Successfully applied to job ${jobId}`);
257
+ console.log(` Application ID: ${application.data.application_id}`);
258
+ results.push({
259
+ jobId,
260
+ applicationId: application.data.application_id,
261
+ status: 'success'
262
+ });
263
+ } else {
264
+ console.log(`✗ Failed to apply to job ${jobId}: ${application.message}`);
265
+ results.push({
266
+ jobId,
267
+ status: 'failed',
268
+ error: application.message
269
+ });
270
+ }
271
+ } catch (error) {
272
+ console.error(`Error applying to job ${jobId}:`, error);
273
+ results.push({
274
+ jobId,
275
+ status: 'error',
276
+ error: error.message
277
+ });
278
+ }
279
+ }
280
+
281
+ return results;
282
+ }
283
+
284
+ // Usage
285
+ const candidateId = "aa0e8400-e29b-41d4-a716-446655440005";
286
+ const jobIds = [
287
+ "770e8400-e29b-41d4-a716-446655440002",
288
+ "880e8400-e29b-41d4-a716-446655440003",
289
+ "990e8400-e29b-41d4-a716-446655440004"
290
+ ];
291
+ const message = "I am excited to contribute my skills to your team...";
292
+
293
+ const applicationResults = await applyToMultipleJobs(candidateId, jobIds, message);
294
+ console.log("Application Summary:", applicationResults);
295
+ ```
296
+
297
+ ### Application Status Dashboard
298
+
299
+ ```javascript
300
+ // Example: Build a dashboard showing application status across multiple jobs
301
+ async function buildApplicationDashboard(jobDescriptionIds) {
302
+ const dashboard = {
303
+ applications: [],
304
+ summary: {
305
+ total: 0,
306
+ applied: 0,
307
+ notApplied: 0
308
+ }
309
+ };
310
+
311
+ for (const jobId of jobDescriptionIds) {
312
+ try {
313
+ const application = await behindAPI.easyjob.V10.applications.get(jobId);
314
+
315
+ if (application.success) {
316
+ // Application exists
317
+ dashboard.applications.push({
318
+ jobId,
319
+ status: 'applied',
320
+ applicationId: application.data.application_id,
321
+ submittedAt: application.data.created_at,
322
+ currentStatus: application.data.status,
323
+ message: application.data.message
324
+ });
325
+ dashboard.summary.applied++;
326
+ } else {
327
+ // No application found
328
+ dashboard.applications.push({
329
+ jobId,
330
+ status: 'not_applied',
331
+ applicationId: null,
332
+ submittedAt: null,
333
+ currentStatus: null,
334
+ message: null
335
+ });
336
+ dashboard.summary.notApplied++;
337
+ }
338
+ dashboard.summary.total++;
339
+ } catch (error) {
340
+ console.error(`Error checking application for job ${jobId}:`, error);
341
+ dashboard.applications.push({
342
+ jobId,
343
+ status: 'error',
344
+ error: error.message
345
+ });
346
+ }
347
+ }
348
+
349
+ return dashboard;
350
+ }
351
+
352
+ // Usage
353
+ const jobIds = [
354
+ "770e8400-e29b-41d4-a716-446655440002",
355
+ "880e8400-e29b-41d4-a716-446655440003",
356
+ "990e8400-e29b-41d4-a716-446655440004"
357
+ ];
358
+
359
+ const dashboard = await buildApplicationDashboard(jobIds);
360
+
361
+ console.log("=== APPLICATION DASHBOARD ===");
362
+ console.log(`Total Jobs: ${dashboard.summary.total}`);
363
+ console.log(`Applied: ${dashboard.summary.applied}`);
364
+ console.log(`Not Applied: ${dashboard.summary.notApplied}`);
365
+
366
+ console.log("\n=== DETAILED STATUS ===");
367
+ dashboard.applications.forEach((app, index) => {
368
+ console.log(`${index + 1}. Job ${app.jobId}`);
369
+ console.log(` Status: ${app.status.toUpperCase()}`);
370
+ if (app.status === 'applied') {
371
+ console.log(` Application ID: ${app.applicationId}`);
372
+ console.log(` Submitted: ${app.submittedAt}`);
373
+ console.log(` Current Status: ${app.currentStatus}`);
374
+ }
375
+ console.log('');
376
+ });
377
+ ```
378
+
379
+ ### Retrieving and Processing Application Questions
380
+
381
+ ```javascript
382
+ // Example: Get all questions for a job posting across different categories
383
+ async function getAllJobQuestions(jobDescriptionId) {
384
+ const categories = ['technical', 'behavioral', 'experience', 'general'];
385
+ const allQuestions = {};
386
+
387
+ for (const category of categories) {
388
+ try {
389
+ const questions = await behindAPI.easyjob.V10.applications.getQuestions(
390
+ jobDescriptionId,
391
+ category
392
+ );
393
+
394
+ if (questions.success && questions.data.length > 0) {
395
+ allQuestions[category] = questions.data;
396
+ console.log(`Found ${questions.data.length} ${category} questions`);
397
+ } else {
398
+ console.log(`No ${category} questions found`);
399
+ allQuestions[category] = [];
400
+ }
401
+ } catch (error) {
402
+ console.error(`Error retrieving ${category} questions:`, error);
403
+ allQuestions[category] = [];
404
+ }
405
+ }
406
+
407
+ return allQuestions;
408
+ }
409
+
410
+ // Usage
411
+ const jobId = "770e8400-e29b-41d4-a716-446655440002";
412
+ const questionsByCategory = await getAllJobQuestions(jobId);
413
+
414
+ // Display questions in a structured format
415
+ Object.entries(questionsByCategory).forEach(([category, questions]) => {
416
+ if (questions.length > 0) {
417
+ console.log(`\n=== ${category.toUpperCase()} QUESTIONS ===`);
418
+ questions.forEach((q, index) => {
419
+ console.log(`${index + 1}. ${q.question}`);
420
+ if (q.requirement) {
421
+ console.log(` Requirement: ${q.requirement}`);
422
+ }
423
+ console.log(` Type: ${q.type}`);
424
+ console.log('');
425
+ });
426
+ }
427
+ });
428
+ ```
429
+
430
+ ### Building an Application Form Interface
431
+
432
+ ```javascript
433
+ // Example: Create a dynamic application form based on job questions
434
+ async function buildApplicationForm(jobDescriptionId) {
435
+ try {
436
+ // Get questions for different categories
437
+ const categories = ['general', 'technical', 'behavioral'];
438
+ const formSections = {};
439
+
440
+ for (const category of categories) {
441
+ const result = await behindAPI.easyjob.V10.applications.getQuestions(
442
+ jobDescriptionId,
443
+ category
444
+ );
445
+
446
+ if (result.success && result.data.length > 0) {
447
+ formSections[category] = result.data.map(question => ({
448
+ id: question.id,
449
+ label: question.question,
450
+ type: question.type,
451
+ required: question.requirement ? true : false,
452
+ helpText: question.requirement,
453
+ category: question.category
454
+ }));
455
+ }
456
+ }
457
+
458
+ // Generate form structure
459
+ const applicationForm = {
460
+ jobDescriptionId: jobDescriptionId,
461
+ sections: formSections,
462
+ metadata: {
463
+ totalQuestions: Object.values(formSections).flat().length,
464
+ categories: Object.keys(formSections),
465
+ createdAt: new Date().toISOString()
466
+ }
467
+ };
468
+
469
+ console.log("=== APPLICATION FORM STRUCTURE ===");
470
+ console.log(`Job ID: ${jobDescriptionId}`);
471
+ console.log(`Total Questions: ${applicationForm.metadata.totalQuestions}`);
472
+ console.log(`Categories: ${applicationForm.metadata.categories.join(', ')}`);
473
+
474
+ // Display form sections
475
+ Object.entries(formSections).forEach(([category, questions]) => {
476
+ console.log(`\n--- ${category.toUpperCase()} SECTION (${questions.length} questions) ---`);
477
+ questions.forEach((field, index) => {
478
+ console.log(`${index + 1}. ${field.label}${field.required ? ' *' : ''}`);
479
+ console.log(` Type: ${field.type}`);
480
+ if (field.helpText) {
481
+ console.log(` Help: ${field.helpText}`);
482
+ }
483
+ });
484
+ });
485
+
486
+ return applicationForm;
487
+
488
+ } catch (error) {
489
+ console.error("Error building application form:", error);
490
+ return null;
491
+ }
492
+ }
493
+
494
+ // Usage
495
+ const formStructure = await buildApplicationForm("770e8400-e29b-41d4-a716-446655440002");
496
+ ```
497
+
498
+ ### Complete Application Workflow
499
+
500
+ ```javascript
501
+ // Example: Complete workflow from questions to application submission
502
+ async function completeApplicationWorkflow(candidateProfileId, jobDescriptionId) {
503
+ try {
504
+ console.log("=== STARTING APPLICATION WORKFLOW ===");
505
+
506
+ // Step 1: Check for existing application
507
+ console.log("\n1. Checking for existing application...");
508
+ const existingApp = await behindAPI.easyjob.V10.applications.get(jobDescriptionId);
509
+
510
+ if (existingApp.success) {
511
+ console.log(" ⚠️ Application already exists!");
512
+ console.log(` Application ID: ${existingApp.data.application_id}`);
513
+ console.log(` Status: ${existingApp.data.status}`);
514
+ console.log(` Submitted: ${existingApp.data.created_at}`);
515
+
516
+ return {
517
+ success: true,
518
+ status: 'existing',
519
+ applicationId: existingApp.data.application_id,
520
+ data: existingApp.data
521
+ };
522
+ }
523
+
524
+ // Step 2: Retrieve all application questions
525
+ console.log("\n2. Retrieving application questions...");
526
+ const categories = ['general', 'technical', 'behavioral', 'experience'];
527
+ const allQuestions = [];
528
+
529
+ for (const category of categories) {
530
+ const questions = await behindAPI.easyjob.V10.applications.getQuestions(
531
+ jobDescriptionId,
532
+ category
533
+ );
534
+
535
+ if (questions.success) {
536
+ allQuestions.push(...questions.data);
537
+ console.log(` ✓ Retrieved ${questions.data.length} ${category} questions`);
538
+ }
539
+ }
540
+
541
+ console.log(` Total questions to answer: ${allQuestions.length}`);
542
+
543
+ // Step 3: Simulate candidate answers (in real app, this would be user input)
544
+ console.log("\n3. Processing candidate responses...");
545
+ const candidateResponses = allQuestions.map(question => ({
546
+ questionId: question.id,
547
+ question: question.question,
548
+ category: question.category,
549
+ response: generateSampleResponse(question)
550
+ }));
551
+
552
+ // Step 4: Prepare application message
553
+ const applicationMessage = `
554
+ Dear Hiring Manager,
555
+
556
+ I am excited to apply for this position. Based on the application questions, I believe I am well-qualified for this role.
557
+
558
+ ${candidateResponses.map(r =>
559
+ `${r.question}\n${r.response}\n`
560
+ ).join('\n')}
561
+
562
+ I look forward to discussing my qualifications further.
563
+
564
+ Best regards,
565
+ [Candidate Name]
566
+ `.trim();
567
+
568
+ // Step 5: Submit application
569
+ console.log("\n4. Submitting application...");
570
+ const applicationResult = await behindAPI.easyjob.V10.applications.create(
571
+ candidateProfileId,
572
+ jobDescriptionId,
573
+ applicationMessage
574
+ );
575
+
576
+ if (applicationResult.success) {
577
+ console.log(" ✓ Application submitted successfully!");
578
+ console.log(` Application ID: ${applicationResult.data.application_id}`);
579
+
580
+ return {
581
+ success: true,
582
+ status: 'created',
583
+ applicationId: applicationResult.data.application_id,
584
+ questionsAnswered: allQuestions.length,
585
+ responses: candidateResponses
586
+ };
587
+ } else {
588
+ console.log(` ✗ Application failed: ${applicationResult.message}`);
589
+ return {
590
+ success: false,
591
+ error: applicationResult.message
592
+ };
593
+ }
594
+
595
+ } catch (error) {
596
+ console.error("Error in application workflow:", error);
597
+ return {
598
+ success: false,
599
+ error: error.message
600
+ };
601
+ }
602
+ }
603
+
604
+ // Helper function to generate sample responses (replace with actual user input)
605
+ function generateSampleResponse(question) {
606
+ const sampleResponses = {
607
+ 'technical': 'I have extensive experience with the mentioned technologies and have successfully implemented similar solutions in my previous roles.',
608
+ 'behavioral': 'I approach challenges systematically by analyzing the situation, identifying key stakeholders, and developing collaborative solutions.',
609
+ 'experience': 'In my previous role, I gained valuable experience that directly relates to this position and the requirements outlined.',
610
+ 'general': 'I am passionate about this opportunity and believe my skills and enthusiasm make me an ideal candidate.'
611
+ };
612
+
613
+ return sampleResponses[question.category] || 'I am confident in my ability to handle this aspect of the role effectively.';
614
+ }
615
+
616
+ // Usage
617
+ const result = await completeApplicationWorkflow(
618
+ "aa0e8400-e29b-41d4-a716-446655440005",
619
+ "770e8400-e29b-41d4-a716-446655440002"
620
+ );
621
+
622
+ console.log("\n=== WORKFLOW RESULT ===");
623
+ console.log(result);
624
+ ```
625
+
626
+ ---
627
+
628
+ ## Best Practices
629
+
630
+ 1. **Application Checking**: Always check for existing applications before creating new ones to avoid duplicates and provide better user experience.
631
+
632
+ 2. **Question Categories**: Use consistent category naming (technical, behavioral, experience, general) to organize questions logically and make them easier to retrieve and display.
633
+
634
+ 3. **Error Handling**: Always check the `success` property before processing data. Handle both API errors and network failures gracefully.
635
+
636
+ 4. **Message Formatting**: When creating applications with messages, consider formatting them clearly with proper structure, especially if incorporating answers to application questions.
637
+
638
+ 5. **Data Validation**: Validate UUIDs before making API calls to avoid unnecessary requests and improve error handling.
639
+
640
+ 6. **User Experience**: Retrieve questions first to build dynamic forms, allowing candidates to see all requirements before starting their application.
641
+
642
+ 7. **Performance**: Cache questions for frequently accessed job postings to reduce API calls and improve response times.
643
+
644
+ 8. **Status Management**: Use the `get` method to build dashboards and track application status across multiple job postings.
645
+
646
+ ---
647
+
648
+ ## Error Handling
649
+
650
+ All methods return a response object with a `success` boolean property. When `success` is `false`, a `message` property contains the error description.
651
+
652
+ ```javascript
653
+ // Comprehensive error handling example
654
+ async function safeApplicationOperations(candidateProfileId, jobDescriptionId, message) {
655
+ try {
656
+ // Validate input parameters
657
+ if (!candidateProfileId || !jobDescriptionId) {
658
+ return {
659
+ success: false,
660
+ error: "Missing required parameters"
661
+ };
662
+ }
663
+
664
+ // Validate UUID format (basic check)
665
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
666
+ if (!uuidRegex.test(candidateProfileId) || !uuidRegex.test(jobDescriptionId)) {
667
+ return {
668
+ success: false,
669
+ error: "Invalid UUID format"
670
+ };
671
+ }
672
+
673
+ // Check for existing application first
674
+ const existingApp = await behindAPI.easyjob.V10.applications.get(jobDescriptionId);
675
+
676
+ if (existingApp.success) {
677
+ return {
678
+ success: true,
679
+ status: 'existing',
680
+ applicationId: existingApp.data.application_id,
681
+ data: existingApp.data
682
+ };
683
+ }
684
+
685
+ // Create new application
686
+ const newApp = await behindAPI.easyjob.V10.applications.create(
687
+ candidateProfileId,
688
+ jobDescriptionId,
689
+ message
690
+ );
691
+
692
+ if (!newApp.success) {
693
+ console.error("API Error:", newApp.message);
694
+ return {
695
+ success: false,
696
+ error: newApp.message
697
+ };
698
+ }
699
+
700
+ return {
701
+ success: true,
702
+ status: 'created',
703
+ applicationId: newApp.data.application_id
704
+ };
705
+
706
+ } catch (error) {
707
+ console.error("Unexpected error:", error);
708
+ return {
709
+ success: false,
710
+ error: "An unexpected error occurred"
711
+ };
712
+ }
713
+ }
714
+
715
+ // Usage with comprehensive error handling
716
+ const result = await safeApplicationOperations(
717
+ "aa0e8400-e29b-41d4-a716-446655440005",
718
+ "770e8400-e29b-41d4-a716-446655440002",
719
+ "Application message here"
720
+ );
721
+
722
+ if (result.success) {
723
+ if (result.status === 'existing') {
724
+ console.log("Application already exists:", result.applicationId);
725
+ } else {
726
+ console.log("New application created:", result.applicationId);
727
+ }
728
+ } else {
729
+ console.error("Operation failed:", result.error);
730
+ // Handle error appropriately (show user message, retry, etc.)
731
+ }
732
+ ```
733
+
734
+ ---
735
+
736
+ ## Integration Notes
737
+
738
+ The Applications API works seamlessly with other EasyJob APIs:
739
+
740
+ - **Job Descriptions**: Applications are created for specific job postings retrieved via the Job Descriptions API
741
+ - **Candidate Profiles**: Applications link candidates to jobs, with profile data accessible through other API endpoints
742
+ - **Applicants API**: Once created, applications can be managed through the Applicants API for stage tracking and detailed retrieval
743
+ - **Questions Management**: Custom questions are defined per job description and retrieved to build dynamic application forms
744
+
745
+ ---
746
+
747
+ ## Authorization Requirements
748
+
749
+ All API methods require user authorization:
750
+ - `create`: Requires valid user session (`need_authorization: true`)
751
+ - `get`: Requires valid user session (`need_authorization: true`)
752
+ - `getQuestions`: Requires valid user session (`need_authorization: true`)
753
+
754
+ Ensure your API client is properly authenticated before making requests to these endpoints.