@studyportals/campaign-management-api-interface 3.6.1 → 3.6.2-1
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 +1 -1
- package/src/domain/organisations/index.d.ts +2 -1
- package/src/domain/organisations/index.js +3 -1
- package/src/domain/organisations/index.js.map +1 -1
- package/src/domain/organisations/source-link-data.dto.d.ts +12 -0
- package/src/domain/organisations/source-link-data.dto.js +15 -0
- package/src/domain/organisations/source-link-data.dto.js.map +1 -0
- package/src/domain/organisations/source-links.dto.d.ts +2 -1
- package/src/domain/organisations/source-links.dto.js +3 -1
- package/src/domain/organisations/source-links.dto.js.map +1 -1
- package/src/organisations-campaign-management-api.client.d.ts +4 -1
- package/src/organisations-campaign-management-api.client.js +32 -2
- package/src/organisations-campaign-management-api.client.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SourceLinkLevels } from "./enums/source-link-levels.enum";
|
|
2
2
|
import { SourceLinkSubTypes } from "./enums/source-link-sub-types.enum";
|
|
3
3
|
import { SourceLinkTypes } from "./enums/source-link-types.enum";
|
|
4
|
+
import { SourceLinkDataDto } from "./source-link-data.dto";
|
|
4
5
|
import { SourceLinkDto } from "./source-links.dto";
|
|
5
|
-
export { SourceLinkDto, SourceLinkLevels, SourceLinkSubTypes, SourceLinkTypes };
|
|
6
|
+
export { SourceLinkDto, SourceLinkDataDto, SourceLinkLevels, SourceLinkSubTypes, SourceLinkTypes };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SourceLinkTypes = exports.SourceLinkSubTypes = exports.SourceLinkLevels = exports.SourceLinkDto = void 0;
|
|
3
|
+
exports.SourceLinkTypes = exports.SourceLinkSubTypes = exports.SourceLinkLevels = exports.SourceLinkDataDto = exports.SourceLinkDto = void 0;
|
|
4
4
|
const source_link_levels_enum_1 = require("./enums/source-link-levels.enum");
|
|
5
5
|
Object.defineProperty(exports, "SourceLinkLevels", { enumerable: true, get: function () { return source_link_levels_enum_1.SourceLinkLevels; } });
|
|
6
6
|
const source_link_sub_types_enum_1 = require("./enums/source-link-sub-types.enum");
|
|
7
7
|
Object.defineProperty(exports, "SourceLinkSubTypes", { enumerable: true, get: function () { return source_link_sub_types_enum_1.SourceLinkSubTypes; } });
|
|
8
8
|
const source_link_types_enum_1 = require("./enums/source-link-types.enum");
|
|
9
9
|
Object.defineProperty(exports, "SourceLinkTypes", { enumerable: true, get: function () { return source_link_types_enum_1.SourceLinkTypes; } });
|
|
10
|
+
const source_link_data_dto_1 = require("./source-link-data.dto");
|
|
11
|
+
Object.defineProperty(exports, "SourceLinkDataDto", { enumerable: true, get: function () { return source_link_data_dto_1.SourceLinkDataDto; } });
|
|
10
12
|
const source_links_dto_1 = require("./source-links.dto");
|
|
11
13
|
Object.defineProperty(exports, "SourceLinkDto", { enumerable: true, get: function () { return source_links_dto_1.SourceLinkDto; } });
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/organisations/index.ts"],"names":[],"mappings":";;;AAAA,6EAAmE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/organisations/index.ts"],"names":[],"mappings":";;;AAAA,6EAAmE;AAWlE,iGAXQ,0CAAgB,OAWR;AAVjB,mFAAwE;AAWvE,mGAXQ,+CAAkB,OAWR;AAVnB,2EAAiE;AAWhE,gGAXQ,wCAAe,OAWR;AAVhB,iEAA2D;AAM1D,kGANQ,wCAAiB,OAMR;AALlB,yDAAmD;AAIlD,8FAJQ,gCAAa,OAIR"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SourceLinkLevels } from "./enums/source-link-levels.enum";
|
|
2
|
+
import { SourceLinkSubTypes } from "./enums/source-link-sub-types.enum";
|
|
3
|
+
import { SourceLinkTypes } from "./enums/source-link-types.enum";
|
|
4
|
+
export declare class SourceLinkDataDto {
|
|
5
|
+
readonly organisationId: number;
|
|
6
|
+
readonly level: SourceLinkLevels;
|
|
7
|
+
readonly type: SourceLinkTypes;
|
|
8
|
+
readonly subType: SourceLinkSubTypes | null;
|
|
9
|
+
readonly url: string | null;
|
|
10
|
+
readonly doesExist: boolean;
|
|
11
|
+
constructor(organisationId: number, level: SourceLinkLevels, type: SourceLinkTypes, subType: SourceLinkSubTypes | null, url: string | null, doesExist: boolean);
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceLinkDataDto = void 0;
|
|
4
|
+
class SourceLinkDataDto {
|
|
5
|
+
constructor(organisationId, level, type, subType, url, doesExist) {
|
|
6
|
+
this.organisationId = organisationId;
|
|
7
|
+
this.level = level;
|
|
8
|
+
this.type = type;
|
|
9
|
+
this.subType = subType;
|
|
10
|
+
this.url = url;
|
|
11
|
+
this.doesExist = doesExist;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.SourceLinkDataDto = SourceLinkDataDto;
|
|
15
|
+
//# sourceMappingURL=source-link-data.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-link-data.dto.js","sourceRoot":"","sources":["../../../../src/domain/organisations/source-link-data.dto.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAC7B,YACiB,cAAsB,EACtB,KAAuB,EACvB,IAAqB,EACrB,OAAkC,EAClC,GAAkB,EAClB,SAAkB;QALlB,mBAAc,GAAd,cAAc,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAkB;QACvB,SAAI,GAAJ,IAAI,CAAiB;QACrB,YAAO,GAAP,OAAO,CAA2B;QAClC,QAAG,GAAH,GAAG,CAAe;QAClB,cAAS,GAAT,SAAS,CAAS;IAChC,CAAC;CACJ;AATD,8CASC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SourceLinkLevels } from "./enums/source-link-levels.enum";
|
|
2
2
|
import { SourceLinkSubTypes } from "./enums/source-link-sub-types.enum";
|
|
3
3
|
import { SourceLinkTypes } from "./enums/source-link-types.enum";
|
|
4
|
-
|
|
4
|
+
import { SourceLinkDataDto } from "./source-link-data.dto";
|
|
5
|
+
export declare class SourceLinkDto extends SourceLinkDataDto {
|
|
5
6
|
readonly id: number;
|
|
6
7
|
readonly organisationId: number;
|
|
7
8
|
readonly level: SourceLinkLevels;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SourceLinkDto = void 0;
|
|
4
|
-
|
|
4
|
+
const source_link_data_dto_1 = require("./source-link-data.dto");
|
|
5
|
+
class SourceLinkDto extends source_link_data_dto_1.SourceLinkDataDto {
|
|
5
6
|
constructor(id, organisationId, level, type, subType, url, doesExist) {
|
|
7
|
+
super(organisationId, level, type, subType, url, doesExist);
|
|
6
8
|
this.id = id;
|
|
7
9
|
this.organisationId = organisationId;
|
|
8
10
|
this.level = level;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-links.dto.js","sourceRoot":"","sources":["../../../../src/domain/organisations/source-links.dto.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"source-links.dto.js","sourceRoot":"","sources":["../../../../src/domain/organisations/source-links.dto.ts"],"names":[],"mappings":";;;AAGA,iEAA2D;AAE3D,MAAa,aAAc,SAAQ,wCAAiB;IACnD,YACiB,EAAU,EACV,cAAsB,EACtB,KAAuB,EACvB,IAAqB,EACrB,OAAkC,EAClC,GAAkB,EAClB,SAAkB;QAElC,KAAK,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QAR5C,OAAE,GAAF,EAAE,CAAQ;QACV,mBAAc,GAAd,cAAc,CAAQ;QACtB,UAAK,GAAL,KAAK,CAAkB;QACvB,SAAI,GAAJ,IAAI,CAAiB;QACrB,YAAO,GAAP,OAAO,CAA2B;QAClC,QAAG,GAAH,GAAG,CAAe;QAClB,cAAS,GAAT,SAAS,CAAS;IAGnC,CAAC;CACD;AAZD,sCAYC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { MinimalOrganisationDto } from "./domain/organisations/minimal-organisations.dto";
|
|
3
|
-
import { SourceLinkDto } from "./domain/organisations";
|
|
3
|
+
import { SourceLinkDataDto, SourceLinkDto } from "./domain/organisations";
|
|
4
4
|
export declare class OrganisationsCampaignManagementAPIClient {
|
|
5
5
|
private readonly baseUrl;
|
|
6
6
|
constructor(baseUrl: string);
|
|
7
7
|
getMinimalOrganisation(organisationID: number, jwt?: string): Promise<MinimalOrganisationDto>;
|
|
8
8
|
searchOrganisations(searchTerm: string, jwt?: string, limit?: number): Promise<MinimalOrganisationDto[]>;
|
|
9
9
|
getSourceLinks(organisationID: number, jwt?: string): Promise<SourceLinkDto[]>;
|
|
10
|
+
createSourceLinks(sourceLinks: SourceLinkDataDto[], jwt?: string): Promise<void>;
|
|
11
|
+
updateSourceLinks(sourceLinks: SourceLinkDto[], jwt?: string): Promise<void>;
|
|
10
12
|
private postRequest;
|
|
13
|
+
private putRequest;
|
|
11
14
|
private getRequest;
|
|
12
15
|
private buildBaseUrl;
|
|
13
16
|
}
|
|
@@ -31,8 +31,8 @@ let OrganisationsCampaignManagementAPIClient = class OrganisationsCampaignManage
|
|
|
31
31
|
try {
|
|
32
32
|
const path = `organisations/search`;
|
|
33
33
|
const result = await this.postRequest(path, {
|
|
34
|
-
searchTerm
|
|
35
|
-
limit
|
|
34
|
+
searchTerm,
|
|
35
|
+
limit
|
|
36
36
|
}, jwt);
|
|
37
37
|
return result.body;
|
|
38
38
|
}
|
|
@@ -50,12 +50,42 @@ let OrganisationsCampaignManagementAPIClient = class OrganisationsCampaignManage
|
|
|
50
50
|
throw new Error(`getSourceLinks error: ${error}`);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
async createSourceLinks(sourceLinks, jwt = "") {
|
|
54
|
+
try {
|
|
55
|
+
const path = `organisations/source-links`;
|
|
56
|
+
const result = await this.postRequest(path, sourceLinks, jwt);
|
|
57
|
+
if (result.status !== 201) {
|
|
58
|
+
throw new Error(`createSourceLinks status is not 201. ${result.body}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
throw new Error(`createSourceLinks error: ${error}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async updateSourceLinks(sourceLinks, jwt = "") {
|
|
66
|
+
try {
|
|
67
|
+
const path = `organisations/source-links`;
|
|
68
|
+
const result = await this.putRequest(path, sourceLinks, jwt);
|
|
69
|
+
if (result.status === 200) {
|
|
70
|
+
throw new Error(`updateSourceLinks status is not 200. ${result.body}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
throw new Error(`updateSourceLinks error: ${error}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
53
77
|
async postRequest(relative = "", data, jwt = "") {
|
|
54
78
|
return await superagent.post(this.buildBaseUrl(relative))
|
|
55
79
|
.set("Content-Type", "application/json")
|
|
56
80
|
.set("Authorization", jwt)
|
|
57
81
|
.send(data);
|
|
58
82
|
}
|
|
83
|
+
async putRequest(relative = "", data, jwt = "") {
|
|
84
|
+
return await superagent.put(this.buildBaseUrl(relative))
|
|
85
|
+
.set("Content-Type", "application/json")
|
|
86
|
+
.set("Authorization", jwt)
|
|
87
|
+
.send(data);
|
|
88
|
+
}
|
|
59
89
|
async getRequest(relative = "", jwt = "") {
|
|
60
90
|
return await superagent.get(this.buildBaseUrl(relative))
|
|
61
91
|
.set("Content-Type", "application/json")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organisations-campaign-management-api.client.js","sourceRoot":"","sources":["../../src/organisations-campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAG1B,yCAAuC;AAEvC,yCAAyC;AAKlC,IAAM,wCAAwC,GAA9C,MAAM,wCAAwC;IACpD,YACkB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAC7B,CAAC;IAEE,KAAK,CAAC,sBAAsB,CAAC,cAAsB,EAAE,GAAG,GAAG,EAAE;QACnE,IAAI;YACH,MAAM,IAAI,GAAG,yBAAyB,cAAc,EAAE,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAEhD,OAAO,MAAM,CAAC,IAA8B,CAAC;SAC7C;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,EAAE,CAAC,CAAC;SAC1D;IACF,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,UAAkB,EAAE,GAAG,GAAC,EAAE,EAAE,KAAK,GAAG,EAAE;QACtE,IAAI;YACH,MAAM,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;gBAC3C,UAAU
|
|
1
|
+
{"version":3,"file":"organisations-campaign-management-api.client.js","sourceRoot":"","sources":["../../src/organisations-campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAG1B,yCAAuC;AAEvC,yCAAyC;AAKlC,IAAM,wCAAwC,GAA9C,MAAM,wCAAwC;IACpD,YACkB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAC7B,CAAC;IAEE,KAAK,CAAC,sBAAsB,CAAC,cAAsB,EAAE,GAAG,GAAG,EAAE;QACnE,IAAI;YACH,MAAM,IAAI,GAAG,yBAAyB,cAAc,EAAE,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CA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