hcloud-sdk 22.29.0 → 22.31.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/changelog.md +2 -6
- package/lib/interfaces/cosmo/addressBook/index.d.ts +20 -5
- package/lib/service/cosmo/addressBook/index.d.ts +42 -4
- package/lib/service/cosmo/addressBook/index.js +59 -4
- package/lib/service/dali/DaliAvatar.d.ts +6 -0
- package/lib/service/dali/DaliAvatar.js +10 -0
- package/lib/service/dali/avatar/DaliAddressBook.d.ts +35 -0
- package/lib/service/dali/avatar/DaliAddressBook.js +65 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
## [22.
|
|
1
|
+
## [22.31.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.30.0...v22.31.0) (2026-09-14)
|
|
2
2
|
|
|
3
3
|
### Features
|
|
4
4
|
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
### Reverts
|
|
8
|
-
|
|
9
|
-
* introduce a new nats subject for standard user information ([8c61176](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/8c6117617ff972db702646307a677eb6c0f756d6))
|
|
5
|
+
* **cosmo:** add avatar support for address books ([042edae](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/042edae9ccd7d54c198588a2961880c850574200))
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ReducedUser } from "../../idp/user";
|
|
2
|
+
/** Members as key-value pairs: mandatory e-mail address -> optional display name */
|
|
3
|
+
export type AddressBookMembers = Record<string, string | undefined>;
|
|
2
4
|
export type AddressBook = {
|
|
3
5
|
_id: string;
|
|
4
6
|
name: string;
|
|
5
7
|
description?: string;
|
|
6
|
-
members:
|
|
8
|
+
members: AddressBookMembers;
|
|
9
|
+
/** IDs of internal teams referenced by the address book */
|
|
10
|
+
teamIds: string[];
|
|
7
11
|
createDate: number;
|
|
8
12
|
modifyDate: number;
|
|
13
|
+
avatarUrl: string;
|
|
9
14
|
creator: ReducedUser;
|
|
10
15
|
};
|
|
11
16
|
export type AddressBookCreate = {
|
|
@@ -13,8 +18,10 @@ export type AddressBookCreate = {
|
|
|
13
18
|
name: string;
|
|
14
19
|
/** Optional description (max 512 chars) */
|
|
15
20
|
description?: string;
|
|
16
|
-
/** Initial
|
|
17
|
-
members?:
|
|
21
|
+
/** Initial members (e-mail -> optional display name) */
|
|
22
|
+
members?: AddressBookMembers;
|
|
23
|
+
/** Initial list of internal team IDs to reference */
|
|
24
|
+
teamIds?: string[];
|
|
18
25
|
};
|
|
19
26
|
export type AddressBookUpdate = {
|
|
20
27
|
/** New name of the address book (1–128 chars) */
|
|
@@ -22,7 +29,15 @@ export type AddressBookUpdate = {
|
|
|
22
29
|
/** Updated description (max 512 chars) */
|
|
23
30
|
description?: string;
|
|
24
31
|
};
|
|
25
|
-
export type
|
|
26
|
-
/**
|
|
32
|
+
export type AddressBookMemberAddRequest = {
|
|
33
|
+
/** Members to add (e-mail -> optional display name, min 1) */
|
|
34
|
+
members: AddressBookMembers;
|
|
35
|
+
};
|
|
36
|
+
export type AddressBookMemberRemoveRequest = {
|
|
37
|
+
/** List of email addresses to remove (min 1) */
|
|
27
38
|
emails: string[];
|
|
28
39
|
};
|
|
40
|
+
export type AddressBookTeamRequest = {
|
|
41
|
+
/** List of internal team IDs to add or remove (min 1) */
|
|
42
|
+
teamIds: string[];
|
|
43
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
-
import { AddressBook, AddressBookCreate, AddressBookUpdate } from "../../../interfaces/cosmo/addressBook";
|
|
2
|
+
import { AddressBook, AddressBookCreate, AddressBookMembers, AddressBookUpdate } from "../../../interfaces/cosmo/addressBook";
|
|
3
3
|
import { SearchFilter, Sorting } from "../../../interfaces/global/SearchFilters";
|
|
4
4
|
/**
|
|
5
5
|
* @class CosmoAddressBook
|
|
@@ -84,16 +84,16 @@ export declare class CosmoAddressBook extends Base {
|
|
|
84
84
|
raw: R;
|
|
85
85
|
}): Promise<MaybeRaw<R, void>>;
|
|
86
86
|
/**
|
|
87
|
-
* Add one or more members
|
|
87
|
+
* Add one or more members to an Address Book.
|
|
88
88
|
* @remarks
|
|
89
89
|
* **Under development, breaking changes possible**
|
|
90
90
|
* @param orgName Name of the Organization
|
|
91
91
|
* @param spaceName Name of the Space
|
|
92
92
|
* @param bookId ID of the Address Book
|
|
93
|
-
* @param
|
|
93
|
+
* @param members Members to add (e-mail -> optional display name)
|
|
94
94
|
* @returns The updated AddressBook
|
|
95
95
|
*/
|
|
96
|
-
addAddressBookMembers<R extends boolean = false>(orgName: string, spaceName: string, bookId: string,
|
|
96
|
+
addAddressBookMembers<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, members: AddressBookMembers, raw?: {
|
|
97
97
|
raw: R;
|
|
98
98
|
}): Promise<MaybeRaw<R, AddressBook>>;
|
|
99
99
|
/**
|
|
@@ -109,4 +109,42 @@ export declare class CosmoAddressBook extends Base {
|
|
|
109
109
|
removeAddressBookMembers<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, emails: string[], raw?: {
|
|
110
110
|
raw: R;
|
|
111
111
|
}): Promise<MaybeRaw<R, AddressBook>>;
|
|
112
|
+
/**
|
|
113
|
+
* Add one or more internal team references to an Address Book. Team membership stays live: changes to a
|
|
114
|
+
* referenced team are reflected in the address book's recipients.
|
|
115
|
+
* @remarks
|
|
116
|
+
* **Under development, breaking changes possible**
|
|
117
|
+
* @param orgName Name of the Organization
|
|
118
|
+
* @param spaceName Name of the Space
|
|
119
|
+
* @param bookId ID of the Address Book
|
|
120
|
+
* @param teamIds List of internal team IDs to add (min 1)
|
|
121
|
+
* @returns The updated AddressBook
|
|
122
|
+
*/
|
|
123
|
+
addAddressBookTeams<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, teamIds: string[], raw?: {
|
|
124
|
+
raw: R;
|
|
125
|
+
}): Promise<MaybeRaw<R, AddressBook>>;
|
|
126
|
+
/**
|
|
127
|
+
* Remove one or more internal team references from an Address Book.
|
|
128
|
+
* @remarks
|
|
129
|
+
* **Under development, breaking changes possible**
|
|
130
|
+
* @param orgName Name of the Organization
|
|
131
|
+
* @param spaceName Name of the Space
|
|
132
|
+
* @param bookId ID of the Address Book
|
|
133
|
+
* @param teamIds List of internal team IDs to remove (min 1)
|
|
134
|
+
* @returns The updated AddressBook
|
|
135
|
+
*/
|
|
136
|
+
removeAddressBookTeams<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, teamIds: string[], raw?: {
|
|
137
|
+
raw: R;
|
|
138
|
+
}): Promise<MaybeRaw<R, AddressBook>>;
|
|
139
|
+
/**
|
|
140
|
+
* Updates the avatar of the specified Address Book.
|
|
141
|
+
* @param orgName Name of the Organization
|
|
142
|
+
* @param spaceName Name of the Space
|
|
143
|
+
* @param bookId ID of the Address Book
|
|
144
|
+
* @param file Image as Javascript File
|
|
145
|
+
* @returns AddressBook details with updated avatar
|
|
146
|
+
*/
|
|
147
|
+
updateAvatar<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, file: File, raw?: {
|
|
148
|
+
raw: R;
|
|
149
|
+
}): Promise<MaybeRaw<R, AddressBook>>;
|
|
112
150
|
}
|
|
@@ -111,18 +111,18 @@ class CosmoAddressBook extends Base_1.default {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
* Add one or more members
|
|
114
|
+
* Add one or more members to an Address Book.
|
|
115
115
|
* @remarks
|
|
116
116
|
* **Under development, breaking changes possible**
|
|
117
117
|
* @param orgName Name of the Organization
|
|
118
118
|
* @param spaceName Name of the Space
|
|
119
119
|
* @param bookId ID of the Address Book
|
|
120
|
-
* @param
|
|
120
|
+
* @param members Members to add (e-mail -> optional display name)
|
|
121
121
|
* @returns The updated AddressBook
|
|
122
122
|
*/
|
|
123
|
-
addAddressBookMembers(orgName, spaceName, bookId,
|
|
123
|
+
addAddressBookMembers(orgName, spaceName, bookId, members, raw) {
|
|
124
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const payload = {
|
|
125
|
+
const payload = { members };
|
|
126
126
|
const resp = yield this.axios.post(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}/members`), payload);
|
|
127
127
|
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
128
128
|
});
|
|
@@ -146,5 +146,60 @@ class CosmoAddressBook extends Base_1.default {
|
|
|
146
146
|
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Add one or more internal team references to an Address Book. Team membership stays live: changes to a
|
|
151
|
+
* referenced team are reflected in the address book's recipients.
|
|
152
|
+
* @remarks
|
|
153
|
+
* **Under development, breaking changes possible**
|
|
154
|
+
* @param orgName Name of the Organization
|
|
155
|
+
* @param spaceName Name of the Space
|
|
156
|
+
* @param bookId ID of the Address Book
|
|
157
|
+
* @param teamIds List of internal team IDs to add (min 1)
|
|
158
|
+
* @returns The updated AddressBook
|
|
159
|
+
*/
|
|
160
|
+
addAddressBookTeams(orgName, spaceName, bookId, teamIds, raw) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const payload = { teamIds };
|
|
163
|
+
const resp = yield this.axios.post(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}/teams`), payload);
|
|
164
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Remove one or more internal team references from an Address Book.
|
|
169
|
+
* @remarks
|
|
170
|
+
* **Under development, breaking changes possible**
|
|
171
|
+
* @param orgName Name of the Organization
|
|
172
|
+
* @param spaceName Name of the Space
|
|
173
|
+
* @param bookId ID of the Address Book
|
|
174
|
+
* @param teamIds List of internal team IDs to remove (min 1)
|
|
175
|
+
* @returns The updated AddressBook
|
|
176
|
+
*/
|
|
177
|
+
removeAddressBookTeams(orgName, spaceName, bookId, teamIds, raw) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const payload = { teamIds };
|
|
180
|
+
const resp = yield this.axios.delete(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}/teams`), {
|
|
181
|
+
data: payload,
|
|
182
|
+
});
|
|
183
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Updates the avatar of the specified Address Book.
|
|
188
|
+
* @param orgName Name of the Organization
|
|
189
|
+
* @param spaceName Name of the Space
|
|
190
|
+
* @param bookId ID of the Address Book
|
|
191
|
+
* @param file Image as Javascript File
|
|
192
|
+
* @returns AddressBook details with updated avatar
|
|
193
|
+
*/
|
|
194
|
+
updateAvatar(orgName, spaceName, bookId, file, raw) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
const data = new FormData();
|
|
197
|
+
data.append("avatar", file);
|
|
198
|
+
const resp = yield this.axios.patch(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}/avatar`), data, {
|
|
199
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
200
|
+
});
|
|
201
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
149
204
|
}
|
|
150
205
|
exports.CosmoAddressBook = CosmoAddressBook;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Base from "../../Base";
|
|
2
|
+
import { DaliAddressBook } from "./avatar/DaliAddressBook";
|
|
2
3
|
import { DaliCosmoSpace } from "./avatar/DaliCosmoSpace";
|
|
3
4
|
import { DaliHigh5Pool } from "./avatar/DaliHigh5Pool";
|
|
4
5
|
import { DaliHigh5Space } from "./avatar/DaliHigh5Space";
|
|
@@ -44,6 +45,11 @@ export declare class DaliAvatar extends Base {
|
|
|
44
45
|
*/
|
|
45
46
|
get cosmoSpace(): DaliCosmoSpace;
|
|
46
47
|
private _cosmoSpace?;
|
|
48
|
+
/**
|
|
49
|
+
* Handles everything around address book avatars
|
|
50
|
+
*/
|
|
51
|
+
get addressBook(): DaliAddressBook;
|
|
52
|
+
private _addressBook?;
|
|
47
53
|
/**
|
|
48
54
|
* Handles everything around OAuth applications avatars
|
|
49
55
|
*/
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DaliAvatar = void 0;
|
|
7
7
|
const Base_1 = __importDefault(require("../../Base"));
|
|
8
|
+
const DaliAddressBook_1 = require("./avatar/DaliAddressBook");
|
|
8
9
|
const DaliCosmoSpace_1 = require("./avatar/DaliCosmoSpace");
|
|
9
10
|
const DaliHigh5Pool_1 = require("./avatar/DaliHigh5Pool");
|
|
10
11
|
const DaliHigh5Space_1 = require("./avatar/DaliHigh5Space");
|
|
@@ -78,6 +79,15 @@ class DaliAvatar extends Base_1.default {
|
|
|
78
79
|
}
|
|
79
80
|
return this._cosmoSpace;
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Handles everything around address book avatars
|
|
84
|
+
*/
|
|
85
|
+
get addressBook() {
|
|
86
|
+
if (this._addressBook === undefined) {
|
|
87
|
+
this._addressBook = new DaliAddressBook_1.DaliAddressBook(this.options, this.axios);
|
|
88
|
+
}
|
|
89
|
+
return this._addressBook;
|
|
90
|
+
}
|
|
81
91
|
/**
|
|
82
92
|
* Handles everything around OAuth applications avatars
|
|
83
93
|
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { AvatarCreated } from "../../../interfaces/dali";
|
|
3
|
+
export declare class DaliAddressBook extends Base {
|
|
4
|
+
/**
|
|
5
|
+
* Creates a default avatar for the specified Address Book.
|
|
6
|
+
* @param orgName Name of the organization
|
|
7
|
+
* @param spaceName Name of the Cosmo space
|
|
8
|
+
* @param bookId ID of the Address Book
|
|
9
|
+
* @returns Public URL of the created avatar
|
|
10
|
+
*/
|
|
11
|
+
createAvatar<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, raw?: {
|
|
12
|
+
raw: R;
|
|
13
|
+
}): Promise<MaybeRaw<R, AvatarCreated>>;
|
|
14
|
+
/**
|
|
15
|
+
* Deletes the avatar of the Address Book from cloud storage. If you want to update it instead, use updateAvatar().
|
|
16
|
+
* @param orgName Name of the organization
|
|
17
|
+
* @param spaceName Name of the Cosmo space
|
|
18
|
+
* @param bookId ID of the Address Book
|
|
19
|
+
*/
|
|
20
|
+
deleteAvatar<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, raw?: {
|
|
21
|
+
raw: R;
|
|
22
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
23
|
+
/**
|
|
24
|
+
* Updates the avatar of the specified Address Book
|
|
25
|
+
* @param orgName Name of the organization
|
|
26
|
+
* @param spaceName Name of the Cosmo space
|
|
27
|
+
* @param bookId ID of the Address Book
|
|
28
|
+
* @param file Image as Javascript File
|
|
29
|
+
* @returns Public URL of the new avatar
|
|
30
|
+
*/
|
|
31
|
+
updateAvatar<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, file: File, raw?: {
|
|
32
|
+
raw: R;
|
|
33
|
+
}): Promise<MaybeRaw<R, AvatarCreated>>;
|
|
34
|
+
protected getEndpoint(endpoint: string): string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DaliAddressBook = void 0;
|
|
16
|
+
const Base_1 = __importDefault(require("../../../Base"));
|
|
17
|
+
class DaliAddressBook extends Base_1.default {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a default avatar for the specified Address Book.
|
|
20
|
+
* @param orgName Name of the organization
|
|
21
|
+
* @param spaceName Name of the Cosmo space
|
|
22
|
+
* @param bookId ID of the Address Book
|
|
23
|
+
* @returns Public URL of the created avatar
|
|
24
|
+
*/
|
|
25
|
+
createAvatar(orgName, spaceName, bookId, raw) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/avatar/org/${orgName}/spaces/${spaceName}/address-book/${bookId}`), {});
|
|
28
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Deletes the avatar of the Address Book from cloud storage. If you want to update it instead, use updateAvatar().
|
|
33
|
+
* @param orgName Name of the organization
|
|
34
|
+
* @param spaceName Name of the Cosmo space
|
|
35
|
+
* @param bookId ID of the Address Book
|
|
36
|
+
*/
|
|
37
|
+
deleteAvatar(orgName, spaceName, bookId, raw) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/avatar/org/${orgName}/spaces/${spaceName}/address-book/${bookId}`));
|
|
40
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Updates the avatar of the specified Address Book
|
|
45
|
+
* @param orgName Name of the organization
|
|
46
|
+
* @param spaceName Name of the Cosmo space
|
|
47
|
+
* @param bookId ID of the Address Book
|
|
48
|
+
* @param file Image as Javascript File
|
|
49
|
+
* @returns Public URL of the new avatar
|
|
50
|
+
*/
|
|
51
|
+
updateAvatar(orgName, spaceName, bookId, file, raw) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const data = new FormData();
|
|
54
|
+
data.append("avatar", file);
|
|
55
|
+
const resp = yield this.axios.patch(`${this.options.server}/api/cosmo/v1/org/${orgName}/spaces/${spaceName}/address-book/${bookId}/avatar`, data, {
|
|
56
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
57
|
+
});
|
|
58
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : { url: resp.data.avatarUrl });
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getEndpoint(endpoint) {
|
|
62
|
+
return `${this.options.server}/api/dali${endpoint}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.DaliAddressBook = DaliAddressBook;
|