@entergreat/unipile-wrapper 1.0.9 → 1.0.11

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.11",
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,46 @@ 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);
221
+ formData.append("experience[description]", experience.description);
223
222
  }
224
223
  if (experience.notify_network !== undefined) {
225
- formData.append("notify_network", experience.notify_network.toString());
224
+ formData.append("experience[notify_network]", experience.notify_network.toString());
226
225
  }
227
226
 
228
- // Start date (required)
227
+ // Start date with bracket notation
229
228
  if (experience.start_month) {
230
- formData.append("month", experience.start_month.toString());
229
+ formData.append("experience[seniority][start_date][month]", experience.start_month.toString());
231
230
  }
232
231
  if (experience.start_year) {
233
- formData.append("year", experience.start_year.toString());
232
+ formData.append("experience[seniority][start_date][year]", experience.start_year.toString());
234
233
  }
235
234
 
236
- // End date (optional - for non-current positions)
235
+ // End date with bracket notation (optional - for non-current positions)
237
236
  if (experience.end_month) {
238
- formData.append("month", experience.end_month.toString());
237
+ formData.append("experience[seniority][end_date][month]", experience.end_month.toString());
239
238
  }
240
239
  if (experience.end_year) {
241
- formData.append("year", experience.end_year.toString());
240
+ formData.append("experience[seniority][end_date][year]", experience.end_year.toString());
241
+ }
242
+
243
+ // Skills array - repeat key for each skill
244
+ if (experience.skills && Array.isArray(experience.skills)) {
245
+ for (const skill of experience.skills) {
246
+ formData.append("experience[skills]", skill);
247
+ }
242
248
  }
243
249
 
250
+ // Use formData.getHeaders() to get correct content-type with boundary
244
251
  const headers = {
245
- ...this.headers,
246
- "content-type": "multipart/form-data",
252
+ accept: "application/json",
253
+ "X-API-KEY": this.headers["X-API-KEY"],
254
+ ...formData.getHeaders(),
247
255
  };
248
256
 
249
257
  return await patch(url, formData, headers);