@studyportals/search-api-interface 1.0.0-beta.5 → 1.0.0-beta.6
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.
|
@@ -5,6 +5,7 @@ import { IOrganisationSearchResponse } from "./IOrganisationSearchResponse";
|
|
|
5
5
|
export declare class SearchApiOrganisationClient extends SearchApiClientBase {
|
|
6
6
|
private readonly requestFactory;
|
|
7
7
|
private readonly requestSender;
|
|
8
|
+
private readonly organisationCardFactory;
|
|
8
9
|
constructor(apiUriBase: string, requestFactory: ISuperAgentRequestFactory, requestSender: IRequestSender);
|
|
9
10
|
searchCards(filters: any, resultSize: number, resultOffset: number): Promise<IOrganisationSearchResponse<IOrganisationCard>>;
|
|
10
11
|
}
|
|
@@ -11,9 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SearchApiOrganisationClient = void 0;
|
|
13
13
|
const SearchApiClientBase_1 = require("./SearchApiClientBase");
|
|
14
|
+
const domain_client_1 = require("@studyportals/domain-client");
|
|
14
15
|
class SearchApiOrganisationClient extends SearchApiClientBase_1.SearchApiClientBase {
|
|
15
16
|
constructor(apiUriBase, requestFactory, requestSender) {
|
|
16
17
|
super("organisations", apiUriBase);
|
|
18
|
+
this.organisationCardFactory = new domain_client_1.OrganisationCardClient();
|
|
17
19
|
this.requestFactory = requestFactory;
|
|
18
20
|
this.requestSender = requestSender;
|
|
19
21
|
}
|
|
@@ -21,7 +23,8 @@ class SearchApiOrganisationClient extends SearchApiClientBase_1.SearchApiClientB
|
|
|
21
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
24
|
const request = this.requestFactory.get(this.constructUri("search"))
|
|
23
25
|
.query(Object.assign(Object.assign({}, filters), { resultSize, resultOffset }));
|
|
24
|
-
|
|
26
|
+
const result = yield this.requestSender.sendAndExtractBody(request);
|
|
27
|
+
return Object.assign(Object.assign({}, result), { organisations: this.organisationCardFactory.fromDescriptions([...result.organisations]) });
|
|
25
28
|
});
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchApiOrganisationClient.js","sourceRoot":"","sources":["../../../src/organisations/SearchApiOrganisationClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA4D;
|
|
1
|
+
{"version":3,"file":"SearchApiOrganisationClient.js","sourceRoot":"","sources":["../../../src/organisations/SearchApiOrganisationClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA4D;AAE5D,+DAAwF;AAIxF,MAAa,2BAA4B,SAAQ,yCAAmB;IAMnE,YAAmB,UAAkB,EACpC,cAAyC,EACzC,aAA6B;QAE7B,KAAK,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QANnB,4BAAuB,GAAG,IAAI,sCAAsB,EAAE,CAAC;QAQvE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;IAEY,WAAW,CAAC,OAAY,EAAE,UAAkB,EAAE,YAAoB;;YAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;iBAClE,KAAK,iCAAM,OAAO,KAAE,UAAU,EAAE,YAAY,IAAG,CAAC;YAElD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAiD,OAAO,CAAC,CAAC;YAEpH,uCACI,MAAM,KACT,aAAa,EAAE,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,IACvF;QACF,CAAC;KAAA;CACD;AA3BD,kEA2BC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SearchApiClientBase } from "./SearchApiClientBase";
|
|
2
2
|
import { IRequestSender, ISuperAgentRequestFactory } from "@studyportals/mb-platform-http-requests";
|
|
3
|
-
import { IOrganisationCard } from "@studyportals/domain-client";
|
|
3
|
+
import { IOrganisationCard, OrganisationCardClient } from "@studyportals/domain-client";
|
|
4
4
|
import { IOrganisationSearchResponse } from "./IOrganisationSearchResponse";
|
|
5
|
+
import { IModelDescription } from "@studyportals/domain-client/src/i-model-description";
|
|
5
6
|
|
|
6
7
|
export class SearchApiOrganisationClient extends SearchApiClientBase {
|
|
7
8
|
|
|
8
9
|
private readonly requestFactory: ISuperAgentRequestFactory;
|
|
9
10
|
private readonly requestSender: IRequestSender;
|
|
11
|
+
private readonly organisationCardFactory = new OrganisationCardClient();
|
|
10
12
|
|
|
11
13
|
public constructor(apiUriBase: string,
|
|
12
14
|
requestFactory: ISuperAgentRequestFactory,
|
|
@@ -22,6 +24,11 @@ export class SearchApiOrganisationClient extends SearchApiClientBase {
|
|
|
22
24
|
const request = this.requestFactory.get(this.constructUri("search"))
|
|
23
25
|
.query({ ...filters, resultSize, resultOffset });
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
const result = await this.requestSender.sendAndExtractBody<IOrganisationSearchResponse<IModelDescription>>(request);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...result,
|
|
31
|
+
organisations: this.organisationCardFactory.fromDescriptions([...result.organisations])
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
}
|