hcloud-sdk 22.30.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 CHANGED
@@ -1,5 +1,5 @@
1
- ## [22.30.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.29.0...v22.30.0) (2026-09-11)
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
- * implements teams in addressbook ([6a185f8](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/6a185f89d80bd4dbaa1c9027f9bb2c49008936fb))
5
+ * **cosmo:** add avatar support for address books ([042edae](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/042edae9ccd7d54c198588a2961880c850574200))
@@ -10,6 +10,7 @@ export type AddressBook = {
10
10
  teamIds: string[];
11
11
  createDate: number;
12
12
  modifyDate: number;
13
+ avatarUrl: string;
13
14
  creator: ReducedUser;
14
15
  };
15
16
  export type AddressBookCreate = {
@@ -136,4 +136,15 @@ export declare class CosmoAddressBook extends Base {
136
136
  removeAddressBookTeams<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, teamIds: string[], raw?: {
137
137
  raw: R;
138
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>>;
139
150
  }
@@ -183,5 +183,23 @@ class CosmoAddressBook extends Base_1.default {
183
183
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
184
184
  });
185
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
+ }
186
204
  }
187
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "22.30.0",
3
+ "version": "22.31.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",