@gofynd/fdk-client-javascript 1.3.3 → 1.3.4-beta.2
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/README.md +1 -1
- package/package.json +1 -1
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +18 -1
- package/sdk/application/Catalog/CatalogApplicationModel.js +20 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +3 -3
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +23 -9
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +21 -7
- package/sdk/application/User/UserApplicationClient.d.ts +56 -0
- package/sdk/application/User/UserApplicationClient.js +385 -0
- package/sdk/application/User/UserApplicationModel.d.ts +93 -1
- package/sdk/application/User/UserApplicationModel.js +110 -0
- package/sdk/application/User/UserApplicationValidator.d.ts +66 -1
- package/sdk/application/User/UserApplicationValidator.js +68 -0
- package/sdk/common/AxiosHelper.js +10 -0
- package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +96 -0
- package/sdk/partner/FileStorage/FileStoragePartnerClient.js +177 -0
- package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +139 -0
- package/sdk/partner/FileStorage/FileStoragePartnerModel.js +158 -0
- package/sdk/partner/FileStorage/FileStoragePartnerValidator.d.ts +6 -0
- package/sdk/partner/FileStorage/FileStoragePartnerValidator.js +33 -0
- package/sdk/partner/PartnerClient.d.ts +2 -0
- package/sdk/partner/PartnerClient.js +3 -0
- package/sdk/partner/PartnerConfig.js +3 -5
- package/sdk/partner/index.d.ts +1 -0
- package/sdk/partner/index.js +2 -0
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +4 -16
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +11 -79
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +12 -8
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -9
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +37 -27
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +145 -56
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +22 -11
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +24 -10
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +4 -4
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +4 -8
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +832 -150
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +940 -138
- package/sdk/platform/Order/OrderPlatformClient.d.ts +2 -2
- package/sdk/platform/Order/OrderPlatformClient.js +1 -1
- package/sdk/platform/Order/OrderPlatformModel.d.ts +10 -2
- package/sdk/platform/Order/OrderPlatformModel.js +10 -2
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +4 -4
- package/sdk/platform/Order/OrderPlatformValidator.js +4 -4
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +42 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +241 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +41 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +40 -0
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +72 -1
- package/sdk/platform/Payment/PaymentPlatformModel.js +54 -0
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +12 -0
- package/sdk/platform/User/UserPlatformApplicationClient.js +79 -0
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +15 -1
- package/sdk/platform/User/UserPlatformApplicationValidator.js +14 -0
- package/sdk/platform/User/UserPlatformModel.d.ts +63 -1
- package/sdk/platform/User/UserPlatformModel.js +44 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const Paginator = require("../../common/Paginator");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const PartnerAPIClient = require("../PartnerAPIClient");
|
|
4
|
+
const FileStorageValidator = require("./FileStoragePartnerValidator");
|
|
5
|
+
const FileStorageModel = require("./FileStoragePartnerModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
8
|
+
class FileStorage {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {Object} arg - Arg object.
|
|
15
|
+
* @param {string} arg.namespace - Segregation of different types of
|
|
16
|
+
* files(products, orders, logistics etc), Required for validating the
|
|
17
|
+
* data of the file being uploaded, decides where exactly the file will be
|
|
18
|
+
* stored inside the storage bucket.
|
|
19
|
+
* @param {StartRequest} arg.body
|
|
20
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
21
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
22
|
+
* @summary: This operation initiates upload and returns storage link which is valid for 30 Minutes. You can use that storage link to make subsequent upload request with file buffer or blob.
|
|
23
|
+
* @description: Uploads an arbitrarily sized buffer or blob.
|
|
24
|
+
*
|
|
25
|
+
* It has three Major Steps:
|
|
26
|
+
* Start
|
|
27
|
+
* Upload
|
|
28
|
+
* Complete
|
|
29
|
+
*
|
|
30
|
+
* ### Start
|
|
31
|
+
* Initiates the assets upload using `startUpload`.
|
|
32
|
+
* It returns the storage link in response.
|
|
33
|
+
*
|
|
34
|
+
* ### Upload
|
|
35
|
+
* Use the storage link to upload a file (Buffer or Blob) to the File Storage.
|
|
36
|
+
* Make a `PUT` request on storage link received from `startUpload` api with file (Buffer or Blob) as a request body.
|
|
37
|
+
*
|
|
38
|
+
* ### Complete
|
|
39
|
+
* After successfully upload, call `completeUpload` api to complete the upload process.
|
|
40
|
+
* This operation will return the url for the uploaded file.
|
|
41
|
+
*/
|
|
42
|
+
startUpload(
|
|
43
|
+
{ namespace, body, requestHeaders } = { requestHeaders: {} },
|
|
44
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
45
|
+
) {
|
|
46
|
+
const { error } = FileStorageValidator.startUpload().validate(
|
|
47
|
+
{
|
|
48
|
+
namespace,
|
|
49
|
+
body,
|
|
50
|
+
},
|
|
51
|
+
{ abortEarly: false }
|
|
52
|
+
);
|
|
53
|
+
if (error) {
|
|
54
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const query_params = {};
|
|
58
|
+
|
|
59
|
+
return PartnerAPIClient.execute(
|
|
60
|
+
this.config,
|
|
61
|
+
"post",
|
|
62
|
+
`/service/partner/assets/v1.0/organization/${this.config.organizationId}/namespaces/${namespace}/upload/start`,
|
|
63
|
+
query_params,
|
|
64
|
+
body,
|
|
65
|
+
requestHeaders,
|
|
66
|
+
{ responseHeaders }
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {Object} arg - Arg object.
|
|
72
|
+
* @param {string} arg.namespace - Segregation of different types of
|
|
73
|
+
* files(products, orders, logistics etc), Required for validating the
|
|
74
|
+
* data of the file being uploaded, decides where exactly the file will be
|
|
75
|
+
* stored inside the storage bucket.
|
|
76
|
+
* @param {StartResponse} arg.body
|
|
77
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
78
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
79
|
+
* @summary: This will complete the upload process. After successfully uploading file, you can call this operation to complete the upload process.
|
|
80
|
+
* @description: Uploads an arbitrarily sized buffer or blob.
|
|
81
|
+
*
|
|
82
|
+
* It has three Major Steps:
|
|
83
|
+
* Start
|
|
84
|
+
* Upload
|
|
85
|
+
* Complete
|
|
86
|
+
*
|
|
87
|
+
* ### Start
|
|
88
|
+
* Initiates the assets upload using `startUpload`.
|
|
89
|
+
* It returns the storage link in response.
|
|
90
|
+
*
|
|
91
|
+
* ### Upload
|
|
92
|
+
* Use the storage link to upload a file (Buffer or Blob) to the File Storage.
|
|
93
|
+
* Make a `PUT` request on storage link received from `startUpload` api with file (Buffer or Blob) as a request body.
|
|
94
|
+
*
|
|
95
|
+
* ### Complete
|
|
96
|
+
* After successfully upload, call `completeUpload` api to complete the upload process.
|
|
97
|
+
* This operation will return the url for the uploaded file.
|
|
98
|
+
*/
|
|
99
|
+
completeUpload(
|
|
100
|
+
{ namespace, body, requestHeaders } = { requestHeaders: {} },
|
|
101
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
102
|
+
) {
|
|
103
|
+
const { error } = FileStorageValidator.completeUpload().validate(
|
|
104
|
+
{
|
|
105
|
+
namespace,
|
|
106
|
+
body,
|
|
107
|
+
},
|
|
108
|
+
{ abortEarly: false }
|
|
109
|
+
);
|
|
110
|
+
if (error) {
|
|
111
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const query_params = {};
|
|
115
|
+
|
|
116
|
+
return PartnerAPIClient.execute(
|
|
117
|
+
this.config,
|
|
118
|
+
"post",
|
|
119
|
+
`/service/partner/assets/v1.0/organization/${this.config.organizationId}/namespaces/${namespace}/upload/complete`,
|
|
120
|
+
query_params,
|
|
121
|
+
body,
|
|
122
|
+
requestHeaders,
|
|
123
|
+
{ responseHeaders }
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @param {Object} arg - Arg object.
|
|
129
|
+
* @param {string} arg.namespace - Segregation of different types of
|
|
130
|
+
* files(products, orders, logistics etc), Required for validating the
|
|
131
|
+
* data of the file being uploaded, decides where exactly the file will be
|
|
132
|
+
* stored inside the storage bucket.
|
|
133
|
+
* @param {string} arg.applicationId -
|
|
134
|
+
* @param {number} arg.companyId -
|
|
135
|
+
* @param {number} [arg.page] - Page no
|
|
136
|
+
* @param {number} [arg.limit] - Limit
|
|
137
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
138
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
139
|
+
* @summary: Browse Files
|
|
140
|
+
* @description: Browse Files
|
|
141
|
+
*/
|
|
142
|
+
browse(
|
|
143
|
+
{ namespace, applicationId, companyId, page, limit, requestHeaders } = {
|
|
144
|
+
requestHeaders: {},
|
|
145
|
+
},
|
|
146
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
147
|
+
) {
|
|
148
|
+
const { error } = FileStorageValidator.browse().validate(
|
|
149
|
+
{
|
|
150
|
+
namespace,
|
|
151
|
+
applicationId,
|
|
152
|
+
companyId,
|
|
153
|
+
page,
|
|
154
|
+
limit,
|
|
155
|
+
},
|
|
156
|
+
{ abortEarly: false }
|
|
157
|
+
);
|
|
158
|
+
if (error) {
|
|
159
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const query_params = {};
|
|
163
|
+
query_params["page"] = page;
|
|
164
|
+
query_params["limit"] = limit;
|
|
165
|
+
|
|
166
|
+
return PartnerAPIClient.execute(
|
|
167
|
+
this.config,
|
|
168
|
+
"get",
|
|
169
|
+
`/service/partner/assets/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/namespaces/${namespace}/browse`,
|
|
170
|
+
query_params,
|
|
171
|
+
undefined,
|
|
172
|
+
requestHeaders,
|
|
173
|
+
{ responseHeaders }
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
module.exports = FileStorage;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export = FileStoragePartnerModel;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef CDN
|
|
4
|
+
* @property {string} absolute_url
|
|
5
|
+
* @property {string} relative_url
|
|
6
|
+
* @property {string} url
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef CompleteResponse
|
|
10
|
+
* @property {string} _id
|
|
11
|
+
* @property {CDN} cdn
|
|
12
|
+
* @property {string} content_type
|
|
13
|
+
* @property {CreatedBy} [created_by]
|
|
14
|
+
* @property {string} created_on
|
|
15
|
+
* @property {string} file_name
|
|
16
|
+
* @property {string} file_path
|
|
17
|
+
* @property {string} modified_on
|
|
18
|
+
* @property {string} namespace
|
|
19
|
+
* @property {string} operation
|
|
20
|
+
* @property {number} size
|
|
21
|
+
* @property {boolean} success
|
|
22
|
+
* @property {string[]} [tags]
|
|
23
|
+
* @property {Upload} upload
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* @typedef CreatedBy
|
|
27
|
+
* @property {string} [username]
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* @typedef FailedResponse
|
|
31
|
+
* @property {string} message
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* @typedef Params
|
|
35
|
+
* @property {string} [subpath] - The subpath for the file.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @typedef StartRequest
|
|
39
|
+
* @property {string} content_type
|
|
40
|
+
* @property {string} file_name
|
|
41
|
+
* @property {Params} [params]
|
|
42
|
+
* @property {number} size
|
|
43
|
+
* @property {string[]} [tags]
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @typedef StartResponse
|
|
47
|
+
* @property {CDN} cdn
|
|
48
|
+
* @property {string} content_type
|
|
49
|
+
* @property {string} file_name
|
|
50
|
+
* @property {string} file_path
|
|
51
|
+
* @property {string} [method]
|
|
52
|
+
* @property {string} namespace
|
|
53
|
+
* @property {string} operation
|
|
54
|
+
* @property {number} size
|
|
55
|
+
* @property {string[]} [tags]
|
|
56
|
+
* @property {Upload} upload
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* @typedef Upload
|
|
60
|
+
* @property {number} expiry
|
|
61
|
+
* @property {string} url
|
|
62
|
+
*/
|
|
63
|
+
declare class FileStoragePartnerModel {
|
|
64
|
+
}
|
|
65
|
+
declare namespace FileStoragePartnerModel {
|
|
66
|
+
export { CDN, CompleteResponse, CreatedBy, FailedResponse, Params, StartRequest, StartResponse, Upload };
|
|
67
|
+
}
|
|
68
|
+
/** @returns {CDN} */
|
|
69
|
+
declare function CDN(): CDN;
|
|
70
|
+
type CDN = {
|
|
71
|
+
absolute_url: string;
|
|
72
|
+
relative_url: string;
|
|
73
|
+
url: string;
|
|
74
|
+
};
|
|
75
|
+
/** @returns {CompleteResponse} */
|
|
76
|
+
declare function CompleteResponse(): CompleteResponse;
|
|
77
|
+
type CompleteResponse = {
|
|
78
|
+
_id: string;
|
|
79
|
+
cdn: CDN;
|
|
80
|
+
content_type: string;
|
|
81
|
+
created_by?: CreatedBy;
|
|
82
|
+
created_on: string;
|
|
83
|
+
file_name: string;
|
|
84
|
+
file_path: string;
|
|
85
|
+
modified_on: string;
|
|
86
|
+
namespace: string;
|
|
87
|
+
operation: string;
|
|
88
|
+
size: number;
|
|
89
|
+
success: boolean;
|
|
90
|
+
tags?: string[];
|
|
91
|
+
upload: Upload;
|
|
92
|
+
};
|
|
93
|
+
/** @returns {CreatedBy} */
|
|
94
|
+
declare function CreatedBy(): CreatedBy;
|
|
95
|
+
type CreatedBy = {
|
|
96
|
+
username?: string;
|
|
97
|
+
};
|
|
98
|
+
/** @returns {FailedResponse} */
|
|
99
|
+
declare function FailedResponse(): FailedResponse;
|
|
100
|
+
type FailedResponse = {
|
|
101
|
+
message: string;
|
|
102
|
+
};
|
|
103
|
+
/** @returns {Params} */
|
|
104
|
+
declare function Params(): Params;
|
|
105
|
+
type Params = {
|
|
106
|
+
/**
|
|
107
|
+
* - The subpath for the file.
|
|
108
|
+
*/
|
|
109
|
+
subpath?: string;
|
|
110
|
+
};
|
|
111
|
+
/** @returns {StartRequest} */
|
|
112
|
+
declare function StartRequest(): StartRequest;
|
|
113
|
+
type StartRequest = {
|
|
114
|
+
content_type: string;
|
|
115
|
+
file_name: string;
|
|
116
|
+
params?: Params;
|
|
117
|
+
size: number;
|
|
118
|
+
tags?: string[];
|
|
119
|
+
};
|
|
120
|
+
/** @returns {StartResponse} */
|
|
121
|
+
declare function StartResponse(): StartResponse;
|
|
122
|
+
type StartResponse = {
|
|
123
|
+
cdn: CDN;
|
|
124
|
+
content_type: string;
|
|
125
|
+
file_name: string;
|
|
126
|
+
file_path: string;
|
|
127
|
+
method?: string;
|
|
128
|
+
namespace: string;
|
|
129
|
+
operation: string;
|
|
130
|
+
size: number;
|
|
131
|
+
tags?: string[];
|
|
132
|
+
upload: Upload;
|
|
133
|
+
};
|
|
134
|
+
/** @returns {Upload} */
|
|
135
|
+
declare function Upload(): Upload;
|
|
136
|
+
type Upload = {
|
|
137
|
+
expiry: number;
|
|
138
|
+
url: string;
|
|
139
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef CDN
|
|
5
|
+
* @property {string} absolute_url
|
|
6
|
+
* @property {string} relative_url
|
|
7
|
+
* @property {string} url
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef CompleteResponse
|
|
12
|
+
* @property {string} _id
|
|
13
|
+
* @property {CDN} cdn
|
|
14
|
+
* @property {string} content_type
|
|
15
|
+
* @property {CreatedBy} [created_by]
|
|
16
|
+
* @property {string} created_on
|
|
17
|
+
* @property {string} file_name
|
|
18
|
+
* @property {string} file_path
|
|
19
|
+
* @property {string} modified_on
|
|
20
|
+
* @property {string} namespace
|
|
21
|
+
* @property {string} operation
|
|
22
|
+
* @property {number} size
|
|
23
|
+
* @property {boolean} success
|
|
24
|
+
* @property {string[]} [tags]
|
|
25
|
+
* @property {Upload} upload
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @typedef CreatedBy
|
|
30
|
+
* @property {string} [username]
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef FailedResponse
|
|
35
|
+
* @property {string} message
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @typedef Params
|
|
40
|
+
* @property {string} [subpath] - The subpath for the file.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @typedef StartRequest
|
|
45
|
+
* @property {string} content_type
|
|
46
|
+
* @property {string} file_name
|
|
47
|
+
* @property {Params} [params]
|
|
48
|
+
* @property {number} size
|
|
49
|
+
* @property {string[]} [tags]
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef StartResponse
|
|
54
|
+
* @property {CDN} cdn
|
|
55
|
+
* @property {string} content_type
|
|
56
|
+
* @property {string} file_name
|
|
57
|
+
* @property {string} file_path
|
|
58
|
+
* @property {string} [method]
|
|
59
|
+
* @property {string} namespace
|
|
60
|
+
* @property {string} operation
|
|
61
|
+
* @property {number} size
|
|
62
|
+
* @property {string[]} [tags]
|
|
63
|
+
* @property {Upload} upload
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @typedef Upload
|
|
68
|
+
* @property {number} expiry
|
|
69
|
+
* @property {string} url
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
class FileStoragePartnerModel {
|
|
73
|
+
/** @returns {CDN} */
|
|
74
|
+
static CDN() {
|
|
75
|
+
return Joi.object({
|
|
76
|
+
absolute_url: Joi.string().allow("").required(),
|
|
77
|
+
relative_url: Joi.string().allow("").required(),
|
|
78
|
+
url: Joi.string().allow("").required(),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** @returns {CompleteResponse} */
|
|
83
|
+
static CompleteResponse() {
|
|
84
|
+
return Joi.object({
|
|
85
|
+
_id: Joi.string().allow("").required(),
|
|
86
|
+
cdn: FileStoragePartnerModel.CDN().required(),
|
|
87
|
+
content_type: Joi.string().allow("").required(),
|
|
88
|
+
created_by: FileStoragePartnerModel.CreatedBy(),
|
|
89
|
+
created_on: Joi.string().allow("").required(),
|
|
90
|
+
file_name: Joi.string().allow("").required(),
|
|
91
|
+
file_path: Joi.string().allow("").required(),
|
|
92
|
+
modified_on: Joi.string().allow("").required(),
|
|
93
|
+
namespace: Joi.string().allow("").required(),
|
|
94
|
+
operation: Joi.string().allow("").required(),
|
|
95
|
+
size: Joi.number().required(),
|
|
96
|
+
success: Joi.boolean().required(),
|
|
97
|
+
tags: Joi.array().items(Joi.string().allow("")),
|
|
98
|
+
upload: FileStoragePartnerModel.Upload().required(),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @returns {CreatedBy} */
|
|
103
|
+
static CreatedBy() {
|
|
104
|
+
return Joi.object({
|
|
105
|
+
username: Joi.string().allow(""),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** @returns {FailedResponse} */
|
|
110
|
+
static FailedResponse() {
|
|
111
|
+
return Joi.object({
|
|
112
|
+
message: Joi.string().allow("").required(),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** @returns {Params} */
|
|
117
|
+
static Params() {
|
|
118
|
+
return Joi.object({
|
|
119
|
+
subpath: Joi.string().allow(""),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** @returns {StartRequest} */
|
|
124
|
+
static StartRequest() {
|
|
125
|
+
return Joi.object({
|
|
126
|
+
content_type: Joi.string().allow("").required(),
|
|
127
|
+
file_name: Joi.string().allow("").required(),
|
|
128
|
+
params: FileStoragePartnerModel.Params(),
|
|
129
|
+
size: Joi.number().required(),
|
|
130
|
+
tags: Joi.array().items(Joi.string().allow("")),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** @returns {StartResponse} */
|
|
135
|
+
static StartResponse() {
|
|
136
|
+
return Joi.object({
|
|
137
|
+
cdn: FileStoragePartnerModel.CDN().required(),
|
|
138
|
+
content_type: Joi.string().allow("").required(),
|
|
139
|
+
file_name: Joi.string().allow("").required(),
|
|
140
|
+
file_path: Joi.string().allow("").required(),
|
|
141
|
+
method: Joi.string().allow(""),
|
|
142
|
+
namespace: Joi.string().allow("").required(),
|
|
143
|
+
operation: Joi.string().allow("").required(),
|
|
144
|
+
size: Joi.number().required(),
|
|
145
|
+
tags: Joi.array().items(Joi.string().allow("")),
|
|
146
|
+
upload: FileStoragePartnerModel.Upload().required(),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** @returns {Upload} */
|
|
151
|
+
static Upload() {
|
|
152
|
+
return Joi.object({
|
|
153
|
+
expiry: Joi.number().required(),
|
|
154
|
+
url: Joi.string().allow("").required(),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
module.exports = FileStoragePartnerModel;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
const FileStorageModel = require("./FileStoragePartnerModel");
|
|
4
|
+
class FileStorageValidator {
|
|
5
|
+
static startUpload() {
|
|
6
|
+
return Joi.object({
|
|
7
|
+
namespace: Joi.string().allow("").required(),
|
|
8
|
+
|
|
9
|
+
body: FileStorageModel.StartRequest().required(),
|
|
10
|
+
}).required();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static completeUpload() {
|
|
14
|
+
return Joi.object({
|
|
15
|
+
namespace: Joi.string().allow("").required(),
|
|
16
|
+
|
|
17
|
+
body: FileStorageModel.StartResponse().required(),
|
|
18
|
+
}).required();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static browse() {
|
|
22
|
+
return Joi.object({
|
|
23
|
+
namespace: Joi.string().allow("").required(),
|
|
24
|
+
|
|
25
|
+
applicationId: Joi.string().allow("").required(),
|
|
26
|
+
companyId: Joi.number().required(),
|
|
27
|
+
page: Joi.number(),
|
|
28
|
+
limit: Joi.number(),
|
|
29
|
+
}).required();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = FileStorageValidator;
|
|
@@ -13,6 +13,7 @@ declare class PartnerClient {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(config: import("./PartnerConfig"));
|
|
15
15
|
config: import("./PartnerConfig");
|
|
16
|
+
fileStorage: FileStorage;
|
|
16
17
|
theme: Theme;
|
|
17
18
|
/**
|
|
18
19
|
* Sets the extra headers for the partner client.
|
|
@@ -22,4 +23,5 @@ declare class PartnerClient {
|
|
|
22
23
|
*/
|
|
23
24
|
setExtraHeaders(header: object): void;
|
|
24
25
|
}
|
|
26
|
+
import FileStorage = require("./FileStorage/FileStoragePartnerClient");
|
|
25
27
|
import Theme = require("./Theme/ThemePartnerClient");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const FileStorage = require("./FileStorage/FileStoragePartnerClient");
|
|
2
|
+
|
|
1
3
|
const Theme = require("./Theme/ThemePartnerClient");
|
|
2
4
|
|
|
3
5
|
const { FDKClientValidationError } = require("../common/FDKError");
|
|
@@ -16,6 +18,7 @@ class PartnerClient {
|
|
|
16
18
|
*/
|
|
17
19
|
constructor(config) {
|
|
18
20
|
this.config = config;
|
|
21
|
+
this.fileStorage = new FileStorage(config);
|
|
19
22
|
this.theme = new Theme(config);
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -29,11 +29,9 @@ class PartnerConfig {
|
|
|
29
29
|
this.domain = config.domain || "https://api.fynd.com";
|
|
30
30
|
this.apiKey = config.apiKey;
|
|
31
31
|
this.apiSecret = config.apiSecret;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
? config.useAutoRenewTimer
|
|
36
|
-
: true);
|
|
32
|
+
this.scope = config.scope;
|
|
33
|
+
this.useAutoRenewTimer =
|
|
34
|
+
config.useAutoRenewTimer !== undefined ? config.useAutoRenewTimer : true;
|
|
37
35
|
this.oauthClient = new OauthClient(this);
|
|
38
36
|
this.logLevel = config.logLevel || "ERROR";
|
|
39
37
|
this.setLogLevel(this.logLevel);
|
package/sdk/partner/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const PartnerConfig: typeof import("./PartnerConfig");
|
|
2
2
|
export const PartnerClient: typeof import("./PartnerClient");
|
|
3
3
|
export namespace PartnerModel {
|
|
4
|
+
const FileStoragePartnerModel: typeof import("./FileStorage/FileStoragePartnerModel");
|
|
4
5
|
const ThemePartnerModel: typeof import("./Theme/ThemePartnerModel");
|
|
5
6
|
}
|
package/sdk/partner/index.js
CHANGED
|
@@ -2,6 +2,8 @@ module.exports = {
|
|
|
2
2
|
PartnerConfig: require("./PartnerConfig"),
|
|
3
3
|
PartnerClient: require("./PartnerClient"),
|
|
4
4
|
PartnerModel: {
|
|
5
|
+
FileStoragePartnerModel: require("./FileStorage/FileStoragePartnerModel"),
|
|
6
|
+
|
|
5
7
|
ThemePartnerModel: require("./Theme/ThemePartnerModel"),
|
|
6
8
|
},
|
|
7
9
|
};
|
|
@@ -135,18 +135,6 @@ declare class Content {
|
|
|
135
135
|
* @description: A slideshow is a group of images, videos or a combination of both that are shown on the website in the form of slides. Use this API to create a slideshow. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/createSlideshow/).
|
|
136
136
|
*/
|
|
137
137
|
createSlideshow({ body, requestHeaders }?: ContentPlatformApplicationValidator.CreateSlideshowParam, { responseHeaders }?: object): Promise<ContentPlatformModel.SlideshowSchema>;
|
|
138
|
-
/**
|
|
139
|
-
* @param {ContentPlatformApplicationValidator.DeleteAllInjectableTagsParam} arg
|
|
140
|
-
* - Arg object
|
|
141
|
-
*
|
|
142
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
143
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
144
|
-
* @returns {Promise<ContentPlatformModel.TagsSchema>} - Success response
|
|
145
|
-
* @name deleteAllInjectableTags
|
|
146
|
-
* @summary: Delete tags in application
|
|
147
|
-
* @description: Use this API to delete all the existing tags at once. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/deleteAllInjectableTags/).
|
|
148
|
-
*/
|
|
149
|
-
deleteAllInjectableTags({ requestHeaders }?: any, { responseHeaders }?: object): Promise<ContentPlatformModel.TagsSchema>;
|
|
150
138
|
/**
|
|
151
139
|
* @param {ContentPlatformApplicationValidator.DeleteAnnouncementParam} arg
|
|
152
140
|
* - Arg object
|
|
@@ -456,9 +444,9 @@ declare class Content {
|
|
|
456
444
|
* @returns {Promise<ContentPlatformModel.TagsSchema>} - Success response
|
|
457
445
|
* @name getInjectableTags
|
|
458
446
|
* @summary: Get all the tags in an application
|
|
459
|
-
* @description: Use this API to get
|
|
447
|
+
* @description: Use this API to get the CSS and JS injected in the application in the form of tags. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getInjectableTags/).
|
|
460
448
|
*/
|
|
461
|
-
getInjectableTags({ requestHeaders }?:
|
|
449
|
+
getInjectableTags({ all, requestHeaders }?: ContentPlatformApplicationValidator.GetInjectableTagsParam, { responseHeaders }?: object): Promise<ContentPlatformModel.TagsSchema>;
|
|
462
450
|
/**
|
|
463
451
|
* @param {ContentPlatformApplicationValidator.GetLandingPagesParam} arg - Arg object
|
|
464
452
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -788,8 +776,8 @@ declare class Content {
|
|
|
788
776
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
789
777
|
* @returns {Promise<ContentPlatformModel.TagsSchema>} - Success response
|
|
790
778
|
* @name updateInjectableTag
|
|
791
|
-
* @summary: Update
|
|
792
|
-
* @description: Use this API to edit
|
|
779
|
+
* @summary: Update the exisitng tags for an application by replacing with provided tags
|
|
780
|
+
* @description: Use this API to edit and override all existing tags. All existing tags will be replaced by the new tags provided in body. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/updateInjectableTag/).
|
|
793
781
|
*/
|
|
794
782
|
updateInjectableTag({ body, requestHeaders }?: ContentPlatformApplicationValidator.UpdateInjectableTagParam, { responseHeaders }?: object): Promise<ContentPlatformModel.TagsSchema>;
|
|
795
783
|
/**
|