hcloud-sdk 17.0.0 → 19.0.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 +87 -76
- package/lib/Base.d.ts +2 -1
- package/lib/Hcloud.d.ts +24 -6
- package/lib/Hcloud.js +127 -24
- package/lib/helper/ErrorHelper.js +5 -2
- package/lib/helper/ValidationHelper.d.ts +14 -4
- package/lib/helper/ValidationHelper.js +71 -11
- package/lib/interfaces/agent/logging/cloudwatch.d.ts +23 -0
- package/lib/interfaces/agent/logging/index.d.ts +2 -0
- package/lib/interfaces/{friday → agent/logging}/index.js +2 -3
- package/lib/interfaces/agent/logging/log-collector.d.ts +35 -0
- package/lib/interfaces/agent/module/index.d.ts +7 -0
- package/lib/interfaces/agent/module/index.js +2 -0
- package/lib/interfaces/auditor/index.d.ts +13 -3
- package/lib/interfaces/auditor/index.js +9 -2
- package/lib/interfaces/axios/index.d.ts +5 -0
- package/lib/interfaces/cosmo/asset/index.d.ts +216 -0
- package/lib/interfaces/cosmo/asset/index.js +90 -0
- package/lib/interfaces/cosmo/comment/index.d.ts +41 -0
- package/lib/interfaces/cosmo/comment/index.js +8 -0
- package/lib/interfaces/cosmo/event/index.d.ts +60 -0
- package/lib/interfaces/cosmo/event/index.js +31 -0
- package/lib/interfaces/cosmo/location/index.d.ts +4 -0
- package/lib/interfaces/cosmo/location/index.js +2 -0
- package/lib/interfaces/cosmo/namespace/index.d.ts +9 -0
- package/lib/interfaces/cosmo/namespace/index.js +9 -0
- package/lib/interfaces/cosmo/permissions.d.ts +96 -0
- package/lib/interfaces/cosmo/permissions.js +58 -0
- package/lib/interfaces/cosmo/share/index.d.ts +110 -0
- package/lib/interfaces/cosmo/share/index.js +23 -0
- package/lib/interfaces/cosmo/space/index.d.ts +31 -0
- package/lib/interfaces/cosmo/space/index.js +2 -0
- package/lib/interfaces/cosmo/stats/index.d.ts +11 -0
- package/lib/interfaces/cosmo/stats/index.js +2 -0
- package/lib/interfaces/cosmo/tag/tag.d.ts +13 -0
- package/lib/interfaces/cosmo/tag/tag.js +2 -0
- package/lib/interfaces/global/Products.d.ts +2 -3
- package/lib/interfaces/global/Products.js +1 -2
- package/lib/interfaces/global/Views.d.ts +0 -1
- package/lib/interfaces/global/Views.js +0 -1
- package/lib/interfaces/high5/index.d.ts +7 -7
- package/lib/interfaces/high5/index.js +7 -7
- package/lib/interfaces/{friday → high5}/space/database/document/index.d.ts +1 -1
- package/lib/interfaces/{friday → high5}/space/database/document/index.js +2 -1
- package/lib/interfaces/high5/space/database/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +10 -2
- package/lib/interfaces/high5/space/event/stream/node/index.d.ts +1 -0
- package/lib/interfaces/high5/space/execution/index.d.ts +3 -1
- package/lib/interfaces/{fuse/space/cronjob/CronjobLog.d.ts → high5/space/job/JobLog.d.ts} +3 -3
- package/lib/interfaces/high5/space/job/JobLog.js +2 -0
- package/lib/interfaces/high5/space/job/index.d.ts +83 -0
- package/lib/interfaces/high5/space/job/index.js +11 -0
- package/lib/interfaces/high5/stats.d.ts +21 -0
- package/lib/interfaces/high5/stats.js +2 -0
- package/lib/interfaces/high5/wave/dependentInputs.d.ts +42 -0
- package/lib/interfaces/high5/wave/dependentInputs.js +144 -0
- package/lib/interfaces/high5/wave/dependentInputsValidation.d.ts +22 -0
- package/lib/interfaces/high5/wave/dependentInputsValidation.js +220 -0
- package/lib/interfaces/idp/index.d.ts +3 -3
- package/lib/interfaces/idp/index.js +3 -3
- package/lib/interfaces/idp/oauth/device.d.ts +18 -0
- package/lib/interfaces/idp/oauth/device.js +2 -0
- package/lib/interfaces/idp/oauth/index.d.ts +19 -5
- package/lib/interfaces/idp/organization/index.d.ts +2 -0
- package/lib/interfaces/idp/organization/index.js +2 -0
- package/lib/interfaces/idp/organization/license/index.d.ts +13 -11
- package/lib/interfaces/idp/organization/member/index.d.ts +1 -0
- package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +4 -0
- package/lib/interfaces/idp/organization/stats.d.ts +7 -0
- package/lib/interfaces/idp/organization/stats.js +2 -0
- package/lib/interfaces/idp/organization/team/index.d.ts +0 -1
- package/lib/interfaces/idp/user/Message.d.ts +22 -0
- package/lib/interfaces/idp/user/Message.js +14 -0
- package/lib/interfaces/idp/user/NotificationSettings.d.ts +1 -0
- package/lib/interfaces/idp/user/Scopes.d.ts +1 -15
- package/lib/interfaces/idp/user/Scopes.js +0 -21
- package/lib/interfaces/idp/user/index.d.ts +5 -1
- package/lib/interfaces/mailer/index.d.ts +50 -2
- package/lib/interfaces/mailer/index.js +100 -2
- package/lib/interfaces/mothership/index.d.ts +3 -1
- package/lib/interfaces/mothership/index.js +15 -0
- package/lib/interfaces/mothership/stats.d.ts +4 -0
- package/lib/interfaces/mothership/stats.js +2 -0
- package/lib/interfaces/nats/index.d.ts +79 -51
- package/lib/interfaces/nats/index.js +140 -125
- package/lib/interfaces/shorts/index.d.ts +17 -0
- package/lib/interfaces/shorts/index.js +8 -0
- package/lib/service/agent/bundle/dev/index.d.ts +16 -6
- package/lib/service/agent/bundle/dev/index.js +16 -11
- package/lib/service/agent/bundle/index.d.ts +10 -4
- package/lib/service/agent/bundle/index.js +10 -7
- package/lib/service/agent/context/index.d.ts +22 -8
- package/lib/service/agent/context/index.js +19 -15
- package/lib/service/agent/index.d.ts +6 -0
- package/lib/service/agent/index.js +18 -1
- package/lib/service/agent/installer/index.js +4 -1
- package/lib/service/agent/logging/index.d.ts +69 -0
- package/lib/service/agent/logging/index.js +117 -0
- package/lib/service/agent/module/index.d.ts +36 -0
- package/lib/service/agent/module/index.js +65 -0
- package/lib/service/auditor/index.d.ts +8 -4
- package/lib/service/auditor/index.js +9 -6
- package/lib/service/auditor/internal/index.d.ts +27 -3
- package/lib/service/auditor/internal/index.js +38 -6
- package/lib/service/bouncer/features/index.d.ts +4 -2
- package/lib/service/bouncer/features/index.js +6 -3
- package/lib/service/bouncer/index.js +5 -2
- package/lib/service/cosmo/asset/index.d.ts +265 -0
- package/lib/service/cosmo/asset/index.js +420 -0
- package/lib/service/cosmo/comment/index.d.ts +93 -0
- package/lib/service/cosmo/comment/index.js +136 -0
- package/lib/service/cosmo/event/index.d.ts +23 -0
- package/lib/service/cosmo/event/index.js +43 -0
- package/lib/service/cosmo/folder/index.d.ts +27 -0
- package/lib/service/cosmo/folder/index.js +50 -0
- package/lib/service/cosmo/index.d.ts +52 -0
- package/lib/service/cosmo/index.js +129 -0
- package/lib/service/cosmo/internal/index.d.ts +7 -0
- package/lib/service/cosmo/internal/index.js +20 -0
- package/lib/service/cosmo/internal/space/index.d.ts +15 -0
- package/lib/service/cosmo/internal/space/index.js +37 -0
- package/lib/service/cosmo/location/index.d.ts +40 -0
- package/lib/service/cosmo/location/index.js +66 -0
- package/lib/service/cosmo/namespace/index.d.ts +56 -0
- package/lib/service/cosmo/namespace/index.js +85 -0
- package/lib/service/cosmo/organization/index.d.ts +47 -0
- package/lib/service/cosmo/organization/index.js +67 -0
- package/lib/service/cosmo/permissions/index.d.ts +131 -0
- package/lib/service/cosmo/permissions/index.js +184 -0
- package/lib/service/cosmo/production/index.d.ts +26 -0
- package/lib/service/cosmo/production/index.js +48 -0
- package/lib/service/cosmo/share/index.d.ts +169 -0
- package/lib/service/cosmo/share/index.js +227 -0
- package/lib/service/cosmo/space/index.d.ts +131 -0
- package/lib/service/cosmo/space/index.js +190 -0
- package/lib/service/cosmo/stats/index.d.ts +35 -0
- package/lib/service/cosmo/stats/index.js +58 -0
- package/lib/service/cosmo/tag/index.d.ts +67 -0
- package/lib/service/cosmo/tag/index.js +96 -0
- package/lib/service/dali/DaliAvatar.d.ts +0 -6
- package/lib/service/dali/DaliAvatar.js +4 -11
- package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +10 -4
- package/lib/service/dali/avatar/DaliCosmoSpace.js +12 -8
- package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +11 -4
- package/lib/service/dali/avatar/DaliHigh5Pool.js +12 -8
- package/lib/service/dali/avatar/DaliHigh5Space.d.ts +11 -4
- package/lib/service/dali/avatar/DaliHigh5Space.js +12 -8
- package/lib/service/dali/avatar/DaliOAuthApp.d.ts +11 -4
- package/lib/service/dali/avatar/DaliOAuthApp.js +12 -8
- package/lib/service/dali/avatar/DaliOrganization.d.ts +11 -4
- package/lib/service/dali/avatar/DaliOrganization.js +12 -8
- package/lib/service/dali/avatar/DaliServiceAccount.d.ts +10 -4
- package/lib/service/dali/avatar/DaliServiceAccount.js +12 -8
- package/lib/service/dali/avatar/DaliTeam.d.ts +11 -4
- package/lib/service/dali/avatar/DaliTeam.js +12 -8
- package/lib/service/dali/avatar/DaliUser.d.ts +11 -4
- package/lib/service/dali/avatar/DaliUser.js +12 -8
- package/lib/service/dali/index.d.ts +4 -5
- package/lib/service/dali/index.js +6 -6
- package/lib/service/high5/execution/index.d.ts +4 -2
- package/lib/service/high5/execution/index.js +7 -3
- package/lib/service/high5/execution/log/index.js +4 -1
- package/lib/service/high5/execution/status/index.d.ts +5 -3
- package/lib/service/high5/execution/status/index.js +7 -4
- package/lib/service/high5/index.d.ts +7 -2
- package/lib/service/high5/index.js +13 -3
- package/lib/service/high5/internal/index.d.ts +4 -2
- package/lib/service/high5/internal/index.js +7 -3
- package/lib/service/high5/internal/space/index.d.ts +10 -3
- package/lib/service/high5/internal/space/index.js +17 -5
- package/lib/service/high5/internal/space/job/index.d.ts +7 -0
- package/lib/service/high5/internal/space/job/index.js +20 -0
- package/lib/service/high5/internal/space/job/log/index.d.ts +17 -0
- package/lib/service/{fuse/internal/space/cronjob → high5/internal/space/job}/log/index.js +13 -10
- package/lib/service/high5/joinToken/index.d.ts +14 -6
- package/lib/service/high5/joinToken/index.js +14 -10
- package/lib/service/high5/space/database/document/array/index.d.ts +73 -0
- package/lib/service/high5/space/database/document/array/index.js +105 -0
- package/lib/service/{friday → high5}/space/database/document/index.d.ts +26 -10
- package/lib/service/{friday → high5}/space/database/document/index.js +35 -17
- package/lib/service/high5/space/database/document/number/index.d.ts +51 -0
- package/lib/service/high5/space/database/document/number/index.js +80 -0
- package/lib/service/{friday → high5}/space/database/index.d.ts +22 -12
- package/lib/service/{friday → high5}/space/database/index.js +22 -18
- package/lib/service/high5/space/event/index.d.ts +17 -7
- package/lib/service/high5/space/event/index.js +16 -12
- package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +4 -2
- package/lib/service/high5/space/event/stream/design/DesignOperations.js +6 -3
- package/lib/service/high5/space/event/stream/design/index.d.ts +10 -4
- package/lib/service/high5/space/event/stream/design/index.js +13 -9
- package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +16 -6
- package/lib/service/high5/space/event/stream/design/snapshot/index.js +16 -11
- package/lib/service/high5/space/event/stream/index.d.ts +32 -12
- package/lib/service/high5/space/event/stream/index.js +26 -22
- package/lib/service/high5/space/execution/index.d.ts +19 -7
- package/lib/service/high5/space/execution/index.js +21 -13
- package/lib/service/high5/space/execution/log/index.d.ts +8 -4
- package/lib/service/high5/space/execution/log/index.js +9 -6
- package/lib/service/high5/space/execution/status/index.d.ts +7 -3
- package/lib/service/high5/space/execution/status/index.js +8 -5
- package/lib/service/high5/space/index.d.ts +53 -14
- package/lib/service/high5/space/index.js +70 -28
- package/lib/service/{fuse/space/cronjob → high5/space/job}/index.d.ts +57 -35
- package/lib/service/{fuse/space/cronjob → high5/space/job}/index.js +88 -87
- package/lib/service/{fuse/space/cronjob → high5/space/job}/log/index.d.ts +15 -11
- package/lib/service/{fuse/space/cronjob → high5/space/job}/log/index.js +19 -16
- package/lib/service/high5/space/node/index.d.ts +20 -8
- package/lib/service/high5/space/node/index.js +18 -14
- package/lib/service/high5/space/pool/index.d.ts +38 -11
- package/lib/service/high5/space/pool/index.js +41 -19
- package/lib/service/high5/space/secret/index.d.ts +17 -7
- package/lib/service/high5/space/secret/index.js +16 -12
- package/lib/service/high5/space/stat/index.d.ts +12 -0
- package/lib/service/high5/space/stat/index.js +34 -0
- package/lib/service/high5/space/wave/index.d.ts +16 -6
- package/lib/service/high5/space/wave/index.js +15 -11
- package/lib/service/high5/space/webhook/index.d.ts +32 -12
- package/lib/service/high5/space/webhook/index.js +29 -22
- package/lib/service/high5/space/webhook/log/index.d.ts +4 -2
- package/lib/service/high5/space/webhook/log/index.js +6 -3
- package/lib/service/high5/stat/index.d.ts +11 -0
- package/lib/service/{fuse/internal → high5/stat}/index.js +16 -14
- package/lib/service/high5/wave/index.js +4 -1
- package/lib/service/high5/wave/s3/index.d.ts +31 -8
- package/lib/service/high5/wave/s3/index.js +47 -23
- package/lib/service/idp/guest/index.d.ts +42 -0
- package/lib/service/idp/guest/index.js +69 -0
- package/lib/service/idp/index.d.ts +25 -7
- package/lib/service/idp/index.js +27 -13
- package/lib/service/idp/internal/index.d.ts +5 -3
- package/lib/service/idp/internal/index.js +9 -4
- package/lib/service/idp/oauth/device.d.ts +131 -0
- package/lib/service/idp/oauth/device.js +177 -0
- package/lib/service/idp/oauth/index.d.ts +19 -6
- package/lib/service/idp/oauth/index.js +26 -16
- package/lib/service/idp/organization/index.d.ts +28 -5
- package/lib/service/idp/organization/index.js +41 -11
- package/lib/service/idp/organization/license/index.d.ts +7 -3
- package/lib/service/idp/organization/license/index.js +8 -5
- package/lib/service/idp/organization/member/index.d.ts +20 -8
- package/lib/service/idp/organization/member/index.js +20 -15
- package/lib/service/idp/organization/member/invitations/index.d.ts +42 -9
- package/lib/service/idp/organization/member/invitations/index.js +94 -59
- package/lib/service/idp/organization/service-accounts/index.d.ts +31 -9
- package/lib/service/idp/organization/service-accounts/index.js +35 -14
- package/lib/service/idp/organization/settings/domain/index.d.ts +13 -5
- package/lib/service/idp/organization/settings/domain/index.js +13 -9
- package/lib/service/idp/organization/settings/domain/saml/index.d.ts +16 -6
- package/lib/service/idp/organization/settings/domain/saml/index.js +23 -19
- package/lib/service/idp/organization/settings/index.js +4 -1
- package/lib/service/idp/organization/settings/oauth/index.d.ts +33 -9
- package/lib/service/idp/organization/settings/oauth/index.js +37 -16
- package/lib/service/idp/organization/stat/index.d.ts +11 -0
- package/lib/service/idp/organization/stat/index.js +33 -0
- package/lib/service/idp/organization/team/index.d.ts +32 -10
- package/lib/service/idp/organization/team/index.js +35 -14
- package/lib/service/idp/registration/index.d.ts +10 -4
- package/lib/service/idp/registration/index.js +19 -10
- package/lib/service/idp/user/index.d.ts +41 -11
- package/lib/service/idp/user/index.js +49 -19
- package/lib/service/idp/user/license/index.d.ts +7 -3
- package/lib/service/idp/user/license/index.js +8 -5
- package/lib/service/idp/user/message/index.d.ts +62 -0
- package/lib/service/idp/user/message/index.js +95 -0
- package/lib/service/idp/user/password/index.d.ts +4 -2
- package/lib/service/idp/user/password/index.js +6 -3
- package/lib/service/idp/user/settings/connections/index.d.ts +4 -2
- package/lib/service/idp/user/settings/connections/index.js +6 -3
- package/lib/service/idp/user/settings/general/index.d.ts +10 -4
- package/lib/service/idp/user/settings/general/index.js +10 -7
- package/lib/service/idp/user/settings/index.js +4 -1
- package/lib/service/idp/user/settings/notifications/index.d.ts +7 -3
- package/lib/service/idp/user/settings/notifications/index.js +8 -5
- package/lib/service/idp/user/settings/oauthApps/index.d.ts +7 -3
- package/lib/service/idp/user/settings/oauthApps/index.js +10 -6
- package/lib/service/idp/user/settings/pats/index.d.ts +22 -8
- package/lib/service/idp/user/settings/pats/index.js +21 -16
- package/lib/service/idp/user/settings/twoFactor/index.js +4 -1
- package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +16 -6
- package/lib/service/idp/user/settings/twoFactor/totp/index.js +17 -11
- package/lib/service/mailer/index.d.ts +4 -2
- package/lib/service/mailer/index.js +7 -4
- package/lib/service/mailer/internal/index.d.ts +14 -6
- package/lib/service/mailer/internal/index.js +12 -9
- package/lib/service/mothership/index.d.ts +35 -13
- package/lib/service/mothership/index.js +36 -18
- package/lib/service/nats/index.d.ts +7 -0
- package/lib/service/nats/index.js +77 -44
- package/lib/service/shorts/index.d.ts +18 -0
- package/lib/service/{friday → shorts}/index.js +17 -11
- package/lib/service/shorts/internal/index.d.ts +75 -0
- package/lib/service/shorts/internal/index.js +118 -0
- package/lib/utils/bouncer/features/Provider.js +0 -1
- package/package.json +2 -2
- package/lib/interfaces/friday/index.d.ts +0 -3
- package/lib/interfaces/friday/space/index.d.ts +0 -21
- package/lib/interfaces/friday/space/index.js +0 -11
- package/lib/interfaces/fuse/index.d.ts +0 -3
- package/lib/interfaces/fuse/index.js +0 -19
- package/lib/interfaces/fuse/space/cronjob/Cronjob.d.ts +0 -38
- package/lib/interfaces/fuse/space/cronjob/Cronjob.js +0 -8
- package/lib/interfaces/fuse/space/index.d.ts +0 -22
- package/lib/interfaces/fuse/space/index.js +0 -11
- package/lib/service/dali/avatar/DaliFuseSpace.d.ts +0 -26
- package/lib/service/dali/avatar/DaliFuseSpace.js +0 -58
- package/lib/service/friday/index.d.ts +0 -13
- package/lib/service/friday/space/index.d.ts +0 -81
- package/lib/service/friday/space/index.js +0 -150
- package/lib/service/fuse/index.d.ts +0 -18
- package/lib/service/fuse/index.js +0 -48
- package/lib/service/fuse/internal/index.d.ts +0 -8
- package/lib/service/fuse/internal/space/cronjob/index.d.ts +0 -7
- package/lib/service/fuse/internal/space/cronjob/index.js +0 -17
- package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +0 -15
- package/lib/service/fuse/internal/space/index.d.ts +0 -22
- package/lib/service/fuse/internal/space/index.js +0 -49
- package/lib/service/fuse/space/index.d.ts +0 -81
- package/lib/service/fuse/space/index.js +0 -152
- /package/lib/interfaces/{friday/space/database/index.js → agent/logging/cloudwatch.js} +0 -0
- /package/lib/interfaces/{fuse/space/cronjob/CronjobLog.js → agent/logging/log-collector.js} +0 -0
- /package/lib/interfaces/{friday → high5}/space/database/index.d.ts +0 -0
|
@@ -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
|
-
import Base from "../../../Base";
|
|
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,
|
|
@@ -10,7 +13,9 @@ export declare class IdpOAuth extends Base {
|
|
|
10
13
|
* redirect_uri, scopes and optionally state.
|
|
11
14
|
* @returns the entire redirect uri including the authorization code if successful
|
|
12
15
|
*/
|
|
13
|
-
getAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean
|
|
16
|
+
getAuthorizationCodeInsideRedirectUrl<R extends boolean = false>(queryString: string, doNotRedirect?: boolean, raw?: {
|
|
17
|
+
raw: R;
|
|
18
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
14
19
|
/**
|
|
15
20
|
* Check if the user has consented to specified scopes. If the user has already consented this request
|
|
16
21
|
* will return the redirect URL, otherwise, it will be a consent.not.given error.
|
|
@@ -23,7 +28,9 @@ export declare class IdpOAuth extends Base {
|
|
|
23
28
|
* @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
|
|
24
29
|
* @see OAuthApp
|
|
25
30
|
*/
|
|
26
|
-
getInfoOrAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean
|
|
31
|
+
getInfoOrAuthorizationCodeInsideRedirectUrl<R extends boolean = false>(queryString: string, doNotRedirect?: boolean, raw?: {
|
|
32
|
+
raw: R;
|
|
33
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
27
34
|
/**
|
|
28
35
|
* createScopesAndGetAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
|
|
29
36
|
* It returns the redirect URL with the code, which is used to redirect to the client application,
|
|
@@ -32,18 +39,24 @@ export declare class IdpOAuth extends Base {
|
|
|
32
39
|
* redirect_uri, scopes and optionally state.
|
|
33
40
|
* @returns the entire redirect uri including the authorization code if successful
|
|
34
41
|
*/
|
|
35
|
-
createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean
|
|
42
|
+
createScopesAndGetAuthorizationCodeInsideRedirectUrl<R extends boolean = false>(queryString: string, doNotRedirect?: boolean, raw?: {
|
|
43
|
+
raw: R;
|
|
44
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
36
45
|
/**
|
|
37
46
|
* A valid code can be used to request a new API token.
|
|
38
47
|
* @param tokenRequest contains the code, client_id, client_secret and redirect_uri
|
|
39
48
|
*/
|
|
40
|
-
exchangeCodeForToken(tokenRequest: OAuthTokenRequest
|
|
49
|
+
exchangeCodeForToken<R extends boolean = false>(tokenRequest: OAuthTokenRequest, raw?: {
|
|
50
|
+
raw: R;
|
|
51
|
+
}): Promise<MaybeRaw<R, OAuthToken>>;
|
|
41
52
|
/**
|
|
42
53
|
* Get OAuth app public information via client ID
|
|
43
54
|
*
|
|
44
55
|
* @param clientId {string} - Client ID of the OAuth app
|
|
45
56
|
* @returns Public OAuth app information
|
|
46
57
|
*/
|
|
47
|
-
getOAuthAppInfo(clientId: string
|
|
58
|
+
getOAuthAppInfo<R extends boolean = false>(clientId: string, raw?: {
|
|
59
|
+
raw: R;
|
|
60
|
+
}): Promise<MaybeRaw<R, OAuthAppPublicInfo>>;
|
|
48
61
|
protected getEndpoint(endpoint: string): string;
|
|
49
62
|
}
|
|
@@ -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,
|
|
@@ -20,7 +30,7 @@ class IdpOAuth extends Base_1.default {
|
|
|
20
30
|
* redirect_uri, scopes and optionally state.
|
|
21
31
|
* @returns the entire redirect uri including the authorization code if successful
|
|
22
32
|
*/
|
|
23
|
-
getAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect) {
|
|
33
|
+
getAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect, raw) {
|
|
24
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
35
|
if (!queryString.startsWith("?")) {
|
|
26
36
|
queryString = `?${queryString}`;
|
|
@@ -28,11 +38,11 @@ class IdpOAuth extends Base_1.default {
|
|
|
28
38
|
if (doNotRedirect) {
|
|
29
39
|
queryString += "&no_redirect=true";
|
|
30
40
|
}
|
|
31
|
-
const
|
|
41
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/authorize${queryString}`), { maxRedirects: 0 });
|
|
32
42
|
if (doNotRedirect) {
|
|
33
|
-
return
|
|
43
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data.redirectUrl);
|
|
34
44
|
}
|
|
35
|
-
return
|
|
45
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.headers.location);
|
|
36
46
|
});
|
|
37
47
|
}
|
|
38
48
|
/**
|
|
@@ -47,7 +57,7 @@ class IdpOAuth extends Base_1.default {
|
|
|
47
57
|
* @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
|
|
48
58
|
* @see OAuthApp
|
|
49
59
|
*/
|
|
50
|
-
getInfoOrAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect) {
|
|
60
|
+
getInfoOrAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect, raw) {
|
|
51
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
62
|
if (!queryString.startsWith("?")) {
|
|
53
63
|
queryString = `?${queryString}`;
|
|
@@ -59,9 +69,9 @@ class IdpOAuth extends Base_1.default {
|
|
|
59
69
|
maxRedirects: 0,
|
|
60
70
|
});
|
|
61
71
|
if (response.status < 300) {
|
|
62
|
-
return response.data.redirectUrl;
|
|
72
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.data.redirectUrl);
|
|
63
73
|
}
|
|
64
|
-
return response.headers.location;
|
|
74
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.headers.location);
|
|
65
75
|
});
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
@@ -72,7 +82,7 @@ class IdpOAuth extends Base_1.default {
|
|
|
72
82
|
* redirect_uri, scopes and optionally state.
|
|
73
83
|
* @returns the entire redirect uri including the authorization code if successful
|
|
74
84
|
*/
|
|
75
|
-
createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect) {
|
|
85
|
+
createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect, raw) {
|
|
76
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
87
|
if (!queryString.startsWith("?")) {
|
|
78
88
|
queryString = `?${queryString}`;
|
|
@@ -80,21 +90,21 @@ class IdpOAuth extends Base_1.default {
|
|
|
80
90
|
if (doNotRedirect) {
|
|
81
91
|
queryString += "&no_redirect=true";
|
|
82
92
|
}
|
|
83
|
-
const
|
|
93
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/authorize${queryString}`));
|
|
84
94
|
if (doNotRedirect) {
|
|
85
|
-
return
|
|
95
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data.redirectUrl);
|
|
86
96
|
}
|
|
87
|
-
return
|
|
97
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
88
98
|
});
|
|
89
99
|
}
|
|
90
100
|
/**
|
|
91
101
|
* A valid code can be used to request a new API token.
|
|
92
102
|
* @param tokenRequest contains the code, client_id, client_secret and redirect_uri
|
|
93
103
|
*/
|
|
94
|
-
exchangeCodeForToken(tokenRequest) {
|
|
104
|
+
exchangeCodeForToken(tokenRequest, raw) {
|
|
95
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
106
|
const response = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/access_token`), tokenRequest);
|
|
97
|
-
return response.data;
|
|
107
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.data);
|
|
98
108
|
});
|
|
99
109
|
}
|
|
100
110
|
/**
|
|
@@ -103,10 +113,10 @@ class IdpOAuth extends Base_1.default {
|
|
|
103
113
|
* @param clientId {string} - Client ID of the OAuth app
|
|
104
114
|
* @returns Public OAuth app information
|
|
105
115
|
*/
|
|
106
|
-
getOAuthAppInfo(clientId) {
|
|
116
|
+
getOAuthAppInfo(clientId, raw) {
|
|
107
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
118
|
const response = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/app/${clientId}`));
|
|
109
|
-
return response.data;
|
|
119
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.data);
|
|
110
120
|
});
|
|
111
121
|
}
|
|
112
122
|
getEndpoint(endpoint) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import Base from "../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
2
|
import { Organization, OrganizationQueryOptions } from "../../../interfaces/idp/organization";
|
|
3
3
|
import { IdpOrganizationLicense } from "./license";
|
|
4
4
|
import { IdpOrganizationMember } from "./member";
|
|
5
5
|
import IdpOrganizationServiceAccounts from "./service-accounts";
|
|
6
6
|
import IdpOrganizationSettings from "./settings";
|
|
7
|
+
import { IdpOrganizationStat } from "./stat";
|
|
7
8
|
import { IdpOrganizationTeams } from "./team";
|
|
8
9
|
export declare class IdpOrganization extends Base {
|
|
9
10
|
/**
|
|
@@ -31,6 +32,11 @@ export declare class IdpOrganization extends Base {
|
|
|
31
32
|
*/
|
|
32
33
|
get serviceAccounts(): IdpOrganizationServiceAccounts;
|
|
33
34
|
private _serviceAccounts?;
|
|
35
|
+
/**
|
|
36
|
+
* Handles everything around organization statistics.
|
|
37
|
+
*/
|
|
38
|
+
get stat(): IdpOrganizationStat;
|
|
39
|
+
private _stat?;
|
|
34
40
|
/**
|
|
35
41
|
* Updates an Organization.
|
|
36
42
|
* @param orgName Current name of the Organization
|
|
@@ -38,25 +44,42 @@ export declare class IdpOrganization extends Base {
|
|
|
38
44
|
* @param company (optional) New company name
|
|
39
45
|
* @returns The updated Organization
|
|
40
46
|
*/
|
|
41
|
-
updateOrganization(orgName: string, newName: string, company?: string
|
|
47
|
+
updateOrganization<R extends boolean = false>(orgName: string, newName: string, company?: string, raw?: {
|
|
48
|
+
raw: R;
|
|
49
|
+
}): Promise<MaybeRaw<R, Organization>>;
|
|
42
50
|
/**
|
|
43
51
|
* Creates a new Organization.
|
|
44
52
|
* @param name Name of the new Organization
|
|
45
53
|
* @param company (optional) Company name for the new Organization
|
|
46
54
|
* @returns The created Organization
|
|
47
55
|
*/
|
|
48
|
-
createOrganization(name: string, company?: string
|
|
56
|
+
createOrganization<R extends boolean = false>(name: string, company?: string, raw?: {
|
|
57
|
+
raw: R;
|
|
58
|
+
}): Promise<MaybeRaw<R, Organization>>;
|
|
49
59
|
/**
|
|
50
60
|
* Retrieves an Organization by its name.
|
|
51
61
|
* @param orgName Name of the Organization
|
|
52
62
|
* @param options Defines query options to retrieve additional properties in the response
|
|
53
63
|
* @returns The requested Organization
|
|
54
64
|
*/
|
|
55
|
-
getOrganization(orgName: string, options?: OrganizationQueryOptions
|
|
65
|
+
getOrganization<R extends boolean = false>(orgName: string, options?: OrganizationQueryOptions, raw?: {
|
|
66
|
+
raw: R;
|
|
67
|
+
}): Promise<MaybeRaw<R, Organization>>;
|
|
56
68
|
/**
|
|
57
69
|
* Deletes an Organization. This will also delete all dependencies that the Organization has (Teams, Spaces, apps, ...).
|
|
58
70
|
* @param orgName Name of the Organization to be deleted
|
|
59
71
|
*/
|
|
60
|
-
deleteOrganization(orgName: string
|
|
72
|
+
deleteOrganization<R extends boolean = false>(orgName: string, raw?: {
|
|
73
|
+
raw: R;
|
|
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>>;
|
|
61
84
|
protected getEndpoint(endpoint: string): string;
|
|
62
85
|
}
|
|
@@ -8,13 +8,17 @@ 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"));
|
|
21
|
+
const stat_1 = require("./stat");
|
|
18
22
|
const team_1 = require("./team");
|
|
19
23
|
class IdpOrganization extends Base_1.default {
|
|
20
24
|
/**
|
|
@@ -62,6 +66,15 @@ class IdpOrganization extends Base_1.default {
|
|
|
62
66
|
}
|
|
63
67
|
return this._serviceAccounts;
|
|
64
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Handles everything around organization statistics.
|
|
71
|
+
*/
|
|
72
|
+
get stat() {
|
|
73
|
+
if (this._stat === undefined) {
|
|
74
|
+
this._stat = new stat_1.IdpOrganizationStat(this.options, this.axios);
|
|
75
|
+
}
|
|
76
|
+
return this._stat;
|
|
77
|
+
}
|
|
65
78
|
/**
|
|
66
79
|
* Updates an Organization.
|
|
67
80
|
* @param orgName Current name of the Organization
|
|
@@ -69,11 +82,11 @@ class IdpOrganization extends Base_1.default {
|
|
|
69
82
|
* @param company (optional) New company name
|
|
70
83
|
* @returns The updated Organization
|
|
71
84
|
*/
|
|
72
|
-
updateOrganization(orgName, newName, company) {
|
|
85
|
+
updateOrganization(orgName, newName, company, raw) {
|
|
73
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
87
|
const organization = { name: newName, company: company };
|
|
75
88
|
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}`), organization);
|
|
76
|
-
return resp.data;
|
|
89
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
77
90
|
});
|
|
78
91
|
}
|
|
79
92
|
/**
|
|
@@ -82,11 +95,11 @@ class IdpOrganization extends Base_1.default {
|
|
|
82
95
|
* @param company (optional) Company name for the new Organization
|
|
83
96
|
* @returns The created Organization
|
|
84
97
|
*/
|
|
85
|
-
createOrganization(name, company) {
|
|
98
|
+
createOrganization(name, company, raw) {
|
|
86
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
100
|
const organization = { name: name, company: company };
|
|
88
101
|
const resp = yield this.axios.post(this.getEndpoint(`/v1/org`), organization);
|
|
89
|
-
return resp.data;
|
|
102
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
90
103
|
});
|
|
91
104
|
}
|
|
92
105
|
/**
|
|
@@ -95,7 +108,7 @@ class IdpOrganization extends Base_1.default {
|
|
|
95
108
|
* @param options Defines query options to retrieve additional properties in the response
|
|
96
109
|
* @returns The requested Organization
|
|
97
110
|
*/
|
|
98
|
-
getOrganization(orgName, options) {
|
|
111
|
+
getOrganization(orgName, options, raw) {
|
|
99
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
113
|
const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}`), {
|
|
101
114
|
params: {
|
|
@@ -105,16 +118,33 @@ class IdpOrganization extends Base_1.default {
|
|
|
105
118
|
license: options === null || options === void 0 ? void 0 : options.getLicense,
|
|
106
119
|
},
|
|
107
120
|
});
|
|
108
|
-
return resp.data;
|
|
121
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
109
122
|
});
|
|
110
123
|
}
|
|
111
124
|
/**
|
|
112
125
|
* Deletes an Organization. This will also delete all dependencies that the Organization has (Teams, Spaces, apps, ...).
|
|
113
126
|
* @param orgName Name of the Organization to be deleted
|
|
114
127
|
*/
|
|
115
|
-
deleteOrganization(orgName) {
|
|
128
|
+
deleteOrganization(orgName, raw) {
|
|
116
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}`));
|
|
130
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}`));
|
|
131
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
132
|
+
});
|
|
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);
|
|
118
148
|
});
|
|
119
149
|
}
|
|
120
150
|
getEndpoint(endpoint) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import Base from "../../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../../Base";
|
|
2
2
|
import { License } from "../../../../interfaces/idp/organization/license";
|
|
3
3
|
export declare class IdpOrganizationLicense extends Base {
|
|
4
|
-
getLicense(orgName: string
|
|
5
|
-
|
|
4
|
+
getLicense<R extends boolean = false>(orgName: string, raw?: {
|
|
5
|
+
raw: R;
|
|
6
|
+
}): Promise<MaybeRaw<R, License>>;
|
|
7
|
+
updateLicense<R extends boolean = false>(orgName: string, token: string, raw?: {
|
|
8
|
+
raw: R;
|
|
9
|
+
}): Promise<MaybeRaw<R, License>>;
|
|
6
10
|
protected getEndpoint(endpoint: string): string;
|
|
7
11
|
}
|
|
@@ -8,20 +8,23 @@ 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
|
-
getLicense(orgName) {
|
|
18
|
+
getLicense(orgName, raw) {
|
|
16
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
20
|
const res = yield this.axios.get(this.getEndpoint(`/org/${orgName}/license`));
|
|
18
|
-
return res.data;
|
|
21
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
|
-
updateLicense(orgName, token) {
|
|
24
|
+
updateLicense(orgName, token, raw) {
|
|
22
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
26
|
const res = yield this.axios.put(this.getEndpoint(`/org/${orgName}/license`), { identifier: token });
|
|
24
|
-
return res.data;
|
|
27
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
25
28
|
});
|
|
26
29
|
}
|
|
27
30
|
getEndpoint(endpoint) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Base from "../../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../../Base";
|
|
2
2
|
import { PaginatedResponse, SearchParams } from "../../../../interfaces/global";
|
|
3
3
|
import { OrganizationMember, OrgMemberPatch } from "../../../../interfaces/idp/organization/member";
|
|
4
4
|
import IdpOrganizationMemberInvitations from "./invitations";
|
|
@@ -15,18 +15,22 @@ export declare class IdpOrganizationMember extends Base {
|
|
|
15
15
|
* @param page (optional) Page number to skip the first (page * limit) results (defaults to 0)
|
|
16
16
|
* @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
|
|
17
17
|
*/
|
|
18
|
-
searchOrganizationMembers({ orgName, filters, excludeTeamByName, excludeServiceAccounts, sorting, limit, page, }: SearchParams & {
|
|
18
|
+
searchOrganizationMembers<R extends boolean = false>({ orgName, filters, excludeTeamByName, excludeServiceAccounts, sorting, limit, page, }: SearchParams & {
|
|
19
19
|
orgName: string;
|
|
20
20
|
excludeTeamByName?: string;
|
|
21
21
|
excludeServiceAccounts?: boolean;
|
|
22
|
-
}
|
|
22
|
+
}, raw?: {
|
|
23
|
+
raw: R;
|
|
24
|
+
}): Promise<MaybeRaw<R, PaginatedResponse<OrganizationMember>>>;
|
|
23
25
|
/**
|
|
24
26
|
* Retrieves an organization member by its user ID.
|
|
25
27
|
* @param orgName Name of the organization
|
|
26
28
|
* @param userId ID of the user
|
|
27
29
|
* @returns The requested Organization Member
|
|
28
30
|
*/
|
|
29
|
-
getOrganizationMember(orgName: string, userId: string
|
|
31
|
+
getOrganizationMember<R extends boolean = false>(orgName: string, userId: string, raw?: {
|
|
32
|
+
raw: R;
|
|
33
|
+
}): Promise<MaybeRaw<R, OrganizationMember>>;
|
|
30
34
|
/**
|
|
31
35
|
* Updates the role of a User in the specified Organization.
|
|
32
36
|
* @param orgName Name of the Organization
|
|
@@ -34,7 +38,9 @@ export declare class IdpOrganizationMember extends Base {
|
|
|
34
38
|
* @param orgMemberPatch New role
|
|
35
39
|
* @returns The updated OrganizationMember
|
|
36
40
|
*/
|
|
37
|
-
patchOrganizationMemberRole(orgName: string, userId: string, orgMemberPatch: OrgMemberPatch
|
|
41
|
+
patchOrganizationMemberRole<R extends boolean = false>(orgName: string, userId: string, orgMemberPatch: OrgMemberPatch, raw?: {
|
|
42
|
+
raw: R;
|
|
43
|
+
}): Promise<MaybeRaw<R, OrganizationMember>>;
|
|
38
44
|
/**
|
|
39
45
|
* Updates the executionTarget flag of a User in the specified Organization.
|
|
40
46
|
* @param orgName Name of the Organization
|
|
@@ -42,17 +48,23 @@ export declare class IdpOrganizationMember extends Base {
|
|
|
42
48
|
* @param executionTarget Boolean value to set
|
|
43
49
|
* @returns The updated OrganizationMember
|
|
44
50
|
*/
|
|
45
|
-
patchOrganizationExecutionTarget(orgName: string, userId: string, executionTarget: boolean
|
|
51
|
+
patchOrganizationExecutionTarget<R extends boolean = false>(orgName: string, userId: string, executionTarget: boolean, raw?: {
|
|
52
|
+
raw: R;
|
|
53
|
+
}): Promise<MaybeRaw<R, OrganizationMember>>;
|
|
46
54
|
/**
|
|
47
55
|
* Removes a Member from an Organization.
|
|
48
56
|
* @param orgName Name of the Organization
|
|
49
57
|
* @param userId ID of the User
|
|
50
58
|
*/
|
|
51
|
-
removeOrganizationMember(orgName: string, userId: string
|
|
59
|
+
removeOrganizationMember<R extends boolean = false>(orgName: string, userId: string, raw?: {
|
|
60
|
+
raw: R;
|
|
61
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
52
62
|
/**
|
|
53
63
|
* Member leaves the organization independently.
|
|
54
64
|
* @param orgName Name of the Organization
|
|
55
65
|
*/
|
|
56
|
-
leaveOrganization(orgName: string
|
|
66
|
+
leaveOrganization<R extends boolean = false>(orgName: string, raw?: {
|
|
67
|
+
raw: R;
|
|
68
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
57
69
|
protected getEndpoint(endpoint: string): string;
|
|
58
70
|
}
|