@juhuu/sdk-ts 1.0.6 → 1.0.8
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/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +56 -30
- package/dist/index.mjs +56 -30
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -534,6 +534,7 @@ declare class Service {
|
|
534
534
|
declare class SessionService extends Service {
|
535
535
|
constructor(config: JUHUU.SetupConfig);
|
536
536
|
create(SessionCreateParams: JUHUU.Session.Create.Params, SessionCreateOptions?: JUHUU.Session.Create.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Create.Response>>;
|
537
|
+
export(SessionExportParams: JUHUU.Session.Export.Params, SessionExportOptions?: JUHUU.Session.Export.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Export.Response>>;
|
537
538
|
retrieve(SessionRetrieveParams: JUHUU.Session.Retrieve.Params, SessionRetrieveOptions?: JUHUU.Session.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Retrieve.Response>>;
|
538
539
|
list(SessionListParams: JUHUU.Session.List.Params, SessionListOptions?: JUHUU.Session.List.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.List.Response>>;
|
539
540
|
update(SessionUpdateParams: JUHUU.Session.Update.Params, SessionUpdateOptions?: JUHUU.Session.Update.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Update.Response>>;
|
@@ -780,6 +781,16 @@ declare namespace JUHUU {
|
|
780
781
|
session: JUHUU.Session.Object;
|
781
782
|
};
|
782
783
|
}
|
784
|
+
export namespace Export {
|
785
|
+
type Params = {
|
786
|
+
propertyId: string;
|
787
|
+
outputType: "csv";
|
788
|
+
};
|
789
|
+
type Options = JUHUU.RequestOptions;
|
790
|
+
type Response = {
|
791
|
+
outputUrl: string;
|
792
|
+
};
|
793
|
+
}
|
783
794
|
export namespace Retrieve {
|
784
795
|
type Params = {
|
785
796
|
sessionId: string;
|
package/dist/index.d.ts
CHANGED
@@ -534,6 +534,7 @@ declare class Service {
|
|
534
534
|
declare class SessionService extends Service {
|
535
535
|
constructor(config: JUHUU.SetupConfig);
|
536
536
|
create(SessionCreateParams: JUHUU.Session.Create.Params, SessionCreateOptions?: JUHUU.Session.Create.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Create.Response>>;
|
537
|
+
export(SessionExportParams: JUHUU.Session.Export.Params, SessionExportOptions?: JUHUU.Session.Export.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Export.Response>>;
|
537
538
|
retrieve(SessionRetrieveParams: JUHUU.Session.Retrieve.Params, SessionRetrieveOptions?: JUHUU.Session.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Retrieve.Response>>;
|
538
539
|
list(SessionListParams: JUHUU.Session.List.Params, SessionListOptions?: JUHUU.Session.List.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.List.Response>>;
|
539
540
|
update(SessionUpdateParams: JUHUU.Session.Update.Params, SessionUpdateOptions?: JUHUU.Session.Update.Options): Promise<JUHUU.HttpResponse<JUHUU.Session.Update.Response>>;
|
@@ -780,6 +781,16 @@ declare namespace JUHUU {
|
|
780
781
|
session: JUHUU.Session.Object;
|
781
782
|
};
|
782
783
|
}
|
784
|
+
export namespace Export {
|
785
|
+
type Params = {
|
786
|
+
propertyId: string;
|
787
|
+
outputType: "csv";
|
788
|
+
};
|
789
|
+
type Options = JUHUU.RequestOptions;
|
790
|
+
type Response = {
|
791
|
+
outputUrl: string;
|
792
|
+
};
|
793
|
+
}
|
783
794
|
export namespace Retrieve {
|
784
795
|
type Params = {
|
785
796
|
sessionId: string;
|
package/dist/index.js
CHANGED
@@ -88,13 +88,13 @@ var Service = class {
|
|
88
88
|
options.refreshTokensIfNecessary = true;
|
89
89
|
}
|
90
90
|
let token = null;
|
91
|
-
if (options.accessToken === void 0) {
|
91
|
+
if (options.accessToken === void 0 || options.accessToken === null) {
|
92
92
|
token = await this.getAccessToken();
|
93
93
|
} else {
|
94
94
|
token = options.accessToken;
|
95
95
|
}
|
96
|
-
console.log("
|
97
|
-
if (token === null || void 0) {
|
96
|
+
console.log("accessToken:", token);
|
97
|
+
if ((token === null || token === void 0) && useAuthentication === true) {
|
98
98
|
console.error(
|
99
99
|
"endpoint",
|
100
100
|
url,
|
@@ -204,34 +204,43 @@ var Service = class {
|
|
204
204
|
return responseObject;
|
205
205
|
}
|
206
206
|
async sendGetRequest(token, uri) {
|
207
|
+
const headers = {
|
208
|
+
"Content-Type": "application/json",
|
209
|
+
"Client-Version": this.clientVersion
|
210
|
+
};
|
211
|
+
if (token !== void 0 && token !== null) {
|
212
|
+
headers.Authorization = `Bearer ${token}`;
|
213
|
+
}
|
207
214
|
return await fetch(uri, {
|
208
215
|
method: "GET",
|
209
|
-
headers
|
210
|
-
"Content-Type": "application/json",
|
211
|
-
"Client-Version": this.clientVersion,
|
212
|
-
Authorization: token ? `Bearer ${token}` : ""
|
213
|
-
}
|
216
|
+
headers
|
214
217
|
});
|
215
218
|
}
|
216
219
|
async sendPostRequest(token, uri, body) {
|
220
|
+
const headers = {
|
221
|
+
"Content-Type": "application/json",
|
222
|
+
"Client-Version": this.clientVersion
|
223
|
+
};
|
224
|
+
if (token !== void 0 && token !== null) {
|
225
|
+
headers.Authorization = `Bearer ${token}`;
|
226
|
+
}
|
217
227
|
return await fetch(uri, {
|
218
228
|
method: "POST",
|
219
|
-
headers
|
220
|
-
"Content-Type": "application/json",
|
221
|
-
"Client-Version": this.clientVersion,
|
222
|
-
Authorization: token ? `Bearer ${token}` : ""
|
223
|
-
},
|
229
|
+
headers,
|
224
230
|
body: JSON.stringify(body)
|
225
231
|
});
|
226
232
|
}
|
227
233
|
async sendPatchRequest(token, uri, body) {
|
234
|
+
const headers = {
|
235
|
+
"Content-Type": "application/json",
|
236
|
+
"Client-Version": this.clientVersion
|
237
|
+
};
|
238
|
+
if (token !== void 0 && token !== null) {
|
239
|
+
headers.Authorization = `Bearer ${token}`;
|
240
|
+
}
|
228
241
|
return await fetch(uri, {
|
229
242
|
method: "PATCH",
|
230
|
-
headers
|
231
|
-
"Content-Type": "application/json",
|
232
|
-
"Client-Version": this.clientVersion,
|
233
|
-
Authorization: token ? `Bearer ${token}` : ""
|
234
|
-
},
|
243
|
+
headers,
|
235
244
|
body: JSON.stringify(body)
|
236
245
|
});
|
237
246
|
}
|
@@ -258,19 +267,36 @@ var SessionService = class extends Service {
|
|
258
267
|
super(config);
|
259
268
|
}
|
260
269
|
async create(SessionCreateParams, SessionCreateOptions) {
|
261
|
-
return await super.sendRequest(
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
270
|
+
return await super.sendRequest(
|
271
|
+
{
|
272
|
+
method: "POST",
|
273
|
+
url: "sessions",
|
274
|
+
body: {
|
275
|
+
locationId: SessionCreateParams.locationId,
|
276
|
+
tariffId: SessionCreateParams.tariffId,
|
277
|
+
autoRenew: SessionCreateParams.autoRenew,
|
278
|
+
type: SessionCreateParams.sessionType,
|
279
|
+
isOffSession: SessionCreateParams.isOffSession,
|
280
|
+
userId: SessionCreateParams.userId
|
281
|
+
},
|
282
|
+
useAuthentication: true
|
271
283
|
},
|
272
|
-
|
273
|
-
|
284
|
+
SessionCreateOptions
|
285
|
+
);
|
286
|
+
}
|
287
|
+
async export(SessionExportParams, SessionExportOptions) {
|
288
|
+
return await super.sendRequest(
|
289
|
+
{
|
290
|
+
method: "POST",
|
291
|
+
url: "sessions",
|
292
|
+
body: {
|
293
|
+
propertyId: SessionExportParams.propertyId,
|
294
|
+
outputType: SessionExportParams.outputType
|
295
|
+
},
|
296
|
+
useAuthentication: true
|
297
|
+
},
|
298
|
+
SessionExportOptions
|
299
|
+
);
|
274
300
|
}
|
275
301
|
async retrieve(SessionRetrieveParams, SessionRetrieveOptions) {
|
276
302
|
const queryArray = [];
|
package/dist/index.mjs
CHANGED
@@ -43,13 +43,13 @@ var Service = class {
|
|
43
43
|
options.refreshTokensIfNecessary = true;
|
44
44
|
}
|
45
45
|
let token = null;
|
46
|
-
if (options.accessToken === void 0) {
|
46
|
+
if (options.accessToken === void 0 || options.accessToken === null) {
|
47
47
|
token = await this.getAccessToken();
|
48
48
|
} else {
|
49
49
|
token = options.accessToken;
|
50
50
|
}
|
51
|
-
console.log("
|
52
|
-
if (token === null || void 0) {
|
51
|
+
console.log("accessToken:", token);
|
52
|
+
if ((token === null || token === void 0) && useAuthentication === true) {
|
53
53
|
console.error(
|
54
54
|
"endpoint",
|
55
55
|
url,
|
@@ -159,34 +159,43 @@ var Service = class {
|
|
159
159
|
return responseObject;
|
160
160
|
}
|
161
161
|
async sendGetRequest(token, uri) {
|
162
|
+
const headers = {
|
163
|
+
"Content-Type": "application/json",
|
164
|
+
"Client-Version": this.clientVersion
|
165
|
+
};
|
166
|
+
if (token !== void 0 && token !== null) {
|
167
|
+
headers.Authorization = `Bearer ${token}`;
|
168
|
+
}
|
162
169
|
return await fetch(uri, {
|
163
170
|
method: "GET",
|
164
|
-
headers
|
165
|
-
"Content-Type": "application/json",
|
166
|
-
"Client-Version": this.clientVersion,
|
167
|
-
Authorization: token ? `Bearer ${token}` : ""
|
168
|
-
}
|
171
|
+
headers
|
169
172
|
});
|
170
173
|
}
|
171
174
|
async sendPostRequest(token, uri, body) {
|
175
|
+
const headers = {
|
176
|
+
"Content-Type": "application/json",
|
177
|
+
"Client-Version": this.clientVersion
|
178
|
+
};
|
179
|
+
if (token !== void 0 && token !== null) {
|
180
|
+
headers.Authorization = `Bearer ${token}`;
|
181
|
+
}
|
172
182
|
return await fetch(uri, {
|
173
183
|
method: "POST",
|
174
|
-
headers
|
175
|
-
"Content-Type": "application/json",
|
176
|
-
"Client-Version": this.clientVersion,
|
177
|
-
Authorization: token ? `Bearer ${token}` : ""
|
178
|
-
},
|
184
|
+
headers,
|
179
185
|
body: JSON.stringify(body)
|
180
186
|
});
|
181
187
|
}
|
182
188
|
async sendPatchRequest(token, uri, body) {
|
189
|
+
const headers = {
|
190
|
+
"Content-Type": "application/json",
|
191
|
+
"Client-Version": this.clientVersion
|
192
|
+
};
|
193
|
+
if (token !== void 0 && token !== null) {
|
194
|
+
headers.Authorization = `Bearer ${token}`;
|
195
|
+
}
|
183
196
|
return await fetch(uri, {
|
184
197
|
method: "PATCH",
|
185
|
-
headers
|
186
|
-
"Content-Type": "application/json",
|
187
|
-
"Client-Version": this.clientVersion,
|
188
|
-
Authorization: token ? `Bearer ${token}` : ""
|
189
|
-
},
|
198
|
+
headers,
|
190
199
|
body: JSON.stringify(body)
|
191
200
|
});
|
192
201
|
}
|
@@ -213,19 +222,36 @@ var SessionService = class extends Service {
|
|
213
222
|
super(config);
|
214
223
|
}
|
215
224
|
async create(SessionCreateParams, SessionCreateOptions) {
|
216
|
-
return await super.sendRequest(
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
225
|
+
return await super.sendRequest(
|
226
|
+
{
|
227
|
+
method: "POST",
|
228
|
+
url: "sessions",
|
229
|
+
body: {
|
230
|
+
locationId: SessionCreateParams.locationId,
|
231
|
+
tariffId: SessionCreateParams.tariffId,
|
232
|
+
autoRenew: SessionCreateParams.autoRenew,
|
233
|
+
type: SessionCreateParams.sessionType,
|
234
|
+
isOffSession: SessionCreateParams.isOffSession,
|
235
|
+
userId: SessionCreateParams.userId
|
236
|
+
},
|
237
|
+
useAuthentication: true
|
226
238
|
},
|
227
|
-
|
228
|
-
|
239
|
+
SessionCreateOptions
|
240
|
+
);
|
241
|
+
}
|
242
|
+
async export(SessionExportParams, SessionExportOptions) {
|
243
|
+
return await super.sendRequest(
|
244
|
+
{
|
245
|
+
method: "POST",
|
246
|
+
url: "sessions",
|
247
|
+
body: {
|
248
|
+
propertyId: SessionExportParams.propertyId,
|
249
|
+
outputType: SessionExportParams.outputType
|
250
|
+
},
|
251
|
+
useAuthentication: true
|
252
|
+
},
|
253
|
+
SessionExportOptions
|
254
|
+
);
|
229
255
|
}
|
230
256
|
async retrieve(SessionRetrieveParams, SessionRetrieveOptions) {
|
231
257
|
const queryArray = [];
|