@studyportals/campaign-management-api-interface 0.5.0 → 0.7.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/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { AuditorCampaignManagementAPIClient } from "./src/auditor-campaign-management-api.client";
2
+ import { CampaignManagementAPIClient } from "./src/campaign-management-api.client";
2
3
  import { AuditorEntityType } from "./src/domain/auditor/enums/auditor-entity-type.enum";
3
4
  import { AuditorOperation } from "./src/domain/auditor/enums/auditor-operation.enum";
4
5
  import { GetAuditorDto } from "./src/domain/auditor/get-auditor.dto";
5
- export { AuditorCampaignManagementAPIClient, AuditorEntityType, AuditorOperation, GetAuditorDto };
6
+ import { CampaignsEntitiesConfigDto } from "./src/domain/campaign/CampaignsEntitiesConfig.dto";
7
+ export { AuditorCampaignManagementAPIClient, CampaignManagementAPIClient, AuditorEntityType, AuditorOperation, GetAuditorDto, CampaignsEntitiesConfigDto };
package/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetAuditorDto = exports.AuditorOperation = exports.AuditorEntityType = exports.AuditorCampaignManagementAPIClient = void 0;
3
+ exports.CampaignsEntitiesConfigDto = exports.GetAuditorDto = exports.AuditorOperation = exports.AuditorEntityType = exports.CampaignManagementAPIClient = exports.AuditorCampaignManagementAPIClient = void 0;
4
4
  const auditor_campaign_management_api_client_1 = require("./src/auditor-campaign-management-api.client");
5
5
  Object.defineProperty(exports, "AuditorCampaignManagementAPIClient", { enumerable: true, get: function () { return auditor_campaign_management_api_client_1.AuditorCampaignManagementAPIClient; } });
6
+ const campaign_management_api_client_1 = require("./src/campaign-management-api.client");
7
+ Object.defineProperty(exports, "CampaignManagementAPIClient", { enumerable: true, get: function () { return campaign_management_api_client_1.CampaignManagementAPIClient; } });
6
8
  const auditor_entity_type_enum_1 = require("./src/domain/auditor/enums/auditor-entity-type.enum");
7
9
  Object.defineProperty(exports, "AuditorEntityType", { enumerable: true, get: function () { return auditor_entity_type_enum_1.AuditorEntityType; } });
8
10
  const auditor_operation_enum_1 = require("./src/domain/auditor/enums/auditor-operation.enum");
9
11
  Object.defineProperty(exports, "AuditorOperation", { enumerable: true, get: function () { return auditor_operation_enum_1.AuditorOperation; } });
10
12
  const get_auditor_dto_1 = require("./src/domain/auditor/get-auditor.dto");
11
13
  Object.defineProperty(exports, "GetAuditorDto", { enumerable: true, get: function () { return get_auditor_dto_1.GetAuditorDto; } });
14
+ const CampaignsEntitiesConfig_dto_1 = require("./src/domain/campaign/CampaignsEntitiesConfig.dto");
15
+ Object.defineProperty(exports, "CampaignsEntitiesConfigDto", { enumerable: true, get: function () { return CampaignsEntitiesConfig_dto_1.CampaignsEntitiesConfigDto; } });
12
16
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yGAAkG;AAO9F,mHAPK,2EAAkC,OAOL;AANtC,kGAAwF;AASpF,kGATK,4CAAiB,OASL;AARrB,8FAAqF;AASjF,iGATK,yCAAgB,OASL;AARpB,0EAAqE;AAWjE,8FAXK,+BAAa,OAWL"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yGAAkG;AAS9F,mHATK,2EAAkC,OASL;AARtC,yFAAmF;AAS/E,4GATK,4DAA2B,OASL;AAR/B,kGAAwF;AAWpF,kGAXK,4CAAiB,OAWL;AAVrB,8FAAqF;AAWjF,iGAXK,yCAAgB,OAWL;AAVpB,0EAAqE;AAajE,8FAbK,+BAAa,OAaL;AAZjB,mGAA+F;AAe3F,2GAfK,wDAA0B,OAeL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/campaign-management-api-interface",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "scripts": {
5
5
  "compile": "rm -fR bin && npx tsc",
6
6
  "test-u": "jest -c jest.config.unit.json --silent --maxWorkers=1",
@@ -0,0 +1,13 @@
1
+ import "reflect-metadata";
2
+ import { CampaignsEntitiesConfigDto } from "./domain/campaign/CampaignsEntitiesConfig.dto";
3
+ export declare class CampaignManagementAPIClient {
4
+ private readonly baseUrl;
5
+ constructor(baseUrl: string);
6
+ addCampaignsEntitiesConfigs(campaignsEntitiesConfigs: CampaignsEntitiesConfigDto[]): Promise<void>;
7
+ removeCampaignsEntitiesConfigsByID(campaignID: number, campaignsEntitiesConfigsIDs: number[]): Promise<void>;
8
+ clearCampaignsEntitiesConfigsByCampaignID(campaignID: number): Promise<void>;
9
+ setEntitiesBasic(organisationIDs: number[], studyIDs: number[]): Promise<void>;
10
+ setEntitiesPremium(organisationIDs: number[], studyIDs: number[]): Promise<void>;
11
+ private postRequest;
12
+ private buildBaseUrl;
13
+ }
@@ -0,0 +1,57 @@
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.CampaignManagementAPIClient = void 0;
13
+ require("reflect-metadata");
14
+ const inversify_1 = require("inversify");
15
+ const superagent = require("superagent");
16
+ let CampaignManagementAPIClient = class CampaignManagementAPIClient {
17
+ constructor(baseUrl) {
18
+ this.baseUrl = baseUrl;
19
+ }
20
+ async addCampaignsEntitiesConfigs(campaignsEntitiesConfigs) {
21
+ const path = `campaigns/add-campaigns-entities-configs`;
22
+ const data = { campaignsEntitiesConfigs: campaignsEntitiesConfigs };
23
+ const result = await this.postRequest(path, data);
24
+ }
25
+ async removeCampaignsEntitiesConfigsByID(campaignID, campaignsEntitiesConfigsIDs) {
26
+ const path = `campaigns/remove-campaigns-entities-configs`;
27
+ const data = { campaignsEntitiesConfigsIDs: campaignsEntitiesConfigsIDs, campaignID: campaignID };
28
+ const result = await this.postRequest(path, data);
29
+ }
30
+ async clearCampaignsEntitiesConfigsByCampaignID(campaignID) {
31
+ const path = `campaigns/clear-campaigns-entities-configs`;
32
+ const data = { campaignID: campaignID };
33
+ const result = await this.postRequest(path, data);
34
+ }
35
+ async setEntitiesBasic(organisationIDs, studyIDs) {
36
+ const path = `campaigns/set-entities-basic`;
37
+ const data = { organisationIDs: organisationIDs, studyIDs: studyIDs };
38
+ const result = await this.postRequest(path, data);
39
+ }
40
+ async setEntitiesPremium(organisationIDs, studyIDs) {
41
+ const path = `campaigns/set-entities-premium`;
42
+ const data = { organisationIDs: organisationIDs, studyIDs: studyIDs };
43
+ const result = await this.postRequest(path, data);
44
+ }
45
+ async postRequest(relative = "", data) {
46
+ return await superagent.post(this.buildBaseUrl(relative)).set("Content-Type", "application/json").send(data);
47
+ }
48
+ buildBaseUrl(relative) {
49
+ return `${this.baseUrl}/${relative}`;
50
+ }
51
+ };
52
+ CampaignManagementAPIClient = __decorate([
53
+ (0, inversify_1.injectable)(),
54
+ __metadata("design:paramtypes", [String])
55
+ ], CampaignManagementAPIClient);
56
+ exports.CampaignManagementAPIClient = CampaignManagementAPIClient;
57
+ //# sourceMappingURL=campaign-management-api.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign-management-api.client.js","sourceRoot":"","sources":["../../src/campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAG1B,yCAAuC;AAGvC,y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gC,CAAC;QAC9C,MAAM,IAAI,GAAG,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAEtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,WAAmB,EAAE,EAAE,IAAS;QACnD,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,CAAC;IAEO,YAAY,CAAC,QAAgB;QACpC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;IACtC,CAAC;CACD,CAAA;AA/CY,2BAA2B;IADvC,IAAA,sBAAU,GAAE;;GACA,2BAA2B,CA+CvC;AA/CY,kEAA2B"}
@@ -0,0 +1,7 @@
1
+ export declare class CampaignsEntitiesConfigDto {
2
+ campaign_id: number;
3
+ sp_id: number;
4
+ product_id: number;
5
+ product2_id: number | null;
6
+ type: string;
7
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CampaignsEntitiesConfigDto = void 0;
4
+ class CampaignsEntitiesConfigDto {
5
+ constructor() {
6
+ this.product2_id = null;
7
+ }
8
+ }
9
+ exports.CampaignsEntitiesConfigDto = CampaignsEntitiesConfigDto;
10
+ //# sourceMappingURL=CampaignsEntitiesConfig.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CampaignsEntitiesConfig.dto.js","sourceRoot":"","sources":["../../../../src/domain/campaign/CampaignsEntitiesConfig.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,0BAA0B;IAAvC;QAIW,gBAAW,GAAkB,IAAI,CAAC;IAE7C,CAAC;CAAA;AAND,gEAMC"}