@studyportals/domain-client 8.3.1 → 8.5.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/domain-client",
3
- "version": "8.3.1",
3
+ "version": "8.5.0",
4
4
  "description": "Responsible for fetching data from the Domain API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,43 @@
1
+ import { Location } from "../Location.js";
2
+ import { ReviewRating } from "../ReviewRating.js";
3
+ export interface OrganisationCard {
4
+ id: number;
5
+ name: string;
6
+ summary?: string | undefined;
7
+ relativeUrlPath: string;
8
+ logoUrl?: string | undefined;
9
+ locations: Location[];
10
+ hasAttendanceOnline: boolean;
11
+ hasAttendanceOnCampus: boolean;
12
+ hasAttendanceBlended: boolean;
13
+ venueCount: number;
14
+ globalRankingPositionPercentage?: string | undefined;
15
+ globalRankingPosition?: number | undefined;
16
+ programmeCountByLevel: {
17
+ [key: string]: number;
18
+ };
19
+ scholarshipCountByLevel: {
20
+ [key: string]: number;
21
+ };
22
+ isPublicFunding: boolean;
23
+ isNonProfitFunding: boolean;
24
+ isForProfitFunding: boolean;
25
+ reviewRating?: ReviewRating | undefined;
26
+ isPremium: boolean;
27
+ }
28
+ export interface OrganisationCard_ProgrammeCountByLevelEntry {
29
+ key: string;
30
+ value: number;
31
+ }
32
+ export interface OrganisationCard_ScholarshipCountByLevelEntry {
33
+ key: string;
34
+ value: number;
35
+ }
36
+ export declare const OrganisationCard: MessageFns<OrganisationCard>;
37
+ export declare const OrganisationCard_ProgrammeCountByLevelEntry: MessageFns<OrganisationCard_ProgrammeCountByLevelEntry>;
38
+ export declare const OrganisationCard_ScholarshipCountByLevelEntry: MessageFns<OrganisationCard_ScholarshipCountByLevelEntry>;
39
+ interface MessageFns<T> {
40
+ fromJSON(object: any): T;
41
+ toJSON(message: T): unknown;
42
+ }
43
+ export {};
@@ -0,0 +1,168 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.7.7
4
+ // protoc v6.33.2
5
+ // source: Organisation/OrganisationCard.proto
6
+ /* eslint-disable */
7
+ import { Location } from "../Location.js";
8
+ import { ReviewRating } from "../ReviewRating.js";
9
+ export const OrganisationCard = {
10
+ fromJSON(object) {
11
+ return {
12
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
13
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
14
+ summary: isSet(object.summary) ? globalThis.String(object.summary) : undefined,
15
+ relativeUrlPath: isSet(object.relativeUrlPath) ? globalThis.String(object.relativeUrlPath) : "",
16
+ logoUrl: isSet(object.logoUrl) ? globalThis.String(object.logoUrl) : undefined,
17
+ locations: globalThis.Array.isArray(object?.locations)
18
+ ? object.locations.map((e) => Location.fromJSON(e))
19
+ : [],
20
+ hasAttendanceOnline: isSet(object.hasAttendanceOnline) ? globalThis.Boolean(object.hasAttendanceOnline) : false,
21
+ hasAttendanceOnCampus: isSet(object.hasAttendanceOnCampus)
22
+ ? globalThis.Boolean(object.hasAttendanceOnCampus)
23
+ : false,
24
+ hasAttendanceBlended: isSet(object.hasAttendanceBlended)
25
+ ? globalThis.Boolean(object.hasAttendanceBlended)
26
+ : false,
27
+ venueCount: isSet(object.venueCount) ? globalThis.Number(object.venueCount) : 0,
28
+ globalRankingPositionPercentage: isSet(object.globalRankingPositionPercentage)
29
+ ? globalThis.String(object.globalRankingPositionPercentage)
30
+ : undefined,
31
+ globalRankingPosition: isSet(object.globalRankingPosition)
32
+ ? globalThis.Number(object.globalRankingPosition)
33
+ : undefined,
34
+ programmeCountByLevel: isObject(object.programmeCountByLevel)
35
+ ? Object.entries(object.programmeCountByLevel).reduce((acc, [key, value]) => {
36
+ acc[key] = Number(value);
37
+ return acc;
38
+ }, {})
39
+ : {},
40
+ scholarshipCountByLevel: isObject(object.scholarshipCountByLevel)
41
+ ? Object.entries(object.scholarshipCountByLevel).reduce((acc, [key, value]) => {
42
+ acc[key] = Number(value);
43
+ return acc;
44
+ }, {})
45
+ : {},
46
+ isPublicFunding: isSet(object.isPublicFunding) ? globalThis.Boolean(object.isPublicFunding) : false,
47
+ isNonProfitFunding: isSet(object.isNonProfitFunding) ? globalThis.Boolean(object.isNonProfitFunding) : false,
48
+ isForProfitFunding: isSet(object.isForProfitFunding) ? globalThis.Boolean(object.isForProfitFunding) : false,
49
+ reviewRating: isSet(object.reviewRating) ? ReviewRating.fromJSON(object.reviewRating) : undefined,
50
+ isPremium: isSet(object.isPremium) ? globalThis.Boolean(object.isPremium) : false,
51
+ };
52
+ },
53
+ toJSON(message) {
54
+ const obj = {};
55
+ if (message.id !== 0) {
56
+ obj.id = Math.round(message.id);
57
+ }
58
+ if (message.name !== "") {
59
+ obj.name = message.name;
60
+ }
61
+ if (message.summary !== undefined) {
62
+ obj.summary = message.summary;
63
+ }
64
+ if (message.relativeUrlPath !== "") {
65
+ obj.relativeUrlPath = message.relativeUrlPath;
66
+ }
67
+ if (message.logoUrl !== undefined) {
68
+ obj.logoUrl = message.logoUrl;
69
+ }
70
+ if (message.locations?.length) {
71
+ obj.locations = message.locations.map((e) => Location.toJSON(e));
72
+ }
73
+ if (message.hasAttendanceOnline !== false) {
74
+ obj.hasAttendanceOnline = message.hasAttendanceOnline;
75
+ }
76
+ if (message.hasAttendanceOnCampus !== false) {
77
+ obj.hasAttendanceOnCampus = message.hasAttendanceOnCampus;
78
+ }
79
+ if (message.hasAttendanceBlended !== false) {
80
+ obj.hasAttendanceBlended = message.hasAttendanceBlended;
81
+ }
82
+ if (message.venueCount !== 0) {
83
+ obj.venueCount = Math.round(message.venueCount);
84
+ }
85
+ if (message.globalRankingPositionPercentage !== undefined) {
86
+ obj.globalRankingPositionPercentage = message.globalRankingPositionPercentage;
87
+ }
88
+ if (message.globalRankingPosition !== undefined) {
89
+ obj.globalRankingPosition = Math.round(message.globalRankingPosition);
90
+ }
91
+ if (message.programmeCountByLevel) {
92
+ const entries = Object.entries(message.programmeCountByLevel);
93
+ if (entries.length > 0) {
94
+ obj.programmeCountByLevel = {};
95
+ entries.forEach(([k, v]) => {
96
+ obj.programmeCountByLevel[k] = Math.round(v);
97
+ });
98
+ }
99
+ }
100
+ if (message.scholarshipCountByLevel) {
101
+ const entries = Object.entries(message.scholarshipCountByLevel);
102
+ if (entries.length > 0) {
103
+ obj.scholarshipCountByLevel = {};
104
+ entries.forEach(([k, v]) => {
105
+ obj.scholarshipCountByLevel[k] = Math.round(v);
106
+ });
107
+ }
108
+ }
109
+ if (message.isPublicFunding !== false) {
110
+ obj.isPublicFunding = message.isPublicFunding;
111
+ }
112
+ if (message.isNonProfitFunding !== false) {
113
+ obj.isNonProfitFunding = message.isNonProfitFunding;
114
+ }
115
+ if (message.isForProfitFunding !== false) {
116
+ obj.isForProfitFunding = message.isForProfitFunding;
117
+ }
118
+ if (message.reviewRating !== undefined) {
119
+ obj.reviewRating = ReviewRating.toJSON(message.reviewRating);
120
+ }
121
+ if (message.isPremium !== false) {
122
+ obj.isPremium = message.isPremium;
123
+ }
124
+ return obj;
125
+ },
126
+ };
127
+ export const OrganisationCard_ProgrammeCountByLevelEntry = {
128
+ fromJSON(object) {
129
+ return {
130
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
131
+ value: isSet(object.value) ? globalThis.Number(object.value) : 0,
132
+ };
133
+ },
134
+ toJSON(message) {
135
+ const obj = {};
136
+ if (message.key !== "") {
137
+ obj.key = message.key;
138
+ }
139
+ if (message.value !== 0) {
140
+ obj.value = Math.round(message.value);
141
+ }
142
+ return obj;
143
+ },
144
+ };
145
+ export const OrganisationCard_ScholarshipCountByLevelEntry = {
146
+ fromJSON(object) {
147
+ return {
148
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
149
+ value: isSet(object.value) ? globalThis.Number(object.value) : 0,
150
+ };
151
+ },
152
+ toJSON(message) {
153
+ const obj = {};
154
+ if (message.key !== "") {
155
+ obj.key = message.key;
156
+ }
157
+ if (message.value !== 0) {
158
+ obj.value = Math.round(message.value);
159
+ }
160
+ return obj;
161
+ },
162
+ };
163
+ function isObject(value) {
164
+ return typeof value === "object" && value !== null;
165
+ }
166
+ function isSet(value) {
167
+ return value !== null && value !== undefined;
168
+ }
@@ -44,4 +44,5 @@ export * from "./TrackedLink.js";
44
44
  export * from "./Tracking.js";
45
45
  export * from "./TuitionFee.js";
46
46
  export * from "./Unibuddy.js";
47
+ export * from "./Organisation/OrganisationCard.js";
47
48
  export * from "./google/protobuf/timestamp.js";
package/protobuf/index.js CHANGED
@@ -44,4 +44,5 @@ export * from "./TrackedLink.js";
44
44
  export * from "./Tracking.js";
45
45
  export * from "./TuitionFee.js";
46
46
  export * from "./Unibuddy.js";
47
+ export * from "./Organisation/OrganisationCard.js";
47
48
  export * from "./google/protobuf/timestamp.js";
@@ -2,6 +2,7 @@
2
2
  * @file Automatically generated by barrelsby.
3
3
  */
4
4
  export * from "./article-detail-page-client.js";
5
+ export * from "./organisation-card-v2-client.js";
5
6
  export * from "./organisation-page-client.js";
6
7
  export * from "./programme-card-v2-client.js";
7
8
  export * from "./protobuf-client.js";
@@ -2,6 +2,7 @@
2
2
  * @file Automatically generated by barrelsby.
3
3
  */
4
4
  export * from "./article-detail-page-client.js";
5
+ export * from "./organisation-card-v2-client.js";
5
6
  export * from "./organisation-page-client.js";
6
7
  export * from "./programme-card-v2-client.js";
7
8
  export * from "./protobuf-client.js";
@@ -0,0 +1,8 @@
1
+ import { OrganisationCard } from "../../protobuf/index.js";
2
+ import { ProtobufClient } from "./protobuf-client.js";
3
+ export declare class OrganisationCardV2Client extends ProtobufClient<OrganisationCard> {
4
+ protected constructModel(data: Record<string, any>): OrganisationCard;
5
+ protected getModelName(): string;
6
+ protected getVersion(): string;
7
+ isPublic(): boolean;
8
+ }
@@ -0,0 +1,16 @@
1
+ import { OrganisationCard } from "../../protobuf/index.js";
2
+ import { ProtobufClient } from "./protobuf-client.js";
3
+ export class OrganisationCardV2Client extends ProtobufClient {
4
+ constructModel(data) {
5
+ return OrganisationCard.fromJSON(data);
6
+ }
7
+ getModelName() {
8
+ return 'organisation-card-v2';
9
+ }
10
+ getVersion() {
11
+ return 'v1';
12
+ }
13
+ isPublic() {
14
+ return false;
15
+ }
16
+ }