@stackfactor/client-api 1.1.55 → 1.1.56

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/lib/avatar.js +49 -0
  2. package/package.json +1 -1
package/lib/avatar.js ADDED
@@ -0,0 +1,49 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Get conversation by elementId
5
+ * @param {String} elementId
6
+ * @param {String} type
7
+ * @param {Number} width
8
+ * @param {Number} height
9
+ * @param {String} name
10
+ * @param {String} description
11
+ * @param {Boolean} autoCreate
12
+ * @param {String} token
13
+ * @returns {Promise}
14
+ */
15
+ const getAvatar = (
16
+ elementId,
17
+ type,
18
+ width,
19
+ height,
20
+ name,
21
+ description,
22
+ autoCreate,
23
+ token
24
+ ) => {
25
+ return new Promise(function (resolve, reject) {
26
+ let confirmationRequest = client.get(
27
+ `/api/v1/avatar/${elementId}/${type}/${width}/${height}`,
28
+ {
29
+ headers: {
30
+ authorization: token,
31
+ ...(autoCreate
32
+ ? { autoCreate: autoCreate, name: name, description: description }
33
+ : {}),
34
+ },
35
+ }
36
+ );
37
+ confirmationRequest
38
+ .then((response) => {
39
+ resolve(response.data);
40
+ })
41
+ .catch((error) => {
42
+ reject(error);
43
+ });
44
+ });
45
+ };
46
+
47
+ export default {
48
+ getAvatar,
49
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.1.55",
3
+ "version": "1.1.56",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {