hcloud-sdk 18.0.0 → 19.1.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.
Files changed (230) hide show
  1. package/changelog.md +17 -184
  2. package/lib/Hcloud.d.ts +18 -3
  3. package/lib/Hcloud.js +113 -21
  4. package/lib/helper/ErrorHelper.js +5 -2
  5. package/lib/helper/ValidationHelper.d.ts +6 -4
  6. package/lib/helper/ValidationHelper.js +30 -18
  7. package/lib/interfaces/agent/index.d.ts +1 -0
  8. package/lib/interfaces/agent/logging/cloudwatch.d.ts +23 -0
  9. package/lib/interfaces/agent/logging/index.d.ts +2 -0
  10. package/lib/interfaces/{fuse → agent/logging}/index.js +2 -3
  11. package/lib/interfaces/agent/logging/log-collector.d.ts +35 -0
  12. package/lib/interfaces/agent/logging/log-collector.js +2 -0
  13. package/lib/interfaces/agent/module/index.d.ts +7 -0
  14. package/lib/interfaces/agent/module/index.js +2 -0
  15. package/lib/interfaces/auditor/index.d.ts +0 -1
  16. package/lib/interfaces/auditor/index.js +0 -1
  17. package/lib/interfaces/axios/index.d.ts +5 -0
  18. package/lib/interfaces/cosmo/asset/index.d.ts +45 -9
  19. package/lib/interfaces/cosmo/asset/index.js +9 -1
  20. package/lib/interfaces/cosmo/comment/index.d.ts +18 -1
  21. package/lib/interfaces/cosmo/comment/index.js +13 -1
  22. package/lib/interfaces/cosmo/event/index.d.ts +34 -5
  23. package/lib/interfaces/cosmo/event/index.js +16 -2
  24. package/lib/interfaces/cosmo/share/index.d.ts +100 -8
  25. package/lib/interfaces/cosmo/share/index.js +21 -0
  26. package/lib/interfaces/cosmo/space/index.d.ts +6 -0
  27. package/lib/interfaces/cosmo/stats/index.d.ts +11 -0
  28. package/lib/interfaces/cosmo/stats/index.js +2 -0
  29. package/lib/interfaces/cosmo/tag/tag.d.ts +3 -1
  30. package/lib/interfaces/global/Products.d.ts +0 -1
  31. package/lib/interfaces/global/Products.js +0 -1
  32. package/lib/interfaces/global/Views.d.ts +0 -1
  33. package/lib/interfaces/global/Views.js +0 -1
  34. package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +1 -0
  35. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +1 -0
  36. package/lib/interfaces/high5/space/execution/index.d.ts +5 -1
  37. package/lib/interfaces/high5/space/job/JobLog.d.ts +10 -6
  38. package/lib/interfaces/high5/space/job/index.d.ts +65 -20
  39. package/lib/interfaces/high5/space/job/index.js +9 -6
  40. package/lib/interfaces/high5/wave/dependentInputs.d.ts +42 -0
  41. package/lib/interfaces/high5/wave/dependentInputs.js +144 -0
  42. package/lib/interfaces/high5/wave/dependentInputsValidation.d.ts +22 -0
  43. package/lib/interfaces/high5/wave/dependentInputsValidation.js +220 -0
  44. package/lib/interfaces/high5/wave/index.d.ts +9 -0
  45. package/lib/interfaces/high5/wave/index.js +4 -0
  46. package/lib/interfaces/idp/index.d.ts +3 -3
  47. package/lib/interfaces/idp/index.js +3 -3
  48. package/lib/interfaces/idp/oauth/device.d.ts +18 -0
  49. package/lib/interfaces/idp/oauth/device.js +2 -0
  50. package/lib/interfaces/idp/oauth/index.d.ts +17 -4
  51. package/lib/interfaces/idp/organization/index.d.ts +1 -0
  52. package/lib/interfaces/idp/organization/index.js +1 -0
  53. package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +4 -0
  54. package/lib/interfaces/idp/user/Message.d.ts +1 -0
  55. package/lib/interfaces/idp/user/Scopes.d.ts +1 -9
  56. package/lib/interfaces/idp/user/Scopes.js +0 -12
  57. package/lib/interfaces/idp/user/index.d.ts +3 -0
  58. package/lib/interfaces/mailer/index.d.ts +20 -1
  59. package/lib/interfaces/mailer/index.js +14 -2
  60. package/lib/interfaces/nats/index.d.ts +30 -32
  61. package/lib/interfaces/nats/index.js +103 -117
  62. package/lib/interfaces/shorts/index.d.ts +7 -0
  63. package/lib/interfaces/shorts/index.js +6 -0
  64. package/lib/service/agent/bundle/dev/index.js +4 -1
  65. package/lib/service/agent/bundle/index.js +4 -1
  66. package/lib/service/agent/context/index.js +4 -1
  67. package/lib/service/agent/index.d.ts +6 -0
  68. package/lib/service/agent/index.js +18 -1
  69. package/lib/service/agent/installer/index.js +4 -1
  70. package/lib/service/agent/logging/index.d.ts +69 -0
  71. package/lib/service/agent/logging/index.js +117 -0
  72. package/lib/service/agent/module/index.d.ts +36 -0
  73. package/lib/service/agent/module/index.js +65 -0
  74. package/lib/service/auditor/index.js +4 -1
  75. package/lib/service/auditor/internal/index.js +4 -1
  76. package/lib/service/bouncer/features/index.js +4 -1
  77. package/lib/service/bouncer/index.js +5 -2
  78. package/lib/service/cosmo/asset/index.d.ts +49 -3
  79. package/lib/service/cosmo/asset/index.js +111 -5
  80. package/lib/service/cosmo/comment/index.d.ts +10 -37
  81. package/lib/service/cosmo/comment/index.js +20 -43
  82. package/lib/service/cosmo/event/index.js +4 -1
  83. package/lib/service/cosmo/folder/index.js +4 -1
  84. package/lib/service/cosmo/index.d.ts +3 -0
  85. package/lib/service/cosmo/index.js +11 -1
  86. package/lib/service/cosmo/internal/index.js +4 -1
  87. package/lib/service/cosmo/internal/space/index.js +4 -1
  88. package/lib/service/cosmo/location/index.js +4 -1
  89. package/lib/service/cosmo/namespace/index.d.ts +15 -1
  90. package/lib/service/cosmo/namespace/index.js +21 -1
  91. package/lib/service/cosmo/organization/index.js +4 -1
  92. package/lib/service/cosmo/permissions/index.js +4 -1
  93. package/lib/service/cosmo/production/index.js +4 -1
  94. package/lib/service/cosmo/share/index.d.ts +55 -29
  95. package/lib/service/cosmo/share/index.js +71 -35
  96. package/lib/service/cosmo/space/index.d.ts +28 -1
  97. package/lib/service/cosmo/space/index.js +45 -1
  98. package/lib/service/cosmo/stats/index.d.ts +35 -0
  99. package/lib/service/cosmo/stats/index.js +58 -0
  100. package/lib/service/cosmo/tag/index.d.ts +13 -0
  101. package/lib/service/cosmo/tag/index.js +22 -1
  102. package/lib/service/dali/DaliAvatar.d.ts +0 -6
  103. package/lib/service/dali/DaliAvatar.js +4 -11
  104. package/lib/service/dali/avatar/DaliCosmoSpace.js +4 -1
  105. package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +2 -1
  106. package/lib/service/dali/avatar/DaliHigh5Pool.js +5 -2
  107. package/lib/service/dali/avatar/DaliHigh5Space.d.ts +2 -1
  108. package/lib/service/dali/avatar/DaliHigh5Space.js +5 -2
  109. package/lib/service/dali/avatar/DaliOAuthApp.d.ts +2 -1
  110. package/lib/service/dali/avatar/DaliOAuthApp.js +5 -2
  111. package/lib/service/dali/avatar/DaliOrganization.d.ts +2 -1
  112. package/lib/service/dali/avatar/DaliOrganization.js +5 -2
  113. package/lib/service/dali/avatar/DaliServiceAccount.d.ts +1 -1
  114. package/lib/service/dali/avatar/DaliServiceAccount.js +6 -3
  115. package/lib/service/dali/avatar/DaliTeam.d.ts +2 -1
  116. package/lib/service/dali/avatar/DaliTeam.js +5 -2
  117. package/lib/service/dali/avatar/DaliUser.d.ts +2 -1
  118. package/lib/service/dali/avatar/DaliUser.js +5 -2
  119. package/lib/service/dali/index.js +4 -1
  120. package/lib/service/high5/execution/index.js +4 -1
  121. package/lib/service/high5/execution/log/index.js +4 -1
  122. package/lib/service/high5/execution/status/index.js +4 -1
  123. package/lib/service/high5/index.js +4 -1
  124. package/lib/service/high5/internal/index.js +4 -1
  125. package/lib/service/high5/internal/space/index.js +4 -1
  126. package/lib/service/high5/internal/space/job/index.js +4 -1
  127. package/lib/service/high5/internal/space/job/log/index.js +4 -1
  128. package/lib/service/high5/joinToken/index.js +4 -1
  129. package/lib/service/high5/space/database/document/array/index.js +4 -1
  130. package/lib/service/high5/space/database/document/index.js +4 -1
  131. package/lib/service/high5/space/database/document/number/index.js +4 -1
  132. package/lib/service/high5/space/database/index.js +4 -1
  133. package/lib/service/high5/space/event/index.js +4 -1
  134. package/lib/service/high5/space/event/stream/design/DesignOperations.js +4 -1
  135. package/lib/service/high5/space/event/stream/design/index.js +6 -3
  136. package/lib/service/high5/space/event/stream/design/snapshot/index.js +4 -1
  137. package/lib/service/high5/space/event/stream/index.js +4 -1
  138. package/lib/service/high5/space/execution/index.d.ts +2 -1
  139. package/lib/service/high5/space/execution/index.js +7 -3
  140. package/lib/service/high5/space/execution/log/index.js +4 -1
  141. package/lib/service/high5/space/execution/status/index.js +4 -1
  142. package/lib/service/high5/space/index.d.ts +10 -0
  143. package/lib/service/high5/space/index.js +25 -5
  144. package/lib/service/high5/space/job/index.js +4 -1
  145. package/lib/service/high5/space/job/log/index.js +4 -1
  146. package/lib/service/high5/space/node/index.js +4 -1
  147. package/lib/service/high5/space/pool/index.d.ts +11 -0
  148. package/lib/service/high5/space/pool/index.js +22 -1
  149. package/lib/service/high5/space/secret/index.js +4 -1
  150. package/lib/service/high5/space/stat/index.js +4 -1
  151. package/lib/service/high5/space/wave/index.js +4 -1
  152. package/lib/service/high5/space/webhook/index.js +4 -1
  153. package/lib/service/high5/space/webhook/log/index.js +4 -1
  154. package/lib/service/high5/stat/index.js +4 -1
  155. package/lib/service/high5/wave/index.js +4 -1
  156. package/lib/service/high5/wave/s3/index.js +5 -2
  157. package/lib/service/idp/guest/index.js +4 -1
  158. package/lib/service/idp/index.js +4 -1
  159. package/lib/service/idp/internal/index.js +4 -1
  160. package/lib/service/idp/oauth/device.d.ts +131 -0
  161. package/lib/service/idp/oauth/device.js +177 -0
  162. package/lib/service/idp/oauth/index.d.ts +3 -0
  163. package/lib/service/idp/oauth/index.js +11 -1
  164. package/lib/service/idp/organization/index.d.ts +9 -0
  165. package/lib/service/idp/organization/index.js +22 -3
  166. package/lib/service/idp/organization/license/index.js +4 -1
  167. package/lib/service/idp/organization/member/index.js +5 -2
  168. package/lib/service/idp/organization/member/invitations/index.d.ts +19 -0
  169. package/lib/service/idp/organization/member/invitations/index.js +23 -1
  170. package/lib/service/idp/organization/service-accounts/index.d.ts +11 -1
  171. package/lib/service/idp/organization/service-accounts/index.js +22 -2
  172. package/lib/service/idp/organization/settings/domain/index.js +4 -1
  173. package/lib/service/idp/organization/settings/domain/saml/index.js +4 -1
  174. package/lib/service/idp/organization/settings/index.js +4 -1
  175. package/lib/service/idp/organization/settings/oauth/index.d.ts +10 -0
  176. package/lib/service/idp/organization/settings/oauth/index.js +21 -1
  177. package/lib/service/idp/organization/stat/index.js +4 -1
  178. package/lib/service/idp/organization/team/index.d.ts +10 -0
  179. package/lib/service/idp/organization/team/index.js +21 -1
  180. package/lib/service/idp/registration/index.js +4 -1
  181. package/lib/service/idp/user/index.d.ts +8 -0
  182. package/lib/service/idp/user/index.js +20 -3
  183. package/lib/service/idp/user/license/index.js +4 -1
  184. package/lib/service/idp/user/message/index.d.ts +1 -0
  185. package/lib/service/idp/user/message/index.js +4 -1
  186. package/lib/service/idp/user/password/index.js +4 -1
  187. package/lib/service/idp/user/settings/connections/index.js +4 -1
  188. package/lib/service/idp/user/settings/general/index.js +4 -1
  189. package/lib/service/idp/user/settings/index.js +4 -1
  190. package/lib/service/idp/user/settings/notifications/index.js +4 -1
  191. package/lib/service/idp/user/settings/oauthApps/index.js +4 -1
  192. package/lib/service/idp/user/settings/pats/index.js +4 -1
  193. package/lib/service/idp/user/settings/twoFactor/index.js +4 -1
  194. package/lib/service/idp/user/settings/twoFactor/totp/index.js +4 -1
  195. package/lib/service/mailer/index.js +5 -2
  196. package/lib/service/mailer/internal/index.d.ts +2 -2
  197. package/lib/service/mailer/internal/index.js +5 -2
  198. package/lib/service/mothership/index.js +4 -1
  199. package/lib/service/nats/index.d.ts +7 -0
  200. package/lib/service/nats/index.js +19 -1
  201. package/lib/service/shorts/index.js +4 -1
  202. package/lib/service/shorts/internal/index.d.ts +6 -3
  203. package/lib/service/shorts/internal/index.js +20 -6
  204. package/lib/utils/bouncer/features/Provider.js +0 -1
  205. package/package.json +2 -2
  206. package/lib/interfaces/fuse/index.d.ts +0 -3
  207. package/lib/interfaces/fuse/space/cronjob/Cronjob.d.ts +0 -38
  208. package/lib/interfaces/fuse/space/cronjob/Cronjob.js +0 -8
  209. package/lib/interfaces/fuse/space/cronjob/CronjobLog.d.ts +0 -16
  210. package/lib/interfaces/fuse/space/index.d.ts +0 -22
  211. package/lib/interfaces/fuse/space/index.js +0 -11
  212. package/lib/service/dali/avatar/DaliFuseSpace.d.ts +0 -32
  213. package/lib/service/dali/avatar/DaliFuseSpace.js +0 -59
  214. package/lib/service/fuse/index.d.ts +0 -20
  215. package/lib/service/fuse/index.js +0 -48
  216. package/lib/service/fuse/internal/index.d.ts +0 -10
  217. package/lib/service/fuse/internal/index.js +0 -32
  218. package/lib/service/fuse/internal/space/cronjob/index.d.ts +0 -7
  219. package/lib/service/fuse/internal/space/cronjob/index.js +0 -17
  220. package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +0 -17
  221. package/lib/service/fuse/internal/space/cronjob/log/index.js +0 -34
  222. package/lib/service/fuse/internal/space/index.d.ts +0 -26
  223. package/lib/service/fuse/internal/space/index.js +0 -51
  224. package/lib/service/fuse/space/cronjob/index.d.ts +0 -145
  225. package/lib/service/fuse/space/cronjob/index.js +0 -201
  226. package/lib/service/fuse/space/cronjob/log/index.d.ts +0 -35
  227. package/lib/service/fuse/space/cronjob/log/index.js +0 -58
  228. package/lib/service/fuse/space/index.d.ts +0 -97
  229. package/lib/service/fuse/space/index.js +0 -153
  230. /package/lib/interfaces/{fuse/space/cronjob/CronjobLog.js → agent/logging/cloudwatch.js} +0 -0
@@ -0,0 +1,131 @@
1
+ import Base, { MaybeRaw } from "../../../Base";
2
+ import { OAuthAppPublicInfo, Scope } from "../../../interfaces/idp";
3
+ import { OAuthDeviceAuthorizationResponse, OAuthDeviceTokenResponse } from "../../../interfaces/idp/oauth/device";
4
+ /**
5
+ * IdpOAuthDevice
6
+ *
7
+ * Client wrapper for OAuth 2.0 Device Authorization Grant (RFC 8628).
8
+ *
9
+ * This class provides methods to:
10
+ * - Initiate a device authorization request
11
+ * - Validate a user-provided code
12
+ * - Approve or reject a device authorization
13
+ * - Exchange a device code for an access token
14
+ *
15
+ * All methods support returning either the parsed response body or the raw Axios
16
+ * response via the `{ raw: true }` option.
17
+ *
18
+ * @extends Base
19
+ */
20
+ export default class IdpOAuthDevice extends Base {
21
+ /**
22
+ * Initiates the OAuth Device Authorization flow.
23
+ *
24
+ * This endpoint returns a `device_code` and `user_code` which should be:
25
+ * - Displayed to the user on the device
26
+ * - Entered by the user on a separate verification page
27
+ *
28
+ * @typeParam R - Whether to return the raw Axios response
29
+ *
30
+ * @param clientId - OAuth client identifier
31
+ * @param scope - Optional OAuth scope string (space-delimited)
32
+ * @param raw - Optional flag to return the raw Axios response
33
+ *
34
+ * @returns Device authorization response or raw Axios response
35
+ */
36
+ authorize<R extends boolean = false>(clientId: string, scope?: string, raw?: {
37
+ raw: R;
38
+ }): Promise<MaybeRaw<R, OAuthDeviceAuthorizationResponse>>;
39
+ /**
40
+ * Validates a user-entered device code.
41
+ *
42
+ * This is typically called by the authorization UI after the user enters
43
+ * the `user_code`. It returns public information about the requesting
44
+ * application and the requested scopes.
45
+ *
46
+ * @typeParam R - Whether to return the raw Axios response
47
+ *
48
+ * @param clientId - OAuth client identifier
49
+ * @param userCode - User-facing verification code
50
+ * @param raw - Optional flag to return the raw Axios response
51
+ *
52
+ * @returns Application public info and requested scopes
53
+ */
54
+ validateUserCode<R extends boolean = false>(clientId: string, userCode: string, raw?: {
55
+ raw: R;
56
+ }): Promise<MaybeRaw<R, {
57
+ app: OAuthAppPublicInfo;
58
+ scopes: Scope[];
59
+ }>>;
60
+ /**
61
+ * Approves or rejects a device authorization request.
62
+ *
63
+ * ⚠️ This endpoint requires an `Authorization` header to be set
64
+ * on the HCloud instance (e.g., a logged-in user session or access token).
65
+ *
66
+ * @typeParam R - Whether to return the raw Axios response
67
+ *
68
+ * @param clientId - OAuth client identifier
69
+ * @param userCode - User-facing verification code
70
+ * @param status - Authorization decision (`APPROVED` or `REJECTED`)
71
+ * @param raw - Optional flag to return the raw Axios response
72
+ *
73
+ * @throws Error if the Authorization header is not set
74
+ *
75
+ * @returns Void response or raw Axios response
76
+ */
77
+ decide<R extends boolean = false>(clientId: string, userCode: string, status: "APPROVED" | "REJECTED", raw?: {
78
+ raw: R;
79
+ }): Promise<MaybeRaw<R, void>>;
80
+ /**
81
+ * Approves a device authorization request.
82
+ *
83
+ * Shorthand for {@link decide} with status `"APPROVED"`.
84
+ *
85
+ * @typeParam R - Whether to return the raw Axios response
86
+ *
87
+ * @param clientId - OAuth client identifier
88
+ * @param userCode - User-facing verification code
89
+ * @param raw - Optional flag to return the raw Axios response
90
+ *
91
+ * @returns Void response or raw Axios response
92
+ */
93
+ approve<R extends boolean = false>(clientId: string, userCode: string, raw?: {
94
+ raw: R;
95
+ }): Promise<MaybeRaw<R, void>>;
96
+ /**
97
+ * Rejects a device authorization request.
98
+ *
99
+ * Shorthand for {@link decide} with status `"REJECTED"`.
100
+ *
101
+ * @typeParam R - Whether to return the raw Axios response
102
+ *
103
+ * @param clientId - OAuth client identifier
104
+ * @param userCode - User-facing verification code
105
+ * @param raw - Optional flag to return the raw Axios response
106
+ *
107
+ * @returns Void response or raw Axios response
108
+ */
109
+ reject<R extends boolean = false>(clientId: string, userCode: string, raw?: {
110
+ raw: R;
111
+ }): Promise<MaybeRaw<R, void>>;
112
+ /**
113
+ * Exchanges a device code for an access token.
114
+ *
115
+ * This endpoint may return HTTP 400 responses for non-fatal OAuth states
116
+ * such as `authorization_pending` or `slow_down`. These responses are
117
+ * returned normally and should be handled by the caller.
118
+ *
119
+ * @typeParam R - Whether to return the raw Axios response
120
+ *
121
+ * @param clientId - OAuth client identifier
122
+ * @param deviceCode - Device code obtained from {@link authorize}
123
+ * @param raw - Optional flag to return the raw Axios response
124
+ *
125
+ * @returns Device token response or raw Axios response
126
+ */
127
+ token<R extends boolean = false>(clientId: string, deviceCode: string, raw?: {
128
+ raw: R;
129
+ }): Promise<MaybeRaw<R, OAuthDeviceTokenResponse>>;
130
+ protected getEndpoint(endpoint: string): string;
131
+ }
@@ -0,0 +1,177 @@
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
+ /* eslint-disable camelcase */
16
+ const Base_1 = __importDefault(require("../../../Base"));
17
+ /**
18
+ * IdpOAuthDevice
19
+ *
20
+ * Client wrapper for OAuth 2.0 Device Authorization Grant (RFC 8628).
21
+ *
22
+ * This class provides methods to:
23
+ * - Initiate a device authorization request
24
+ * - Validate a user-provided code
25
+ * - Approve or reject a device authorization
26
+ * - Exchange a device code for an access token
27
+ *
28
+ * All methods support returning either the parsed response body or the raw Axios
29
+ * response via the `{ raw: true }` option.
30
+ *
31
+ * @extends Base
32
+ */
33
+ class IdpOAuthDevice extends Base_1.default {
34
+ /**
35
+ * Initiates the OAuth Device Authorization flow.
36
+ *
37
+ * This endpoint returns a `device_code` and `user_code` which should be:
38
+ * - Displayed to the user on the device
39
+ * - Entered by the user on a separate verification page
40
+ *
41
+ * @typeParam R - Whether to return the raw Axios response
42
+ *
43
+ * @param clientId - OAuth client identifier
44
+ * @param scope - Optional OAuth scope string (space-delimited)
45
+ * @param raw - Optional flag to return the raw Axios response
46
+ *
47
+ * @returns Device authorization response or raw Axios response
48
+ */
49
+ authorize(clientId, scope, raw) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/device/authorize`), {
52
+ client_id: clientId,
53
+ scope,
54
+ }, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
55
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
56
+ });
57
+ }
58
+ /**
59
+ * Validates a user-entered device code.
60
+ *
61
+ * This is typically called by the authorization UI after the user enters
62
+ * the `user_code`. It returns public information about the requesting
63
+ * application and the requested scopes.
64
+ *
65
+ * @typeParam R - Whether to return the raw Axios response
66
+ *
67
+ * @param clientId - OAuth client identifier
68
+ * @param userCode - User-facing verification code
69
+ * @param raw - Optional flag to return the raw Axios response
70
+ *
71
+ * @returns Application public info and requested scopes
72
+ */
73
+ validateUserCode(clientId, userCode, raw) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/device/authorize`), {
76
+ params: {
77
+ client_id: clientId,
78
+ user_code: userCode,
79
+ },
80
+ });
81
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
82
+ });
83
+ }
84
+ /**
85
+ * Approves or rejects a device authorization request.
86
+ *
87
+ * ⚠️ This endpoint requires an `Authorization` header to be set
88
+ * on the HCloud instance (e.g., a logged-in user session or access token).
89
+ *
90
+ * @typeParam R - Whether to return the raw Axios response
91
+ *
92
+ * @param clientId - OAuth client identifier
93
+ * @param userCode - User-facing verification code
94
+ * @param status - Authorization decision (`APPROVED` or `REJECTED`)
95
+ * @param raw - Optional flag to return the raw Axios response
96
+ *
97
+ * @throws Error if the Authorization header is not set
98
+ *
99
+ * @returns Void response or raw Axios response
100
+ */
101
+ decide(clientId, userCode, status, raw) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ if (this.axios.defaults.headers.common.Authorization === undefined && this.axios.defaults.headers.post.Authorization === undefined) {
104
+ throw new Error("this endpoint requires the authorization header to be set");
105
+ }
106
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/device/authorize/${clientId}/${userCode}`), {
107
+ status,
108
+ }, { headers: { "Content-Type": "application/json" } });
109
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
110
+ });
111
+ }
112
+ /**
113
+ * Approves a device authorization request.
114
+ *
115
+ * Shorthand for {@link decide} with status `"APPROVED"`.
116
+ *
117
+ * @typeParam R - Whether to return the raw Axios response
118
+ *
119
+ * @param clientId - OAuth client identifier
120
+ * @param userCode - User-facing verification code
121
+ * @param raw - Optional flag to return the raw Axios response
122
+ *
123
+ * @returns Void response or raw Axios response
124
+ */
125
+ approve(clientId, userCode, raw) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ return this.decide(clientId, userCode, "APPROVED", raw);
128
+ });
129
+ }
130
+ /**
131
+ * Rejects a device authorization request.
132
+ *
133
+ * Shorthand for {@link decide} with status `"REJECTED"`.
134
+ *
135
+ * @typeParam R - Whether to return the raw Axios response
136
+ *
137
+ * @param clientId - OAuth client identifier
138
+ * @param userCode - User-facing verification code
139
+ * @param raw - Optional flag to return the raw Axios response
140
+ *
141
+ * @returns Void response or raw Axios response
142
+ */
143
+ reject(clientId, userCode, raw) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ return this.decide(clientId, userCode, "REJECTED", raw);
146
+ });
147
+ }
148
+ /**
149
+ * Exchanges a device code for an access token.
150
+ *
151
+ * This endpoint may return HTTP 400 responses for non-fatal OAuth states
152
+ * such as `authorization_pending` or `slow_down`. These responses are
153
+ * returned normally and should be handled by the caller.
154
+ *
155
+ * @typeParam R - Whether to return the raw Axios response
156
+ *
157
+ * @param clientId - OAuth client identifier
158
+ * @param deviceCode - Device code obtained from {@link authorize}
159
+ * @param raw - Optional flag to return the raw Axios response
160
+ *
161
+ * @returns Device token response or raw Axios response
162
+ */
163
+ token(clientId, deviceCode, raw) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/device/access_token`), {
166
+ client_id: clientId,
167
+ device_code: deviceCode,
168
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
169
+ }, { headers: { "Content-Type": "application/x-www-form-urlencoded" }, validateStatus: status => status === 200 || status === 400 });
170
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
171
+ });
172
+ }
173
+ getEndpoint(endpoint) {
174
+ return `${this.options.server}/api/account${endpoint}`;
175
+ }
176
+ }
177
+ exports.default = IdpOAuthDevice;
@@ -1,7 +1,10 @@
1
1
  import Base, { MaybeRaw } from "../../../Base";
2
2
  import { OAuthToken, OAuthTokenRequest } from "../../../interfaces/idp/oauth";
3
3
  import { OAuthAppPublicInfo } from "../../../interfaces/idp/organization/settings/oauthApp";
4
+ import IdpOAuthDevice from "./device";
4
5
  export declare class IdpOAuth extends Base {
6
+ get device(): IdpOAuthDevice;
7
+ private _device?;
5
8
  /**
6
9
  * getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
7
10
  * It returns the redirect URL with the code, which is used to redirect to the client application,
@@ -8,10 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.IdpOAuth = void 0;
13
- const Base_1 = require("../../../Base");
16
+ const Base_1 = __importDefault(require("../../../Base"));
17
+ const device_1 = __importDefault(require("./device"));
14
18
  class IdpOAuth extends Base_1.default {
19
+ get device() {
20
+ if (this._device === undefined) {
21
+ this._device = new device_1.default(this.options, this.axios);
22
+ }
23
+ return this._device;
24
+ }
15
25
  /**
16
26
  * getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
17
27
  * It returns the redirect URL with the code, which is used to redirect to the client application,
@@ -72,5 +72,14 @@ export declare class IdpOrganization extends Base {
72
72
  deleteOrganization<R extends boolean = false>(orgName: string, raw?: {
73
73
  raw: R;
74
74
  }): Promise<MaybeRaw<R, void>>;
75
+ /**
76
+ * Updates the avatar of the specified organization
77
+ * @param orgName Name of the organization
78
+ * @param file Image as Javascript File
79
+ * @returns Organization details with updated avatar
80
+ */
81
+ updateAvatar<R extends boolean = false>(orgName: string, file: File, raw?: {
82
+ raw: R;
83
+ }): Promise<MaybeRaw<R, Organization>>;
75
84
  protected getEndpoint(endpoint: string): string;
76
85
  }
@@ -8,13 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.IdpOrganization = void 0;
13
- const Base_1 = require("../../../Base");
16
+ const Base_1 = __importDefault(require("../../../Base"));
14
17
  const license_1 = require("./license");
15
18
  const member_1 = require("./member");
16
- const service_accounts_1 = require("./service-accounts");
17
- const settings_1 = require("./settings");
19
+ const service_accounts_1 = __importDefault(require("./service-accounts"));
20
+ const settings_1 = __importDefault(require("./settings"));
18
21
  const stat_1 = require("./stat");
19
22
  const team_1 = require("./team");
20
23
  class IdpOrganization extends Base_1.default {
@@ -128,6 +131,22 @@ class IdpOrganization extends Base_1.default {
128
131
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
129
132
  });
130
133
  }
134
+ /**
135
+ * Updates the avatar of the specified organization
136
+ * @param orgName Name of the organization
137
+ * @param file Image as Javascript File
138
+ * @returns Organization details with updated avatar
139
+ */
140
+ updateAvatar(orgName, file, raw) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ const data = new FormData();
143
+ data.append("avatar", file);
144
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/avatar`), data, {
145
+ headers: { "Content-Type": "multipart/form-data" },
146
+ });
147
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
148
+ });
149
+ }
131
150
  getEndpoint(endpoint) {
132
151
  return `${this.options.server}/api/account${endpoint}`;
133
152
  }
@@ -8,9 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.IdpOrganizationLicense = void 0;
13
- const Base_1 = require("../../../../Base");
16
+ const Base_1 = __importDefault(require("../../../../Base"));
14
17
  class IdpOrganizationLicense extends Base_1.default {
15
18
  getLicense(orgName, raw) {
16
19
  return __awaiter(this, void 0, void 0, function* () {
@@ -8,12 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.IdpOrganizationMember = void 0;
13
- const Base_1 = require("../../../../Base");
16
+ const Base_1 = __importDefault(require("../../../../Base"));
14
17
  const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
15
18
  const searchFilter_1 = require("../../../../helper/searchFilter");
16
- const invitations_1 = require("./invitations");
19
+ const invitations_1 = __importDefault(require("./invitations"));
17
20
  class IdpOrganizationMember extends Base_1.default {
18
21
  get invitations() {
19
22
  if (this._invitations === undefined) {
@@ -36,6 +36,25 @@ export default class IdpOrganizationMemberInvitations extends Base {
36
36
  create<R extends boolean = false>(orgName: string, email: string, role: OrganizationRole, allowNonRegisteredUsers?: boolean, targetUrl?: string, raw?: {
37
37
  raw: R;
38
38
  }): Promise<MaybeRaw<R, OrganizationMemberInvitation>>;
39
+ /**
40
+ * Invites list of users to an Organization.
41
+ *
42
+ * @param orgName Name of the Organization
43
+ * @param users - List of users to be invited should contain the following data:
44
+ * - email of the person to be invited
45
+ * - the role they will have within the organization if they accept the invitation
46
+ * - allowNonRegisteredUsers Flag to determine if the invitation should go through in the case that the email is not bound to an Helmut Cloud user.
47
+ * If this is set to true and the email is unbound, then an email will be sent asking the person to register.
48
+ * When they do they will automatically join the organization.
49
+ * - targetUrl Optional url the link in the mail will point to
50
+ * @returns The list of created invitations
51
+ */
52
+ createList(orgName: string, users: Array<{
53
+ email: string;
54
+ role: OrganizationRole;
55
+ allowNonRegisteredUsers: false;
56
+ targetUrl?: string;
57
+ }>): Promise<OrganizationMemberInvitation[]>;
39
58
  /**
40
59
  * Accept an invitation.
41
60
  *
@@ -8,8 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const Base_1 = require("../../../../../Base");
15
+ const Base_1 = __importDefault(require("../../../../../Base"));
13
16
  const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
14
17
  const searchFilter_1 = require("../../../../../helper/searchFilter");
15
18
  class IdpOrganizationMemberInvitations extends Base_1.default {
@@ -60,6 +63,25 @@ class IdpOrganizationMemberInvitations extends Base_1.default {
60
63
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
61
64
  });
62
65
  }
66
+ /**
67
+ * Invites list of users to an Organization.
68
+ *
69
+ * @param orgName Name of the Organization
70
+ * @param users - List of users to be invited should contain the following data:
71
+ * - email of the person to be invited
72
+ * - the role they will have within the organization if they accept the invitation
73
+ * - allowNonRegisteredUsers Flag to determine if the invitation should go through in the case that the email is not bound to an Helmut Cloud user.
74
+ * If this is set to true and the email is unbound, then an email will be sent asking the person to register.
75
+ * When they do they will automatically join the organization.
76
+ * - targetUrl Optional url the link in the mail will point to
77
+ * @returns The list of created invitations
78
+ */
79
+ createList(orgName, users) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const resp = yield this.axios.post(this.getEndpoint(`/${orgName}/members/invitations-list`), { users });
82
+ return resp.data;
83
+ });
84
+ }
63
85
  /**
64
86
  * Accept an invitation.
65
87
  *
@@ -17,7 +17,7 @@ export default class IdpOrganizationServiceAccounts extends Base {
17
17
  *
18
18
  * @param orgName {string} Organization name
19
19
  * @param id {string} Service account ID
20
- * @returns {void}
20
+ * @returns {ServiceAccountNoToken}
21
21
  */
22
22
  delete<R extends boolean = false>(orgName: string, id: string, raw?: {
23
23
  raw: R;
@@ -72,5 +72,15 @@ export default class IdpOrganizationServiceAccounts extends Base {
72
72
  rename<R extends boolean = false>(orgName: string, id: string, newName: string, raw?: {
73
73
  raw: R;
74
74
  }): Promise<MaybeRaw<R, ServiceAccountNoToken>>;
75
+ /**
76
+ * Updates the avatar of the specified service account
77
+ * @param orgName Name of the organization
78
+ * @param id {string} Service account ID
79
+ * @param file Image as Javascript File
80
+ * @returns Service account details with updated avatar
81
+ */
82
+ updateAvatar<R extends boolean = false>(orgName: string, id: string, file: File, raw?: {
83
+ raw: R;
84
+ }): Promise<MaybeRaw<R, void>>;
75
85
  protected getEndpoint(endpoint: string): string;
76
86
  }
@@ -8,8 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const Base_1 = require("../../../../Base");
15
+ const Base_1 = __importDefault(require("../../../../Base"));
13
16
  const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
14
17
  const searchFilter_1 = require("../../../../helper/searchFilter");
15
18
  class IdpOrganizationServiceAccounts extends Base_1.default {
@@ -31,7 +34,7 @@ class IdpOrganizationServiceAccounts extends Base_1.default {
31
34
  *
32
35
  * @param orgName {string} Organization name
33
36
  * @param id {string} Service account ID
34
- * @returns {void}
37
+ * @returns {ServiceAccountNoToken}
35
38
  */
36
39
  delete(orgName, id, raw) {
37
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -102,6 +105,23 @@ class IdpOrganizationServiceAccounts extends Base_1.default {
102
105
  return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
103
106
  });
104
107
  }
108
+ /**
109
+ * Updates the avatar of the specified service account
110
+ * @param orgName Name of the organization
111
+ * @param id {string} Service account ID
112
+ * @param file Image as Javascript File
113
+ * @returns Service account details with updated avatar
114
+ */
115
+ updateAvatar(orgName, id, file, raw) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const data = new FormData();
118
+ data.append("avatar", file);
119
+ const resp = yield this.axios.patch(this.getEndpoint(`/${orgName}/service-accounts/${id}/avatar`), data, {
120
+ headers: { "Content-Type": "multipart/form-data" },
121
+ });
122
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
123
+ });
124
+ }
105
125
  getEndpoint(endpoint) {
106
126
  return `${this.options.server}/api/account/v1/org${endpoint}`;
107
127
  }
@@ -8,9 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.IdpDomain = void 0;
13
- const Base_1 = require("../../../../../Base");
16
+ const Base_1 = __importDefault(require("../../../../../Base"));
14
17
  const saml_1 = require("./saml");
15
18
  class IdpDomain extends Base_1.default {
16
19
  /**
@@ -8,9 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.IdpSAMLProvider = void 0;
13
- const Base_1 = require("../../../../../../Base");
16
+ const Base_1 = __importDefault(require("../../../../../../Base"));
14
17
  class IdpSAMLProvider extends Base_1.default {
15
18
  constructor() {
16
19
  super(...arguments);
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Base_1 = require("../../../../Base");
6
+ const Base_1 = __importDefault(require("../../../../Base"));
4
7
  const domain_1 = require("./domain");
5
8
  const oauth_1 = require("./oauth");
6
9
  class IdpOrganizationSettings extends Base_1.default {
@@ -72,5 +72,15 @@ export declare class IdpOAuthApp extends Base {
72
72
  deleteOAuthAppSecret<R extends boolean = false>(orgName: string, oauthAppId: string, secret: string, raw?: {
73
73
  raw: R;
74
74
  }): Promise<MaybeRaw<R, OAuthApp>>;
75
+ /**
76
+ * Updates the avatar of the specified OAuth App
77
+ * @param orgName Name of the organization
78
+ * @param oauthAppId ID of the OAuthApp
79
+ * @param file Image as Javascript File
80
+ * @returns OAuth App details with updated avatar
81
+ */
82
+ updateAvatar<R extends boolean = false>(orgName: string, oauthAppId: string, file: File, raw?: {
83
+ raw: R;
84
+ }): Promise<MaybeRaw<R, OAuthApp>>;
75
85
  protected getEndpoint(endpoint: string): string;
76
86
  }