hcloud-sdk 22.4.0 → 22.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/changelog.md CHANGED
@@ -1,6 +1,5 @@
1
- ## [22.4.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.3.0...v22.4.0) (2026-07-23)
1
+ ## [22.5.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.4.0...v22.5.0) (2026-07-23)
2
2
 
3
3
  ### Features
4
4
 
5
- * update error codes ([746b535](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/746b535126921eba8510df861baff12351276cfd))
6
- * update error codes ([c15e73a](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/c15e73aaa020d13b5f2431f423b5304f657d506b))
5
+ * implements addressbooks on spacelevel ([b604a47](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/b604a47338b03a9164b7b791ab29b638f8c88e58))
@@ -0,0 +1,28 @@
1
+ import { ReducedUser } from "../../idp/user";
2
+ export type AddressBook = {
3
+ _id: string;
4
+ name: string;
5
+ description?: string;
6
+ members: string[];
7
+ createDate: number;
8
+ modifyDate: number;
9
+ creator: ReducedUser;
10
+ };
11
+ export type AddressBookCreate = {
12
+ /** Name of the address book (1–128 chars) */
13
+ name: string;
14
+ /** Optional description (max 512 chars) */
15
+ description?: string;
16
+ /** Initial list of member email addresses */
17
+ members?: string[];
18
+ };
19
+ export type AddressBookUpdate = {
20
+ /** New name of the address book (1–128 chars) */
21
+ name?: string;
22
+ /** Updated description (max 512 chars) */
23
+ description?: string;
24
+ };
25
+ export type AddressBookMemberRequest = {
26
+ /** List of email addresses to add or remove (min 1) */
27
+ emails: string[];
28
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,112 @@
1
+ import Base, { MaybeRaw } from "../../../Base";
2
+ import { AddressBook, AddressBookCreate, AddressBookUpdate } from "../../../interfaces/cosmo/addressBook";
3
+ import { SearchFilter, Sorting } from "../../../interfaces/global/SearchFilters";
4
+ /**
5
+ * @class CosmoAddressBook
6
+ * @extends Base
7
+ *
8
+ * @remarks
9
+ * **Under development, breaking changes possible**
10
+ *
11
+ * Represents an Address Book resource in Cosmo, providing methods to interact with the Address Book API.
12
+ * Address books exist on space level and hold named groups of e-mail addresses (members).
13
+ */
14
+ export declare class CosmoAddressBook extends Base {
15
+ protected getEndpoint(endpoint: string): string;
16
+ private basePath;
17
+ /**
18
+ * Search address books of a Space with optional filters, sorting and pagination.
19
+ * @remarks
20
+ * **Under development, breaking changes possible**
21
+ * @param orgName Name of the Organization
22
+ * @param spaceName Name of the Space
23
+ * @param filters Optional search filters
24
+ * @param sorting Optional sorting definition
25
+ * @param limit Maximum number of results per page (default 100)
26
+ * @param page Zero-based page number (default 0)
27
+ * @returns Paginated result with items and total count
28
+ */
29
+ searchAddressBooks<R extends boolean = false>(orgName: string, spaceName: string, { filters, sorting, limit, page }?: {
30
+ filters?: SearchFilter[];
31
+ sorting?: Sorting;
32
+ limit?: number;
33
+ page?: number;
34
+ }, raw?: {
35
+ raw: R;
36
+ }): Promise<MaybeRaw<R, AddressBook[]>>;
37
+ /**
38
+ * Create a new Address Book inside the specified Space.
39
+ * @remarks
40
+ * **Under development, breaking changes possible**
41
+ * @param orgName Name of the Organization
42
+ * @param spaceName Name of the Space
43
+ * @param data Address book creation payload
44
+ * @returns The created AddressBook
45
+ */
46
+ createAddressBook<R extends boolean = false>(orgName: string, spaceName: string, data: AddressBookCreate, raw?: {
47
+ raw: R;
48
+ }): Promise<MaybeRaw<R, AddressBook>>;
49
+ /**
50
+ * Get a single Address Book by its ID.
51
+ * @remarks
52
+ * **Under development, breaking changes possible**
53
+ * @param orgName Name of the Organization
54
+ * @param spaceName Name of the Space
55
+ * @param bookId ID of the Address Book
56
+ * @returns The requested AddressBook
57
+ */
58
+ getAddressBook<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, raw?: {
59
+ raw: R;
60
+ }): Promise<MaybeRaw<R, AddressBook>>;
61
+ /**
62
+ * Update an existing Address Book (rename / change description).
63
+ * @remarks
64
+ * **Under development, breaking changes possible**
65
+ * @param orgName Name of the Organization
66
+ * @param spaceName Name of the Space
67
+ * @param bookId ID of the Address Book
68
+ * @param data Fields to update
69
+ * @returns The updated AddressBook
70
+ */
71
+ updateAddressBook<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, data: AddressBookUpdate, raw?: {
72
+ raw: R;
73
+ }): Promise<MaybeRaw<R, AddressBook>>;
74
+ /**
75
+ * Delete an Address Book by its ID.
76
+ * @remarks
77
+ * **Under development, breaking changes possible**
78
+ * @param orgName Name of the Organization
79
+ * @param spaceName Name of the Space
80
+ * @param bookId ID of the Address Book to delete
81
+ * @returns 204 No Content on success
82
+ */
83
+ deleteAddressBook<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, raw?: {
84
+ raw: R;
85
+ }): Promise<MaybeRaw<R, void>>;
86
+ /**
87
+ * Add one or more members (by e-mail) to an Address Book.
88
+ * @remarks
89
+ * **Under development, breaking changes possible**
90
+ * @param orgName Name of the Organization
91
+ * @param spaceName Name of the Space
92
+ * @param bookId ID of the Address Book
93
+ * @param emails List of e-mail addresses to add (min 1)
94
+ * @returns The updated AddressBook
95
+ */
96
+ addAddressBookMembers<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, emails: string[], raw?: {
97
+ raw: R;
98
+ }): Promise<MaybeRaw<R, AddressBook>>;
99
+ /**
100
+ * Remove one or more members (by e-mail) from an Address Book.
101
+ * @remarks
102
+ * **Under development, breaking changes possible**
103
+ * @param orgName Name of the Organization
104
+ * @param spaceName Name of the Space
105
+ * @param bookId ID of the Address Book
106
+ * @param emails List of e-mail addresses to remove (min 1)
107
+ * @returns The updated AddressBook
108
+ */
109
+ removeAddressBookMembers<R extends boolean = false>(orgName: string, spaceName: string, bookId: string, emails: string[], raw?: {
110
+ raw: R;
111
+ }): Promise<MaybeRaw<R, AddressBook>>;
112
+ }
@@ -0,0 +1,150 @@
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.CosmoAddressBook = void 0;
16
+ const Base_1 = __importDefault(require("../../../Base"));
17
+ /**
18
+ * @class CosmoAddressBook
19
+ * @extends Base
20
+ *
21
+ * @remarks
22
+ * **Under development, breaking changes possible**
23
+ *
24
+ * Represents an Address Book resource in Cosmo, providing methods to interact with the Address Book API.
25
+ * Address books exist on space level and hold named groups of e-mail addresses (members).
26
+ */
27
+ class CosmoAddressBook extends Base_1.default {
28
+ getEndpoint(endpoint) {
29
+ return `${this.options.server}/api/cosmo${endpoint}`;
30
+ }
31
+ basePath(orgName, spaceName) {
32
+ return `/v1/org/${orgName}/spaces/${spaceName}/address-book`;
33
+ }
34
+ /**
35
+ * Search address books of a Space with optional filters, sorting and pagination.
36
+ * @remarks
37
+ * **Under development, breaking changes possible**
38
+ * @param orgName Name of the Organization
39
+ * @param spaceName Name of the Space
40
+ * @param filters Optional search filters
41
+ * @param sorting Optional sorting definition
42
+ * @param limit Maximum number of results per page (default 100)
43
+ * @param page Zero-based page number (default 0)
44
+ * @returns Paginated result with items and total count
45
+ */
46
+ searchAddressBooks(orgName_1, spaceName_1) {
47
+ return __awaiter(this, arguments, void 0, function* (orgName, spaceName, { filters, sorting, limit, page } = {}, raw) {
48
+ const resp = yield this.axios.post(this.getEndpoint(`${this.basePath(orgName, spaceName)}/search`), Object.assign({ filters: filters !== null && filters !== void 0 ? filters : [] }, (sorting ? { sorting } : {})), { params: { limit: limit !== null && limit !== void 0 ? limit : 100, page: page !== null && page !== void 0 ? page : 0 } });
49
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
50
+ });
51
+ }
52
+ /**
53
+ * Create a new Address Book inside the specified Space.
54
+ * @remarks
55
+ * **Under development, breaking changes possible**
56
+ * @param orgName Name of the Organization
57
+ * @param spaceName Name of the Space
58
+ * @param data Address book creation payload
59
+ * @returns The created AddressBook
60
+ */
61
+ createAddressBook(orgName, spaceName, data, raw) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const resp = yield this.axios.post(this.getEndpoint(this.basePath(orgName, spaceName)), data);
64
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
65
+ });
66
+ }
67
+ /**
68
+ * Get a single Address Book by its ID.
69
+ * @remarks
70
+ * **Under development, breaking changes possible**
71
+ * @param orgName Name of the Organization
72
+ * @param spaceName Name of the Space
73
+ * @param bookId ID of the Address Book
74
+ * @returns The requested AddressBook
75
+ */
76
+ getAddressBook(orgName, spaceName, bookId, raw) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const resp = yield this.axios.get(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}`));
79
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
80
+ });
81
+ }
82
+ /**
83
+ * Update an existing Address Book (rename / change description).
84
+ * @remarks
85
+ * **Under development, breaking changes possible**
86
+ * @param orgName Name of the Organization
87
+ * @param spaceName Name of the Space
88
+ * @param bookId ID of the Address Book
89
+ * @param data Fields to update
90
+ * @returns The updated AddressBook
91
+ */
92
+ updateAddressBook(orgName, spaceName, bookId, data, raw) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const resp = yield this.axios.patch(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}`), data);
95
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
96
+ });
97
+ }
98
+ /**
99
+ * Delete an Address Book by its ID.
100
+ * @remarks
101
+ * **Under development, breaking changes possible**
102
+ * @param orgName Name of the Organization
103
+ * @param spaceName Name of the Space
104
+ * @param bookId ID of the Address Book to delete
105
+ * @returns 204 No Content on success
106
+ */
107
+ deleteAddressBook(orgName, spaceName, bookId, raw) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const resp = yield this.axios.delete(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}`));
110
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
111
+ });
112
+ }
113
+ /**
114
+ * Add one or more members (by e-mail) to an Address Book.
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 emails List of e-mail addresses to add (min 1)
121
+ * @returns The updated AddressBook
122
+ */
123
+ addAddressBookMembers(orgName, spaceName, bookId, emails, raw) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ const payload = { emails };
126
+ const resp = yield this.axios.post(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}/members`), payload);
127
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
128
+ });
129
+ }
130
+ /**
131
+ * Remove one or more members (by e-mail) from an Address Book.
132
+ * @remarks
133
+ * **Under development, breaking changes possible**
134
+ * @param orgName Name of the Organization
135
+ * @param spaceName Name of the Space
136
+ * @param bookId ID of the Address Book
137
+ * @param emails List of e-mail addresses to remove (min 1)
138
+ * @returns The updated AddressBook
139
+ */
140
+ removeAddressBookMembers(orgName, spaceName, bookId, emails, raw) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ const payload = { emails };
143
+ const resp = yield this.axios.delete(this.getEndpoint(`${this.basePath(orgName, spaceName)}/${bookId}/members`), {
144
+ data: payload,
145
+ });
146
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
147
+ });
148
+ }
149
+ }
150
+ exports.CosmoAddressBook = CosmoAddressBook;
@@ -1,5 +1,6 @@
1
1
  import Base from "../../Base";
2
2
  import { Version } from "../../interfaces/global";
3
+ import { CosmoAddressBook } from "./addressBook";
3
4
  import { CosmoAsset } from "./asset";
4
5
  import { CosmoComment } from "./comment";
5
6
  import { CosmoEvent } from "./event";
@@ -16,6 +17,8 @@ import { CosmoStack } from "./stack";
16
17
  import { CosmoStats } from "./stats";
17
18
  import { CosmoTag } from "./tag";
18
19
  export default class CosmoService extends Base {
20
+ get cosmoAddressBook(): CosmoAddressBook;
21
+ private _cosmoAddressBook?;
19
22
  get cosmoAsset(): CosmoAsset;
20
23
  private _cosmoAsset?;
21
24
  get cosmoSpace(): CosmoSpace;
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const Base_1 = __importDefault(require("../../Base"));
16
+ const addressBook_1 = require("./addressBook");
16
17
  const asset_1 = require("./asset");
17
18
  const comment_1 = require("./comment");
18
19
  const event_1 = require("./event");
@@ -29,6 +30,12 @@ const stack_1 = require("./stack");
29
30
  const stats_1 = require("./stats");
30
31
  const tag_1 = require("./tag");
31
32
  class CosmoService extends Base_1.default {
33
+ get cosmoAddressBook() {
34
+ if (this._cosmoAddressBook === undefined) {
35
+ this._cosmoAddressBook = new addressBook_1.CosmoAddressBook(this.options, this.axios);
36
+ }
37
+ return this._cosmoAddressBook;
38
+ }
32
39
  get cosmoAsset() {
33
40
  if (this._cosmoAsset === undefined) {
34
41
  this._cosmoAsset = new asset_1.CosmoAsset(this.options, this.axios);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "22.4.0",
3
+ "version": "22.5.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",