@qikdev/sdk 0.1.157 → 0.1.159
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/dist/main.js +1 -1
- package/package.json +1 -1
- package/src/api/qik.content.js +712 -731
- package/src/api/qik.files.js +30 -4
- package/src/api/qik.utils.js +3 -1
- package/src/version.js +1 -1
package/src/api/qik.files.js
CHANGED
|
@@ -23,12 +23,18 @@ export default function(qik) {
|
|
|
23
23
|
* @param {String} type The type or definition of the item we want to generate the url for
|
|
24
24
|
* @param {(Object|String)} id The id or object with an _id property that we want to generate the url for
|
|
25
25
|
* @param {Object} params Additional parameters and options for the url
|
|
26
|
+
* @param {Object} options Configuration options
|
|
27
|
+
* @param {String} options.filename Provide an optional filename for the url
|
|
28
|
+
* @param {Boolean} options.withoutToken Don't append an access token to the url
|
|
26
29
|
* @example
|
|
27
30
|
* const url = sdk.files.downloadUrl('image', '61eca4746971e75c1fc670cf', {w:100, h:100});
|
|
28
31
|
* // https://api.qik.dev/image/61eca4746971e75c1fc670cf?w=100&h=100&download=true
|
|
29
32
|
*
|
|
30
33
|
* const url = sdk.files.downloadUrl('image', {_id:'61eca4746971e75c1fc670cf'...}, {f:'png'});
|
|
31
34
|
* // https://api.qik.dev/image/61eca4746971e75c1fc670cf?w=100&h=100&download=true
|
|
35
|
+
*
|
|
36
|
+
* const url = sdk.files.downloadUrl('image', '61eca4746971e75c1fc670cf', {w:100, h:100}, {filename:'image.jpg'});
|
|
37
|
+
* // https://api.qik.dev/image/61eca4746971e75c1fc670cf/image.jpg?w=100&h=100&download=true
|
|
32
38
|
*/
|
|
33
39
|
service.downloadUrl = function(type, id, params, options) {
|
|
34
40
|
options = options || {}
|
|
@@ -37,10 +43,17 @@ export default function(qik) {
|
|
|
37
43
|
options.file = true;
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
params = params || {}
|
|
46
|
+
params = params || {};
|
|
41
47
|
params.download = true;
|
|
42
48
|
id = qik.utils.id(id);
|
|
43
|
-
|
|
49
|
+
|
|
50
|
+
let url = `/${type}/${id}`;
|
|
51
|
+
|
|
52
|
+
if(options.filename) {
|
|
53
|
+
url = `${url}/${options.filename}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return qik.api.generateEndpointURL(url, params, options);
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
/**
|
|
@@ -50,10 +63,16 @@ export default function(qik) {
|
|
|
50
63
|
* @param {String} type The type or definition of the item we want to generate the url for
|
|
51
64
|
* @param {(Object|String)} id The id or object with an _id property that we want to generate the url for
|
|
52
65
|
* @param {Object} params Additional parameters and options for the url
|
|
66
|
+
* @param {Object} options Configuration options
|
|
67
|
+
* @param {String} options.filename Provide an optional filename for the url
|
|
68
|
+
* @param {Boolean} options.withoutToken Don't append an access token to the url
|
|
53
69
|
* @example
|
|
54
70
|
* const url = sdk.files.mediaUrl('image', '61eca4746971e75c1fc670cf', {w:100, h:100});
|
|
55
71
|
* // https://api.qik.dev/image/61eca4746971e75c1fc670cf?w=100&h=100&download=true
|
|
56
72
|
*
|
|
73
|
+
* const url = sdk.files.mediaUrl('image', '61eca4746971e75c1fc670cf', {w:100, h:100}, {filename:'image.jpg'});
|
|
74
|
+
* // https://api.qik.dev/image/61eca4746971e75c1fc670cf/image.jpg?w=100&h=100&download=true
|
|
75
|
+
*
|
|
57
76
|
* const url = sdk.files.mediaUrl('image', {_id:'61eca4746971e75c1fc670cf'...}, {f:'png'});
|
|
58
77
|
* // https://api.qik.dev/image/61eca4746971e75c1fc670cf?w=100&h=100&download=true
|
|
59
78
|
*/
|
|
@@ -64,9 +83,16 @@ export default function(qik) {
|
|
|
64
83
|
options.file = true;
|
|
65
84
|
}
|
|
66
85
|
|
|
67
|
-
params = params || {}
|
|
86
|
+
params = params || {};
|
|
68
87
|
id = qik.utils.id(id);
|
|
69
|
-
|
|
88
|
+
|
|
89
|
+
let url = `/${type}/${id}`;
|
|
90
|
+
|
|
91
|
+
if(options.filename) {
|
|
92
|
+
url = `${url}/${options.filename}`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return qik.api.generateEndpointURL(url, params, options);
|
|
70
96
|
}
|
|
71
97
|
|
|
72
98
|
///////////////////////
|
package/src/api/qik.utils.js
CHANGED
|
@@ -702,12 +702,14 @@ service.mapParameters = function(parameters) {
|
|
|
702
702
|
return;
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
+
|
|
706
|
+
|
|
705
707
|
if (Array.isArray(value)) {
|
|
706
708
|
value.forEach(function(v) {
|
|
707
709
|
array.push(`${key}=${encodeURIComponent(v)}`);
|
|
708
710
|
})
|
|
709
711
|
} else {
|
|
710
|
-
array.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
|
|
712
|
+
array.push(encodeURIComponent(key) + '=' + encodeURIComponent(String(value)));
|
|
711
713
|
}
|
|
712
714
|
|
|
713
715
|
})
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version =
|
|
1
|
+
export const version = "0.1.159";
|