@entergreat/unipile-wrapper 1.0.9 → 1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entergreat/unipile-wrapper",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -196,7 +196,7 @@ export default class LinkedinService {
196
196
  }
197
197
  }
198
198
 
199
- // add experience position (multipart/form-data format)
199
+ // add experience position (multipart/form-data format with bracket notation)
200
200
  async addExperience({ accountId, experience }) {
201
201
  try {
202
202
  if (!accountId) {
@@ -212,38 +212,44 @@ export default class LinkedinService {
212
212
  const formData = new FormData();
213
213
  formData.append("type", "LINKEDIN");
214
214
  formData.append("account_id", accountId);
215
- formData.append("role", experience.role);
216
- formData.append("company", experience.company);
215
+
216
+ // Experience fields use bracket notation
217
+ formData.append("experience[role]", experience.role);
218
+ formData.append("experience[company]", experience.company);
217
219
 
218
220
  if (experience.description) {
219
- formData.append("description", experience.description);
220
- }
221
- if (experience.location) {
222
- formData.append("location", experience.location);
223
- }
224
- if (experience.notify_network !== undefined) {
225
- formData.append("notify_network", experience.notify_network.toString());
221
+ formData.append("experience[description]", experience.description);
226
222
  }
223
+ // Note: notify_network omitted - causes validation issues when sent as string
227
224
 
228
- // Start date (required)
225
+ // Start date with bracket notation
229
226
  if (experience.start_month) {
230
- formData.append("month", experience.start_month.toString());
227
+ formData.append("experience[seniority][start_date][month]", experience.start_month.toString());
231
228
  }
232
229
  if (experience.start_year) {
233
- formData.append("year", experience.start_year.toString());
230
+ formData.append("experience[seniority][start_date][year]", experience.start_year.toString());
234
231
  }
235
232
 
236
- // End date (optional - for non-current positions)
233
+ // End date with bracket notation (optional - for non-current positions)
237
234
  if (experience.end_month) {
238
- formData.append("month", experience.end_month.toString());
235
+ formData.append("experience[seniority][end_date][month]", experience.end_month.toString());
239
236
  }
240
237
  if (experience.end_year) {
241
- formData.append("year", experience.end_year.toString());
238
+ formData.append("experience[seniority][end_date][year]", experience.end_year.toString());
239
+ }
240
+
241
+ // Skills array - repeat key for each skill
242
+ if (experience.skills && Array.isArray(experience.skills)) {
243
+ for (const skill of experience.skills) {
244
+ formData.append("experience[skills]", skill);
245
+ }
242
246
  }
243
247
 
248
+ // Use formData.getHeaders() to get correct content-type with boundary
244
249
  const headers = {
245
- ...this.headers,
246
- "content-type": "multipart/form-data",
250
+ accept: "application/json",
251
+ "X-API-KEY": this.headers["X-API-KEY"],
252
+ ...formData.getHeaders(),
247
253
  };
248
254
 
249
255
  return await patch(url, formData, headers);