@studyportals/campaign-management-api-interface 11.3.0 → 11.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/campaign-management-api-interface",
3
- "version": "11.3.0",
3
+ "version": "11.4.0",
4
4
  "scripts": {
5
5
  "compile": "rm -fR bin && npx tsc",
6
6
  "test-u": "jest -c jest.config.unit.json --maxWorkers=1",
@@ -0,0 +1,3 @@
1
+ import { ProductDto } from "./product.dto";
2
+ import { ProductsDto } from "./products.dto";
3
+ export { ProductDto, ProductsDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/products/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type ProductDto = {
2
+ id: number;
3
+ name: string;
4
+ description: string;
5
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=product.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.dto.js","sourceRoot":"","sources":["../../../../src/domain/products/product.dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { ProductDto } from "./product.dto";
2
+ export type ProductsDto = {
3
+ products: ProductDto[];
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=products.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.dto.js","sourceRoot":"","sources":["../../../../src/domain/products/products.dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import "reflect-metadata";
2
+ import { ProductsDto } from "./domain/products/products.dto";
3
+ export declare class ProductsCampaignManagementAPIClient {
4
+ private readonly baseUrl;
5
+ constructor(baseUrl: string);
6
+ getAllProducts(jwt?: string): Promise<ProductsDto>;
7
+ private getRequest;
8
+ private buildBaseUrl;
9
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProductsCampaignManagementAPIClient = void 0;
13
+ require("reflect-metadata");
14
+ const inversify_1 = require("inversify");
15
+ const superagent = require("superagent");
16
+ let ProductsCampaignManagementAPIClient = class ProductsCampaignManagementAPIClient {
17
+ constructor(baseUrl) {
18
+ this.baseUrl = baseUrl;
19
+ }
20
+ async getAllProducts(jwt = "") {
21
+ try {
22
+ const path = `products`;
23
+ const result = await this.getRequest(path, jwt);
24
+ return result.body;
25
+ }
26
+ catch (error) {
27
+ throw new Error(`getAllProducts error: ${error}`);
28
+ }
29
+ }
30
+ async getRequest(relative = "", jwt = "") {
31
+ return await superagent.get(this.buildBaseUrl(relative))
32
+ .set("Content-Type", "application/json")
33
+ .set("Authorization", jwt)
34
+ .send();
35
+ }
36
+ buildBaseUrl(relative) {
37
+ return `${this.baseUrl}/${relative}`;
38
+ }
39
+ };
40
+ exports.ProductsCampaignManagementAPIClient = ProductsCampaignManagementAPIClient;
41
+ exports.ProductsCampaignManagementAPIClient = ProductsCampaignManagementAPIClient = __decorate([
42
+ (0, inversify_1.injectable)(),
43
+ __metadata("design:paramtypes", [String])
44
+ ], ProductsCampaignManagementAPIClient);
45
+ //# sourceMappingURL=products-campaign-management-api.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products-campaign-management-api.client.js","sourceRoot":"","sources":["../../src/products-campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAG1B,yCAAuC;AACvC,yCAAyC;AAIlC,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC/C,YACkB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAC7B,CAAC;IAEE,KAAK,CAAC,cAAc,CAAC,GAAG,GAAG,EAAE;QACnC,IAAI,CAAC;YACJ,MAAM,IAAI,GAAG,UAAU,CAAC;YACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAEhD,OAAO,MAAM,CAAC,IAAmB,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAC;QACnD,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,EAAE,GAAG,GAAG,EAAE;QACvD,OAAO,MAAM,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;aACtD,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC;aACvC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC;aACzB,IAAI,EAAE,CAAC;IACV,CAAC;IAEO,YAAY,CAAC,QAAgB;QACpC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;IACtC,CAAC;CACD,CAAA;AA1BY,kFAAmC;8CAAnC,mCAAmC;IAD/C,IAAA,sBAAU,GAAE;;GACA,mCAAmC,CA0B/C"}