@digipair/skill-linkedin 0.15.0

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/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _extends() {
6
+ _extends = Object.assign || function assign(target) {
7
+ for(var i = 1; i < arguments.length; i++){
8
+ var source = arguments[i];
9
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+
16
+ const API_ENDPOINT = 'https://api.linkedin.com';
17
+ let LinkedInService = class LinkedInService {
18
+ async call(url, method, version, data = null, headers = {}) {
19
+ const response = await fetch(`${API_ENDPOINT}/${version}/${url}`, {
20
+ method,
21
+ headers: _extends({
22
+ Authorization: `Bearer ${this.TOKEN}`,
23
+ Accept: 'application/json',
24
+ 'Content-Type': 'application/json'
25
+ }, headers),
26
+ body: data ? JSON.stringify(data) : undefined
27
+ });
28
+ if (!response.ok) throw new Error('[SKILL-LINKEDIN] REQUEST FAILED: ' + response.status);
29
+ return await response.json();
30
+ }
31
+ async create(params, _pinsSettingsList, _context) {
32
+ const { path, body = {}, version = 'v2', headers = {} } = params;
33
+ return await this.call(path, 'POST', version, body, headers);
34
+ }
35
+ async read(params, _pinsSettingsList, _context) {
36
+ const { path, version = 'v2', headers = {} } = params;
37
+ return await this.call(path, 'GET', version, null, headers);
38
+ }
39
+ async update(params, _pinsSettingsList, _context) {
40
+ const { path, body = {}, version = 'v2', headers = {} } = params;
41
+ return await this.call(path, 'PUT', version, body, headers);
42
+ }
43
+ async partialUpdate(params, _pinsSettingsList, _context) {
44
+ const { path, body = {}, version = 'v2', headers = {} } = params;
45
+ return await this.call(path, 'PATCH', version, body, headers);
46
+ }
47
+ async remove(params, _pinsSettingsList, _context) {
48
+ const { path, version = 'v2', headers = {} } = params;
49
+ return await this.call(path, 'DELETE', version, null, headers);
50
+ }
51
+ async request(params, _pinsSettingsList, _context) {
52
+ const { path, method = 'GET', body = null, version = 'v2', headers = {} } = params;
53
+ return await this.call(path, method, version, body, headers);
54
+ }
55
+ constructor(context, params){
56
+ var _context_privates_LINKEDIN_TOKEN, _ref;
57
+ this.TOKEN = (_ref = (_context_privates_LINKEDIN_TOKEN = context.privates.LINKEDIN_TOKEN) != null ? _context_privates_LINKEDIN_TOKEN : params == null ? void 0 : params.LINKEDIN_TOKEN) != null ? _ref : process.env['LINKEDIN_TOKEN'];
58
+ }
59
+ };
60
+ const create = (params, pinsSettingsList, context)=>new LinkedInService(context, params).create(params, pinsSettingsList, context);
61
+ const read = (params, pinsSettingsList, context)=>new LinkedInService(context, params).read(params, pinsSettingsList, context);
62
+ const update = (params, pinsSettingsList, context)=>new LinkedInService(context, params).update(params, pinsSettingsList, context);
63
+ const partialUpdate = (params, pinsSettingsList, context)=>new LinkedInService(context, params).update(params, pinsSettingsList, context);
64
+ const remove = (params, pinsSettingsList, context)=>new LinkedInService(context, params).remove(params, pinsSettingsList, context);
65
+ const request = (params, pinsSettingsList, context)=>new LinkedInService(context, params).request(params, pinsSettingsList, context);
66
+
67
+ exports.create = create;
68
+ exports.partialUpdate = partialUpdate;
69
+ exports.read = read;
70
+ exports.remove = remove;
71
+ exports.request = request;
72
+ exports.update = update;
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './libs/skill-linkedin/src/index';
package/index.esm.js ADDED
@@ -0,0 +1,63 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function assign(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
6
+ }
7
+ return target;
8
+ };
9
+ return _extends.apply(this, arguments);
10
+ }
11
+
12
+ const API_ENDPOINT = 'https://api.linkedin.com';
13
+ let LinkedInService = class LinkedInService {
14
+ async call(url, method, version, data = null, headers = {}) {
15
+ const response = await fetch(`${API_ENDPOINT}/${version}/${url}`, {
16
+ method,
17
+ headers: _extends({
18
+ Authorization: `Bearer ${this.TOKEN}`,
19
+ Accept: 'application/json',
20
+ 'Content-Type': 'application/json'
21
+ }, headers),
22
+ body: data ? JSON.stringify(data) : undefined
23
+ });
24
+ if (!response.ok) throw new Error('[SKILL-LINKEDIN] REQUEST FAILED: ' + response.status);
25
+ return await response.json();
26
+ }
27
+ async create(params, _pinsSettingsList, _context) {
28
+ const { path, body = {}, version = 'v2', headers = {} } = params;
29
+ return await this.call(path, 'POST', version, body, headers);
30
+ }
31
+ async read(params, _pinsSettingsList, _context) {
32
+ const { path, version = 'v2', headers = {} } = params;
33
+ return await this.call(path, 'GET', version, null, headers);
34
+ }
35
+ async update(params, _pinsSettingsList, _context) {
36
+ const { path, body = {}, version = 'v2', headers = {} } = params;
37
+ return await this.call(path, 'PUT', version, body, headers);
38
+ }
39
+ async partialUpdate(params, _pinsSettingsList, _context) {
40
+ const { path, body = {}, version = 'v2', headers = {} } = params;
41
+ return await this.call(path, 'PATCH', version, body, headers);
42
+ }
43
+ async remove(params, _pinsSettingsList, _context) {
44
+ const { path, version = 'v2', headers = {} } = params;
45
+ return await this.call(path, 'DELETE', version, null, headers);
46
+ }
47
+ async request(params, _pinsSettingsList, _context) {
48
+ const { path, method = 'GET', body = null, version = 'v2', headers = {} } = params;
49
+ return await this.call(path, method, version, body, headers);
50
+ }
51
+ constructor(context, params){
52
+ var _context_privates_LINKEDIN_TOKEN, _ref;
53
+ this.TOKEN = (_ref = (_context_privates_LINKEDIN_TOKEN = context.privates.LINKEDIN_TOKEN) != null ? _context_privates_LINKEDIN_TOKEN : params == null ? void 0 : params.LINKEDIN_TOKEN) != null ? _ref : process.env['LINKEDIN_TOKEN'];
54
+ }
55
+ };
56
+ const create = (params, pinsSettingsList, context)=>new LinkedInService(context, params).create(params, pinsSettingsList, context);
57
+ const read = (params, pinsSettingsList, context)=>new LinkedInService(context, params).read(params, pinsSettingsList, context);
58
+ const update = (params, pinsSettingsList, context)=>new LinkedInService(context, params).update(params, pinsSettingsList, context);
59
+ const partialUpdate = (params, pinsSettingsList, context)=>new LinkedInService(context, params).update(params, pinsSettingsList, context);
60
+ const remove = (params, pinsSettingsList, context)=>new LinkedInService(context, params).remove(params, pinsSettingsList, context);
61
+ const request = (params, pinsSettingsList, context)=>new LinkedInService(context, params).request(params, pinsSettingsList, context);
62
+
63
+ export { create, partialUpdate, read, remove, request, update };
package/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@digipair/skill-linkedin",
3
+ "version": "0.15.0",
4
+ "dependencies": {},
5
+ "main": "./index.cjs.js",
6
+ "module": "./index.esm.js"
7
+ }
package/schema.json ADDED
@@ -0,0 +1,331 @@
1
+ {
2
+ "openapi": "3.0.0",
3
+ "info": {
4
+ "title": "@digipair/skill-linkedin",
5
+ "summary": "Communication avec les services LinkedIn",
6
+ "description": "Cette compétence permet d'utiliser les services LinkedIn",
7
+ "version": "0.1.0",
8
+ "x-icon": "👤"
9
+ },
10
+ "paths": {
11
+ "/request": {
12
+ "post": {
13
+ "tags": ["service"],
14
+ "summary": "Exécute un service LinkedIn",
15
+ "parameters": [
16
+ {
17
+ "name": "path",
18
+ "summary": "Chemin du service",
19
+ "required": true,
20
+ "description": "Chemin du service à exécuter",
21
+ "schema": {
22
+ "type": "string"
23
+ }
24
+ },
25
+ {
26
+ "name": "method",
27
+ "summary": "Méthode HTTP",
28
+ "required": false,
29
+ "description": "Méthode HTTP à utiliser",
30
+ "schema": {
31
+ "type": "string"
32
+ }
33
+ },
34
+ {
35
+ "name": "body",
36
+ "summary": "Valeur",
37
+ "required": false,
38
+ "description": "Valeur à envoyer",
39
+ "schema": {
40
+ "type": "object"
41
+ }
42
+ },
43
+ {
44
+ "name": "version",
45
+ "summary": "Version de l'API",
46
+ "required": false,
47
+ "description": "Version de l'API à utiliser",
48
+ "schema": {
49
+ "type": "string"
50
+ }
51
+ },
52
+ {
53
+ "name": "headers",
54
+ "summary": "En-têtes",
55
+ "required": false,
56
+ "description": "En-têtes à envoyer",
57
+ "schema": {
58
+ "type": "object"
59
+ }
60
+ },
61
+ {
62
+ "name": "TOKEN",
63
+ "summary": "Jeton d'accès",
64
+ "required": false,
65
+ "description": "Jeton d'accès à utiliser",
66
+ "schema": {
67
+ "type": "string"
68
+ }
69
+ }
70
+ ],
71
+ "x-events": []
72
+ }
73
+ },
74
+ "/create": {
75
+ "post": {
76
+ "tags": ["service"],
77
+ "summary": "Ajoute une ressource LinkedIn",
78
+ "parameters": [
79
+ {
80
+ "name": "path",
81
+ "summary": "Chemin du service",
82
+ "required": true,
83
+ "description": "Chemin du service à exécuter",
84
+ "schema": {
85
+ "type": "string"
86
+ }
87
+ },
88
+ {
89
+ "name": "body",
90
+ "summary": "Valeur",
91
+ "required": false,
92
+ "description": "Valeur à envoyer",
93
+ "schema": {
94
+ "type": "object"
95
+ }
96
+ },
97
+ {
98
+ "name": "version",
99
+ "summary": "Version de l'API",
100
+ "required": false,
101
+ "description": "Version de l'API à utiliser",
102
+ "schema": {
103
+ "type": "string"
104
+ }
105
+ },
106
+ {
107
+ "name": "headers",
108
+ "summary": "En-têtes",
109
+ "required": false,
110
+ "description": "En-têtes à envoyer",
111
+ "schema": {
112
+ "type": "object"
113
+ }
114
+ },
115
+ {
116
+ "name": "TOKEN",
117
+ "summary": "Jeton d'accès",
118
+ "required": false,
119
+ "description": "Jeton d'accès à utiliser",
120
+ "schema": {
121
+ "type": "string"
122
+ }
123
+ }
124
+ ],
125
+ "x-events": []
126
+ }
127
+ },
128
+ "/read": {
129
+ "post": {
130
+ "tags": ["service"],
131
+ "summary": "Lit une ressource LinkedIn",
132
+ "parameters": [
133
+ {
134
+ "name": "path",
135
+ "summary": "Chemin du service",
136
+ "required": true,
137
+ "description": "Chemin du service à exécuter",
138
+ "schema": {
139
+ "type": "string"
140
+ }
141
+ },
142
+ {
143
+ "name": "version",
144
+ "summary": "Version de l'API",
145
+ "required": false,
146
+ "description": "Version de l'API à utiliser",
147
+ "schema": {
148
+ "type": "string"
149
+ }
150
+ },
151
+ {
152
+ "name": "headers",
153
+ "summary": "En-têtes",
154
+ "required": false,
155
+ "description": "En-têtes à envoyer",
156
+ "schema": {
157
+ "type": "object"
158
+ }
159
+ },
160
+ {
161
+ "name": "TOKEN",
162
+ "summary": "Jeton d'accès",
163
+ "required": false,
164
+ "description": "Jeton d'accès à utiliser",
165
+ "schema": {
166
+ "type": "string"
167
+ }
168
+ }
169
+ ],
170
+ "x-events": []
171
+ }
172
+ },
173
+ "/update": {
174
+ "post": {
175
+ "tags": ["service"],
176
+ "summary": "Modifie une ressource LinkedIn",
177
+ "parameters": [
178
+ {
179
+ "name": "path",
180
+ "summary": "Chemin du service",
181
+ "required": true,
182
+ "description": "Chemin du service à exécuter",
183
+ "schema": {
184
+ "type": "string"
185
+ }
186
+ },
187
+ {
188
+ "name": "body",
189
+ "summary": "Valeur",
190
+ "required": false,
191
+ "description": "Valeur à envoyer",
192
+ "schema": {
193
+ "type": "object"
194
+ }
195
+ },
196
+ {
197
+ "name": "version",
198
+ "summary": "Version de l'API",
199
+ "required": false,
200
+ "description": "Version de l'API à utiliser",
201
+ "schema": {
202
+ "type": "string"
203
+ }
204
+ },
205
+ {
206
+ "name": "headers",
207
+ "summary": "En-têtes",
208
+ "required": false,
209
+ "description": "En-têtes à envoyer",
210
+ "schema": {
211
+ "type": "object"
212
+ }
213
+ },
214
+ {
215
+ "name": "TOKEN",
216
+ "summary": "Jeton d'accès",
217
+ "required": false,
218
+ "description": "Jeton d'accès à utiliser",
219
+ "schema": {
220
+ "type": "string"
221
+ }
222
+ }
223
+ ],
224
+ "x-events": []
225
+ }
226
+ },
227
+ "/partialUpdate": {
228
+ "post": {
229
+ "tags": ["service"],
230
+ "summary": "Modifie une partie d'une ressource LinkedIn",
231
+ "parameters": [
232
+ {
233
+ "name": "path",
234
+ "summary": "Chemin du service",
235
+ "required": true,
236
+ "description": "Chemin du service à exécuter",
237
+ "schema": {
238
+ "type": "string"
239
+ }
240
+ },
241
+ {
242
+ "name": "body",
243
+ "summary": "Valeur",
244
+ "required": false,
245
+ "description": "Valeur à envoyer",
246
+ "schema": {
247
+ "type": "object"
248
+ }
249
+ },
250
+ {
251
+ "name": "version",
252
+ "summary": "Version de l'API",
253
+ "required": false,
254
+ "description": "Version de l'API à utiliser",
255
+ "schema": {
256
+ "type": "string"
257
+ }
258
+ },
259
+ {
260
+ "name": "headers",
261
+ "summary": "En-têtes",
262
+ "required": false,
263
+ "description": "En-têtes à envoyer",
264
+ "schema": {
265
+ "type": "object"
266
+ }
267
+ },
268
+ {
269
+ "name": "TOKEN",
270
+ "summary": "Jeton d'accès",
271
+ "required": false,
272
+ "description": "Jeton d'accès à utiliser",
273
+ "schema": {
274
+ "type": "string"
275
+ }
276
+ }
277
+ ],
278
+ "x-events": []
279
+ }
280
+ },
281
+ "/remove": {
282
+ "post": {
283
+ "tags": ["service"],
284
+ "summary": "Supprime une ressource LinkedIn",
285
+ "parameters": [
286
+ {
287
+ "name": "path",
288
+ "summary": "Chemin du service",
289
+ "required": true,
290
+ "description": "Chemin du service à exécuter",
291
+ "schema": {
292
+ "type": "string"
293
+ }
294
+ },
295
+ {
296
+ "name": "version",
297
+ "summary": "Version de l'API",
298
+ "required": false,
299
+ "description": "Version de l'API à utiliser",
300
+ "schema": {
301
+ "type": "string"
302
+ }
303
+ },
304
+ {
305
+ "name": "headers",
306
+ "summary": "En-têtes",
307
+ "required": false,
308
+ "description": "En-têtes à envoyer",
309
+ "schema": {
310
+ "type": "object"
311
+ }
312
+ },
313
+ {
314
+ "name": "TOKEN",
315
+ "summary": "Jeton d'accès",
316
+ "required": false,
317
+ "description": "Jeton d'accès à utiliser",
318
+ "schema": {
319
+ "type": "string"
320
+ }
321
+ }
322
+ ],
323
+ "x-events": []
324
+ }
325
+ }
326
+ },
327
+ "components": {
328
+ "schemas": {}
329
+ },
330
+ "x-scene-blocks": {}
331
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/skill-linkedin';
@@ -0,0 +1,7 @@
1
+ import { PinsSettings } from '@digipair/engine';
2
+ export declare const create: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
+ export declare const read: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
+ export declare const update: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
5
+ export declare const partialUpdate: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
6
+ export declare const remove: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
7
+ export declare const request: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;