From 69fa3416a2d066b6df16089cb0c1d93bbd01ba2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E9=95=BF=E6=B1=9F?= Date: Sat, 22 Oct 2022 14:34:23 +0800 Subject: [PATCH] feat: regenerate new dtos --- authentication/authentication_client.go | 1396 +++++++++--------- dto/ApplicationBrandingConfig.go | 2 +- dto/ApplicationSimpleInfoPaginatedDataDto.go | 8 + dto/ApplicationSimpleInfoPaginatedRespDto.go | 11 + dto/AssociateTenantResourceDto.go | 10 + dto/AuthorizeApplicationAccessDto.go | 8 + dto/ChangeExtIdpAssociationStateDto.go | 9 + dto/ChangeExtIdpConnStateDto.go | 11 + dto/CostCurrentPackageInfo.go | 10 + dto/CostGetAllRightItemRespDto.go | 11 + dto/CostGetCurrentPackageRespDto.go | 11 + dto/CostGetCurrentUsageRespDto.go | 11 + dto/CostGetMauPeriodUsageHistoryRespDto.go | 11 + dto/CostGetOrderDetailRespDto.go | 11 + dto/CostGetOrderPayDetailRespDto.go | 18 + dto/CostGetOrdersRespDto.go | 11 + dto/CreateSyncTaskDto.go | 2 +- dto/CreateUserInfoDto.go | 5 +- dto/CreateUserOptionsDto.go | 1 + dto/CreateUserReqDto.go | 5 +- dto/CurrentUsageDto.go | 11 + dto/CurrentUsageRespDto.go | 7 + dto/EmailProviderRespDto.go | 11 + dto/FinishLoginParams.go | 6 + dto/GetMauPeriodUsageHistoryDto.go | 8 + dto/GetOrderDetailDto.go | 7 + dto/GetOrderPayDetailDto.go | 7 + dto/GetOrdersDto.go | 8 + dto/GetOrdersRes.go | 8 + dto/GetResourceAuthorizedTargetDataDto.go | 8 + dto/GetResourceAuthorizedTargetRespDto.go | 11 + dto/GetResourceAuthorizedTargetsDto.go | 11 + dto/GoodsPackageDto.go | 13 + dto/LangUnit.go | 2 +- dto/ListPipelineFunctionsDto.go | 7 + dto/ListTenantExtIdpDto.go | 4 +- dto/MauPeriodUsageHistory.go | 7 + dto/MauPeriodUsageHistoryDto.go | 10 + dto/OidcDiscoveryMetadata.go | 30 + dto/OrderItem.go | 16 + dto/PreviewEmailTemplateDto.go | 2 +- dto/ResourceAuthorizedTargetDto.go | 9 + dto/RevokeApplicationAccessDto.go | 8 + dto/RightItemDto.go | 10 + dto/RightItemRes.go | 7 + dto/SMTPEmailProviderConfig.go | 6 +- dto/SMTPEmailProviderConfigInput.go | 8 +- dto/SignInByApplePayloadDto.go | 7 + dto/SignInByWechatworkDto.go | 7 + dto/SigninByMobileDto.go | 3 +- dto/SignupDto.go | 6 +- dto/SignupOptionsDto.go | 2 +- dto/SignupProfileDto.go | 2 +- dto/SyncTaskDto.go | 2 +- dto/TokenEndPointParams.go | 13 + dto/TokenIntrospectEndpointParams.go | 9 + dto/TokenIntrospectResponse.go | 15 + dto/TokenRevocationEndpointParams.go | 9 + dto/UnlinkExtIdpDto.go | 7 + dto/UpdateGroupReqDto.go | 2 +- dto/UpdateUserInfoDto.go | 1 - dto/UpdateUserReqDto.go | 1 - dto/UserDto.go | 1 + dto/ValidatePEMKeyDto.go | 6 + dto/VerifyUpdateEmailRequestDto.go | 2 +- management/management_client.go | 1344 +++++++++-------- 66 files changed, 1843 insertions(+), 1400 deletions(-) create mode 100644 dto/ApplicationSimpleInfoPaginatedDataDto.go create mode 100644 dto/ApplicationSimpleInfoPaginatedRespDto.go create mode 100644 dto/AssociateTenantResourceDto.go create mode 100644 dto/AuthorizeApplicationAccessDto.go create mode 100644 dto/ChangeExtIdpAssociationStateDto.go create mode 100644 dto/ChangeExtIdpConnStateDto.go create mode 100644 dto/CostCurrentPackageInfo.go create mode 100644 dto/CostGetAllRightItemRespDto.go create mode 100644 dto/CostGetCurrentPackageRespDto.go create mode 100644 dto/CostGetCurrentUsageRespDto.go create mode 100644 dto/CostGetMauPeriodUsageHistoryRespDto.go create mode 100644 dto/CostGetOrderDetailRespDto.go create mode 100644 dto/CostGetOrderPayDetailRespDto.go create mode 100644 dto/CostGetOrdersRespDto.go create mode 100644 dto/CurrentUsageDto.go create mode 100644 dto/CurrentUsageRespDto.go create mode 100644 dto/EmailProviderRespDto.go create mode 100644 dto/FinishLoginParams.go create mode 100644 dto/GetMauPeriodUsageHistoryDto.go create mode 100644 dto/GetOrderDetailDto.go create mode 100644 dto/GetOrderPayDetailDto.go create mode 100644 dto/GetOrdersDto.go create mode 100644 dto/GetOrdersRes.go create mode 100644 dto/GetResourceAuthorizedTargetDataDto.go create mode 100644 dto/GetResourceAuthorizedTargetRespDto.go create mode 100644 dto/GetResourceAuthorizedTargetsDto.go create mode 100644 dto/GoodsPackageDto.go create mode 100644 dto/ListPipelineFunctionsDto.go create mode 100644 dto/MauPeriodUsageHistory.go create mode 100644 dto/MauPeriodUsageHistoryDto.go create mode 100644 dto/OidcDiscoveryMetadata.go create mode 100644 dto/OrderItem.go create mode 100644 dto/ResourceAuthorizedTargetDto.go create mode 100644 dto/RevokeApplicationAccessDto.go create mode 100644 dto/RightItemDto.go create mode 100644 dto/RightItemRes.go create mode 100644 dto/SignInByApplePayloadDto.go create mode 100644 dto/SignInByWechatworkDto.go create mode 100644 dto/TokenEndPointParams.go create mode 100644 dto/TokenIntrospectEndpointParams.go create mode 100644 dto/TokenIntrospectResponse.go create mode 100644 dto/TokenRevocationEndpointParams.go create mode 100644 dto/UnlinkExtIdpDto.go create mode 100644 dto/ValidatePEMKeyDto.go diff --git a/authentication/authentication_client.go b/authentication/authentication_client.go index 3b004c3..cdd10e1 100644 --- a/authentication/authentication_client.go +++ b/authentication/authentication_client.go @@ -886,32 +886,61 @@ func (client *AuthenticationClient) SignUpByUsernamePassword(username string, pa // ==== AUTO GENERATED AUTHENTICATION METHODS BEGIN ==== /* - * @summary 发起绑定 MFA 认证要素请求 - * @description 当用户未绑定某个 MFA 认证要素时,可以发起绑定 MFA 认证要素请求。不同类型的 MFA 认证要素绑定请求需要发送不同的参数,详细见 profile 参数。发起验证请求之后,Authing 服务器会根据相应的认证要素类型和传递的参数,使用不同的手段要求验证。此接口会返回 enrollmentToken,你需要在请求「绑定 MFA 认证要素」接口时带上此 enrollmentToken,并提供相应的凭证。 - * @returns SendEnrollFactorRequestRespDto - */ -func (client *AuthenticationClient) SendEnrollFactorRequest (reqDto *dto.SendEnrollFactorRequestDto) *dto.SendEnrollFactorRequestRespDto { - b, err := client.SendHttpRequest("/api/v3/send-enroll-factor-request", fasthttp.MethodPost, reqDto) - var response dto.SendEnrollFactorRequestRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) - if err != nil { - fmt.Println(err) - return nil - } - return &response -} -/* - * @summary 绑定 MFA 认证要素 - * @description 绑定 MFA 要素 - * @returns EnrollFactorRespDto - */ -func (client *AuthenticationClient) EnrollFactor (reqDto *dto.EnrollFactorDto) *dto.EnrollFactorRespDto { - b, err := client.SendHttpRequest("/api/v3/enroll-factor", fasthttp.MethodPost, reqDto) - var response dto.EnrollFactorRespDto + * @summary 使用用户凭证登录 + * @description + * 此端点为基于直接 API 调用形式的登录端点,适用于你需要自建登录页面的场景。**此端点暂时不支持 MFA、信息补全、首次密码重置等流程,如有需要,请使用 OIDC 标准协议认证端点。** + * + * + * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 + * + *
+ * 点击展开详情 + * + *
+ * + * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** + * 中找到**换取 token 身份验证方式** 配置项: + * + * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 + * + * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) + * + * #### 换取 token 身份验证方式为 none 时 + * + * 调用此接口不需要进行额外操作。 + * + * #### 换取 token 身份验证方式为 client_secret_post 时 + * + * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 + * + * #### 换取 token 身份验证方式为 client_secret_basic 时 + * + * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): + * + * ``` + * Basic base64(:) + * ``` + * + * 结果示例: + * + * ``` + * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 + * ``` + * + * JS 代码示例: + * + * ```js + * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); + * ``` + * + *
+ * + * + * @returns LoginTokenRespDto 成功认证 +*/ +func (client *AuthenticationClient) SignInByCredentials(reqDto *dto.SigninByCredentialsDto) *dto.LoginTokenRespDto { + b, err := client.SendHttpRequest("/api/v3/signin", fasthttp.MethodPost, reqDto) + var response dto.LoginTokenRespDto if err != nil { fmt.Println(err) return nil @@ -923,14 +952,63 @@ func (client *AuthenticationClient) EnrollFactor (reqDto *dto.EnrollFactorDto) * } return &response } + /* - * @summary 解绑 MFA 认证要素 - * @description 当前不支持通过此接口解绑短信、邮箱验证码类型的认证要素。如果需要,请调用「解绑邮箱」和「解绑手机号」接口。 - * @returns ResetFactorRespDto - */ -func (client *AuthenticationClient) ResetFactor (reqDto *dto.RestFactorDto) *dto.ResetFactorRespDto { - b, err := client.SendHttpRequest("/api/v3/reset-factor", fasthttp.MethodPost, reqDto) - var response dto.ResetFactorRespDto + * @summary 使用移动端社会化登录 + * @description + * 此端点为移动端社会化登录接口,使用第三方移动社会化登录返回的临时凭证登录,并换取用户的 `id_token` 和 `access_token`。请先阅读相应社会化登录的接入流程。 + * + * + * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 + * + *
+ * 点击展开详情 + * + *
+ * + * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** + * 中找到**换取 token 身份验证方式** 配置项: + * + * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 + * + * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) + * + * #### 换取 token 身份验证方式为 none 时 + * + * 调用此接口不需要进行额外操作。 + * + * #### 换取 token 身份验证方式为 client_secret_post 时 + * + * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 + * + * #### 换取 token 身份验证方式为 client_secret_basic 时 + * + * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): + * + * ``` + * Basic base64(:) + * ``` + * + * 结果示例: + * + * ``` + * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 + * ``` + * + * JS 代码示例: + * + * ```js + * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); + * ``` + * + *
+ * + * + * @returns LoginTokenRespDto +*/ +func (client *AuthenticationClient) SignInByMobile(reqDto *dto.SigninByMobileDto) *dto.LoginTokenRespDto { + b, err := client.SendHttpRequest("/api/v3/signin-by-mobile", fasthttp.MethodPost, reqDto) + var response dto.LoginTokenRespDto if err != nil { fmt.Println(err) return nil @@ -942,14 +1020,15 @@ func (client *AuthenticationClient) ResetFactor (reqDto *dto.RestFactorDto) *dto } return &response } + /* - * @summary 获取绑定的所有 MFA 认证要素 - * @description Authing 目前支持四种类型的 MFA 认证要素:手机短信、邮件验证码、OTP、人脸。如果用户绑定了手机号 / 邮箱之后,默认就具备了手机短信、邮箱验证码的 MFA 认证要素。 - * @returns ListEnrolledFactorsRespDto - */ -func (client *AuthenticationClient) ListEnrolledFactors () *dto.ListEnrolledFactorsRespDto { - b, err := client.SendHttpRequest("/api/v3/list-enrolled-factors", fasthttp.MethodGet, nil) - var response dto.ListEnrolledFactorsRespDto +* @summary 获取支付宝 AuthInfo +* @description 此接口用于获取发起支付宝认证需要的[初始化参数 AuthInfo](https://opendocs.alipay.com/open/218/105325)。 +* @returns GetAlipayAuthInfoRespDto + */ +func (client *AuthenticationClient) GetAlipayAuthInfo(reqDto *dto.GetAlipayAuthinfoDto) *dto.GetAlipayAuthInfoRespDto { + b, err := client.SendHttpRequest("/api/v3/get-alipay-authinfo", fasthttp.MethodGet, reqDto) + var response dto.GetAlipayAuthInfoRespDto if err != nil { fmt.Println(err) return nil @@ -961,14 +1040,15 @@ func (client *AuthenticationClient) ListEnrolledFactors () *dto.ListEnrolledFact } return &response } + /* - * @summary 获取绑定的某个 MFA 认证要素 - * @description 根据 Factor ID 获取用户绑定的某个 MFA Factor 详情。 - * @returns GetFactorRespDto - */ -func (client *AuthenticationClient) GetFactor (reqDto *dto.GetFactorDto) *dto.GetFactorRespDto { - b, err := client.SendHttpRequest("/api/v3/get-factor", fasthttp.MethodGet, reqDto) - var response dto.GetFactorRespDto +* @summary 生成用于登录的二维码 +* @description 生成用于登录的二维码,目前支持生成微信公众号扫码登录、小程序扫码登录、自建移动 APP 扫码登录的二维码。 +* @returns GeneQRCodeRespDto + */ +func (client *AuthenticationClient) GeneQrCode(reqDto *dto.GenerateQrcodeDto) *dto.GeneQRCodeRespDto { + b, err := client.SendHttpRequest("/api/v3/gene-qrcode", fasthttp.MethodPost, reqDto) + var response dto.GeneQRCodeRespDto if err != nil { fmt.Println(err) return nil @@ -980,14 +1060,15 @@ func (client *AuthenticationClient) GetFactor (reqDto *dto.GetFactorDto) *dto.Ge } return &response } + /* - * @summary 获取可绑定的 MFA 认证要素 - * @description 获取所有应用已经开启、用户暂未绑定的 MFA 认证要素,用户可以从返回的列表中绑定新的 MFA 认证要素。 - * @returns ListFactorsToEnrollRespDto - */ -func (client *AuthenticationClient) ListFactorsToEnroll () *dto.ListFactorsToEnrollRespDto { - b, err := client.SendHttpRequest("/api/v3/list-factors-to-enroll", fasthttp.MethodGet, nil) - var response dto.ListFactorsToEnrollRespDto +* @summary 查询二维码状态 +* @description 按照用户扫码顺序,共分为未扫码、已扫码等待用户确认、用户同意/取消授权、二维码过期以及未知错误六种状态,前端应该通过不同的状态给到用户不同的反馈。你可以通过下面这篇文章了解扫码登录详细的流程:https://docs.authing.cn/v2/concepts/how-qrcode-works.html. +* @returns CheckQRCodeStatusRespDto + */ +func (client *AuthenticationClient) CheckQrCodeStatus(reqDto *dto.CheckQrcodeStatusDto) *dto.CheckQRCodeStatusRespDto { + b, err := client.SendHttpRequest("/api/v3/check-qrcode-status", fasthttp.MethodGet, reqDto) + var response dto.CheckQRCodeStatusRespDto if err != nil { fmt.Println(err) return nil @@ -999,173 +1080,63 @@ func (client *AuthenticationClient) ListFactorsToEnroll () *dto.ListFactorsToEnr } return &response } + /* - * @summary 绑定外部身份源 - * @description - * - * 由于绝大多数的外部身份源登录不允许在第三方系统直接输入账号密码进行登录,所以外部身份源的绑定总是需要先跳转到对方的登录页面进行认证。此端点会通过浏览器 `302` 跳转的方式先跳转到第三方的登录页面, - * 终端用户在第三方系统认证完成之后,浏览器再会跳转到 Authing 服务器,Authing 服务器会将此外部身份源绑定到该用户身上。最终的结果会通过浏览器 Window Post Message 的方式传递给开发者。 - * 你可以在你的应用系统中放置一个按钮,引导用户点击之后,弹出一个 Window Popup,地址为此端点,当用户在第三方身份源认证完成之后,此 Popup 会通过 Window Post Message 的方式传递给父窗口。 - * - * 为此我们在 `@authing/browser` SDK 中封装了相关方法,为开发者省去了其中大量的细节: - * - * ```typescript - * import { Authing } from "@authing/browser" - * const sdk = new Authing({ - * // 应用的认证地址,例如:https://domain.authing.cn - * domain: "", - * - * // Authing 应用 ID - * appId: "you_authing_app_id", - * - * // 登录回调地址,需要在控制台『应用配置 - 登录回调 URL』中指定 - * redirectUri: "your_redirect_uri" - * }); - * - * - * // success 表示此次绑定操作是否成功; - * // errMsg 为如果绑定失败,具体的失败原因,如此身份源已被其他账号绑定等。 - * // identities 为此次绑定操作具体绑定的第三方身份信息 - * const { success, errMsg, identities } = await sdk.bindExtIdpWithPopup({ - * "extIdpConnIdentifier": "my-wechat" - * }) - * + * @summary 使用二维码 ticket 换取 TokenSet + * @description + * 此端点为使用二维码的 ticket 换取用户的 `access_token` 和 `id_token`。 + * + * + * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 + * + *
+ * 点击展开详情 + * + *
+ * + * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** + * 中找到**换取 token 身份验证方式** 配置项: + * + * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 + * + * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) + * + * #### 换取 token 身份验证方式为 none 时 + * + * 调用此接口不需要进行额外操作。 + * + * #### 换取 token 身份验证方式为 client_secret_post 时 + * + * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 + * + * #### 换取 token 身份验证方式为 client_secret_basic 时 + * + * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): + * * ``` - * - * 绑定外部身份源成功之后,你可以得到用户在此第三方身份源的信息,以绑定飞书账号为例: - * - * ```json - * [ - * { - * "identityId": "62f20932xxxxbcc10d966ee5", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "lark", - * "type": "open_id", - * "userIdInIdp": "ou_8bae746eac07cd2564654140d2a9ac61", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * }, - * { - * "identityId": "62f726239xxxxe3285d21c93", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "lark", - * "type": "union_id", - * "userIdInIdp": "on_093ce5023288856aa0abe4099123b18b", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * }, - * { - * "identityId": "62f72623e011cf10c8851e4c", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "lark", - * "type": "user_id", - * "userIdInIdp": "23ded785", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * } - * ] + * Basic base64(:) * ``` - * - * 可以看到,我们获取到了用户在飞书中的身份信息: - * - * - `open_id`: ou_8bae746eac07cd2564654140d2a9ac61 - * - `union_id`: on_093ce5023288856aa0abe4099123b18b - * - `user_id`: 23ded785 - * - * 绑定此外部身份源之后,后续用户就可以使用此身份源进行登录了,见**登录**接口。 - * - * - * @returns GenerateBindExtIdpLinkRespDto - */ -func (client *AuthenticationClient) LinkExtIdp (reqDto *dto.LinkExtidpDto) *dto.GenerateBindExtIdpLinkRespDto { - b, err := client.SendHttpRequest("/api/v3/link-extidp", fasthttp.MethodGet, reqDto) - var response dto.GenerateBindExtIdpLinkRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) - if err != nil { - fmt.Println(err) - return nil - } - return &response -} -/* - * @summary 生成绑定外部身份源的链接 - * @description - * - * 由于绝大多数的外部身份源登录不允许在第三方系统直接输入账号密码进行登录,所以外部身份源的绑定总是需要先跳转到对方的登录页面进行认证。此端点会通过浏览器 `302` 跳转的方式先跳转到第三方的登录页面, - * 终端用户在第三方系统认证完成之后,浏览器再会跳转到 Authing 服务器,Authing 服务器会将此外部身份源绑定到该用户身上。最终的结果会通过浏览器 Window Post Message 的方式传递给开发者。 - * 你可以在你的应用系统中放置一个按钮,引导用户点击之后,弹出一个 Window Popup,地址为此端点,当用户在第三方身份源认证完成之后,此 Popup 会通过 Window Post Message 的方式传递给父窗口。 - * - * 为此我们在 `@authing/browser` SDK 中封装了相关方法,为开发者省去了其中大量的细节: - * - * ```typescript - * import { Authing } from "@authing/browser" - * const sdk = new Authing({ - * // 应用的认证地址,例如:https://domain.authing.cn - * domain: "", - * - * // Authing 应用 ID - * appId: "you_authing_app_id", - * - * // 登录回调地址,需要在控制台『应用配置 - 登录回调 URL』中指定 - * redirectUri: "your_redirect_uri" - * }); - * - * - * // success 表示此次绑定操作是否成功; - * // errMsg 为如果绑定失败,具体的失败原因,如此身份源已被其他账号绑定等。 - * // identities 为此次绑定操作具体绑定的第三方身份信息 - * const { success, errMsg, identities } = await sdk.bindExtIdpWithPopup({ - * "extIdpConnIdentifier": "my-wechat" - * }) - * + * + * 结果示例: + * * ``` - * - * 绑定外部身份源成功之后,你可以得到用户在此第三方身份源的信息,以绑定飞书账号为例: - * - * ```json - * [ - * { - * "identityId": "62f20932xxxxbcc10d966ee5", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "lark", - * "type": "open_id", - * "userIdInIdp": "ou_8bae746eac07cd2564654140d2a9ac61", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * }, - * { - * "identityId": "62f726239xxxxe3285d21c93", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "lark", - * "type": "union_id", - * "userIdInIdp": "on_093ce5023288856aa0abe4099123b18b", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * }, - * { - * "identityId": "62f72623e011cf10c8851e4c", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "lark", - * "type": "user_id", - * "userIdInIdp": "23ded785", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * } - * ] + * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 * ``` - * - * 可以看到,我们获取到了用户在飞书中的身份信息: - * - * - `open_id`: ou_8bae746eac07cd2564654140d2a9ac61 - * - `union_id`: on_093ce5023288856aa0abe4099123b18b - * - `user_id`: 23ded785 - * - * 绑定此外部身份源之后,后续用户就可以使用此身份源进行登录了,见**登录**接口。 - * - * - * @returns GenerateBindExtIdpLinkRespDto - */ -func (client *AuthenticationClient) GenerateLinkExtIdpUrl (reqDto *dto.GenerateLinkExtidpUrlDto) *dto.GenerateBindExtIdpLinkRespDto { - b, err := client.SendHttpRequest("/api/v3/generate-link-extidp-url", fasthttp.MethodGet, reqDto) - var response dto.GenerateBindExtIdpLinkRespDto + * + * JS 代码示例: + * + * ```js + * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); + * ``` + * + *
+ * + * + * @returns LoginTokenRespDto +*/ +func (client *AuthenticationClient) ExchangeTokenSetWithQrCodeTicket(reqDto *dto.ExchangeTokenSetWithQRcodeTicketDto) *dto.LoginTokenRespDto { + b, err := client.SendHttpRequest("/api/v3/exchange-tokenset-with-qrcode-ticket", fasthttp.MethodPost, reqDto) + var response dto.LoginTokenRespDto if err != nil { fmt.Println(err) return nil @@ -1177,13 +1148,14 @@ func (client *AuthenticationClient) GenerateLinkExtIdpUrl (reqDto *dto.GenerateL } return &response } + /* - * @summary 解绑外部身份源 - * @description 解绑外部身份源,此接口需要传递用户绑定的外部身份源 ID,**注意不是身份源连接 ID**。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) UnbindExtIdp (reqDto *dto.UnbindExtIdpDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/unlink-extidp", fasthttp.MethodPost, reqDto) +* @summary 自建 APP 扫码登录:APP 端修改二维码状态 +* @description 此端点用于在自建 APP 扫码登录中修改二维码状态,对应着在浏览器渲染出二维码之后,终端用户扫码、确认授权、取消授权的过程。**此接口要求具备用户的登录态**。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) ChangeQrCodeStatus(reqDto *dto.ChangeQRCodeStatusDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/change-qrcode-status", fasthttp.MethodPost, reqDto) var response dto.CommonResponseDto if err != nil { fmt.Println(err) @@ -1196,49 +1168,15 @@ func (client *AuthenticationClient) UnbindExtIdp (reqDto *dto.UnbindExtIdpDto) * } return &response } + /* - * @summary 获取绑定的外部身份源 - * @description - * 如在**介绍**部分中所描述的,一个外部身份源对应多个外部身份源连接,用户通过某个外部身份源连接绑定了某个外部身份源账号之后, - * 用户会建立一条与此外部身份源之间的关联关系。此接口用于获取此用户绑定的所有外部身份源。 - * - * 取决于外部身份源的具体实现,一个用户在外部身份源中,可能会有多个身份 ID,比如在微信体系中会有 `openid` 和 `unionid`,在非书中有 - * `open_id`、`union_id` 和 `user_id`。在 Authing 中,我们把这样的一条 `open_id` 或者 `unionid_` 叫做一条 `Identity`, 所以用户在一个身份源会有多条 `Identity` 记录。 - * - * 以微信为例,如果用户使用微信登录或者绑定了微信账号,他的 `Identity` 信息如下所示: - * - * ```json - * [ - * { - * "identityId": "62f20932xxxxbcc10d966ee5", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "wechat", - * "type": "openid", - * "userIdInIdp": "oH_5k5SflrwjGvk7wqpoBKq_cc6M", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * }, - * { - * "identityId": "62f726239xxxxe3285d21c93", - * "extIdpId": "62f209327xxxxcc10d966ee5", - * "provider": "wechat", - * "type": "unionid", - * "userIdInIdp": "o9Nka5ibU-lUGQaeAHqu0nOZyJg0", - * "originConnIds": ["62f2093244fa5cb19ff21ed3"] - * } - * ] - * ``` - * - * - * 可以看到他们的 `extIdpId` 是一样的,这个是你在 Authing 中创建的**身份源 ID**;`provider` 都是 `wechat`; - * 通过 `type` 可以区分出哪个是 `openid`,哪个是 `unionid`,以及具体的值(`userIdInIdp`);他们都来自于同一个身份源连接(`originConnIds`)。 - * - * - * - * @returns GetIdentitiesRespDto - */ -func (client *AuthenticationClient) GetIdentities () *dto.GetIdentitiesRespDto { - b, err := client.SendHttpRequest("/api/v3/get-identities", fasthttp.MethodGet, nil) - var response dto.GetIdentitiesRespDto +* @summary 发送短信 +* @description 发送短信时必须指定短信 Channel,每个手机号同一 Channel 在一分钟内只能发送一次。 +* @returns SendSMSRespDto + */ +func (client *AuthenticationClient) SendSms(reqDto *dto.SendSMSDto) *dto.SendSMSRespDto { + b, err := client.SendHttpRequest("/api/v3/send-sms", fasthttp.MethodPost, reqDto) + var response dto.SendSMSRespDto if err != nil { fmt.Println(err) return nil @@ -1250,14 +1188,15 @@ func (client *AuthenticationClient) GetIdentities () *dto.GetIdentitiesRespDto } return &response } + /* - * @summary 获取应用开启的外部身份源列表 - * @description 获取应用开启的外部身份源列表,前端可以基于此渲染外部身份源按钮。 - * @returns GetExtIdpsRespDto - */ -func (client *AuthenticationClient) GetExtIdps () *dto.GetExtIdpsRespDto { - b, err := client.SendHttpRequest("/api/v3/get-extidps", fasthttp.MethodGet, nil) - var response dto.GetExtIdpsRespDto +* @summary 发送邮件 +* @description 发送邮件时必须指定邮件 Channel,每个邮箱同一 Channel 在一分钟内只能发送一次。 +* @returns SendEmailRespDto + */ +func (client *AuthenticationClient) SendEmail(reqDto *dto.SendEmailDto) *dto.SendEmailRespDto { + b, err := client.SendHttpRequest("/api/v3/send-email", fasthttp.MethodPost, reqDto) + var response dto.SendEmailRespDto if err != nil { fmt.Println(err) return nil @@ -1269,20 +1208,14 @@ func (client *AuthenticationClient) GetExtIdps () *dto.GetExtIdpsRespDto { } return &response } + /* - * @summary 注册 - * @description - * 此端点目前支持以下几种基于的注册方式: - * - * 1. 基于密码(PASSWORD):用户名 + 密码,邮箱 + 密码。 - * 2. 基于一次性临时验证码(PASSCODE):手机号 + 验证码,邮箱 + 验证码。你需要先调用发送短信或者发送邮件接口获取验证码。 - * - * 社会化登录等使用外部身份源“注册”请直接使用**登录**接口,我们会在其第一次登录的时候为其创建一个新账号。 - * - * @returns UserSingleRespDto - */ -func (client *AuthenticationClient) SignUp (reqDto *dto.SignupDto) *dto.UserSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/signup", fasthttp.MethodPost, reqDto) +* @summary 获取用户资料 +* @description 此端点用户获取用户资料,需要在请求头中带上用户的 `access_token`,Authing 服务器会根据用户 `access_token` 中的 `scope` 返回对应的字段。 +* @returns UserSingleRespDto + */ +func (client *AuthenticationClient) GetProfile(reqDto *dto.GetProfileDto) *dto.UserSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/get-profile", fasthttp.MethodGet, reqDto) var response dto.UserSingleRespDto if err != nil { fmt.Println(err) @@ -1295,31 +1228,15 @@ func (client *AuthenticationClient) SignUp (reqDto *dto.SignupDto) *dto.UserSing } return &response } + /* - * @summary 解密微信小程序数据 - * @returns DecryptWechatMiniProgramDataRespDto - */ -func (client *AuthenticationClient) DecryptWechatMiniProgramData (reqDto *dto.DecryptWechatMiniProgramDataDto) *dto.DecryptWechatMiniProgramDataRespDto { - b, err := client.SendHttpRequest("/api/v3/decrypt-wechat-miniprogram-data", fasthttp.MethodPost, reqDto) - var response dto.DecryptWechatMiniProgramDataRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) - if err != nil { - fmt.Println(err) - return nil - } - return &response -} -/* - * @summary 获取小程序的手机号 - * @returns GetWechatMiniProgramPhoneRespDto - */ -func (client *AuthenticationClient) GetWechatMiniprogramPhone (reqDto *dto.GetWechatMiniProgramPhoneDto) *dto.GetWechatMiniProgramPhoneRespDto { - b, err := client.SendHttpRequest("/api/v3/get-wechat-miniprogram-phone", fasthttp.MethodPost, reqDto) - var response dto.GetWechatMiniProgramPhoneRespDto +* @summary 修改用户资料 +* @description 此接口用于修改用户的用户资料,包含用户的自定义数据。如果需要**修改邮箱**、**修改手机号**、**修改密码**,请使用对应的单独接口。 +* @returns UserSingleRespDto + */ +func (client *AuthenticationClient) UpdateProfile(reqDto *dto.UpdateUserProfileDto) *dto.UserSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/update-profile", fasthttp.MethodPost, reqDto) + var response dto.UserSingleRespDto if err != nil { fmt.Println(err) return nil @@ -1331,13 +1248,15 @@ func (client *AuthenticationClient) GetWechatMiniprogramPhone (reqDto *dto.GetWe } return &response } + /* - * @summary 获取 Authing 服务器缓存的微信小程序、公众号 Access Token - * @returns GetWechatAccessTokenRespDto - */ -func (client *AuthenticationClient) GetWechatMpAccessToken (reqDto *dto.GetWechatAccessTokenDto) *dto.GetWechatAccessTokenRespDto { - b, err := client.SendHttpRequest("/api/v3/get-wechat-access-token", fasthttp.MethodPost, reqDto) - var response dto.GetWechatAccessTokenRespDto +* @summary 绑定邮箱 +* @description 如果用户还**没有绑定邮箱**,此接口可用于用户**自主**绑定邮箱。如果用户已经绑定邮箱想要修改邮箱,请使用**修改邮箱**接口。你需要先调用**发送邮件**接口发送邮箱验证码。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) BindEmail(reqDto *dto.BindEmailDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/bind-email", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) return nil @@ -1349,14 +1268,15 @@ func (client *AuthenticationClient) GetWechatMpAccessToken (reqDto *dto.GetWecha } return &response } + /* - * @summary 获取登录日志 - * @description 获取登录日志 - * @returns GetLoginHistoryRespDto - */ -func (client *AuthenticationClient) GetLoginHistory (reqDto *dto.GetMyLoginHistoryDto) *dto.GetLoginHistoryRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-login-history", fasthttp.MethodGet, reqDto) - var response dto.GetLoginHistoryRespDto +* @summary 解绑邮箱 +* @description 用户解绑邮箱,如果用户没有绑定其他登录方式(手机号、社会化登录账号),将无法解绑邮箱,会提示错误。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) UnbindEmail(reqDto *dto.UnbindEmailDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/unbind-email", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) return nil @@ -1368,14 +1288,15 @@ func (client *AuthenticationClient) GetLoginHistory (reqDto *dto.GetMyLoginHisto } return &response } + /* - * @summary 获取登录应用 - * @description 获取登录应用 - * @returns GetLoggedInAppsRespDto - */ -func (client *AuthenticationClient) GetLoggedInApps () *dto.GetLoggedInAppsRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-logged-in-apps", fasthttp.MethodGet, nil) - var response dto.GetLoggedInAppsRespDto +* @summary 绑定手机号 +* @description 如果用户还**没有绑定手机号**,此接口可用于用户**自主**绑定手机号。如果用户已经绑定手机号想要修改手机号,请使用**修改手机号**接口。你需要先调用**发送短信**接口发送短信验证码。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) BindPhone(reqDto *dto.BindPhoneDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/bind-phone", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) return nil @@ -1387,14 +1308,15 @@ func (client *AuthenticationClient) GetLoggedInApps () *dto.GetLoggedInAppsRespD } return &response } + /* - * @summary 获取具备访问权限的应用 - * @description 获取具备访问权限的应用 - * @returns GetAccessibleAppsRespDto - */ -func (client *AuthenticationClient) GetAccessibleApps () *dto.GetAccessibleAppsRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-accessible-apps", fasthttp.MethodGet, nil) - var response dto.GetAccessibleAppsRespDto +* @summary 解绑手机号 +* @description 用户解绑手机号,如果用户没有绑定其他登录方式(邮箱、社会化登录账号),将无法解绑手机号,会提示错误。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) UnbindPhone(reqDto *dto.UnbindPhoneDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/unbind-phone", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) return nil @@ -1406,14 +1328,15 @@ func (client *AuthenticationClient) GetAccessibleApps () *dto.GetAccessibleAppsR } return &response } + /* - * @summary 获取租户列表 - * @description 获取租户列表 - * @returns GetTenantListRespDto - */ -func (client *AuthenticationClient) GetTenantList () *dto.GetTenantListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-tenant-list", fasthttp.MethodGet, nil) - var response dto.GetTenantListRespDto +* @summary 获取密码强度和账号安全等级评分 +* @description 获取用户的密码强度和账号安全等级评分,需要在请求头中带上用户的 `access_token`。 +* @returns GetSecurityInfoRespDto + */ +func (client *AuthenticationClient) GetSecurityLevel() *dto.GetSecurityInfoRespDto { + b, err := client.SendHttpRequest("/api/v3/get-security-info", fasthttp.MethodGet, nil) + var response dto.GetSecurityInfoRespDto if err != nil { fmt.Println(err) return nil @@ -1425,14 +1348,15 @@ func (client *AuthenticationClient) GetTenantList () *dto.GetTenantListRespDto } return &response } + /* - * @summary 获取角色列表 - * @description 获取角色列表 - * @returns RoleListRespDto - */ -func (client *AuthenticationClient) GetRoleList (reqDto *dto.GetMyRoleListDto) *dto.RoleListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-role-list", fasthttp.MethodGet, reqDto) - var response dto.RoleListRespDto +* @summary 修改密码 +* @description 此端点用于用户自主修改密码,如果用户之前已经设置密码,需要提供用户的原始密码作为凭证。如果用户忘记了当前密码,请使用**忘记密码**接口。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) UpdatePassword(reqDto *dto.UpdatePasswordDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/update-password", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) return nil @@ -1444,14 +1368,15 @@ func (client *AuthenticationClient) GetRoleList (reqDto *dto.GetMyRoleListDto) * } return &response } + /* - * @summary 获取分组列表 - * @description 获取分组列表 - * @returns GroupListRespDto - */ -func (client *AuthenticationClient) GetGroupList () *dto.GroupListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-group-list", fasthttp.MethodGet, nil) - var response dto.GroupListRespDto +* @summary 发起修改邮箱的验证请求 +* @description 终端用户自主修改邮箱时,需要提供相应的验证手段。此接口用于验证用户的修改邮箱请求是否合法。当前支持通过**邮箱验证码**的方式进行验证,你需要先调用发送邮件接口发送对应的邮件验证码。 +* @returns VerifyUpdateEmailRequestRespDto + */ +func (client *AuthenticationClient) VerifyUpdateEmailRequest(reqDto *dto.VerifyUpdateEmailRequestDto) *dto.VerifyUpdateEmailRequestRespDto { + b, err := client.SendHttpRequest("/api/v3/verify-update-email-request", fasthttp.MethodPost, reqDto) + var response dto.VerifyUpdateEmailRequestRespDto if err != nil { fmt.Println(err) return nil @@ -1463,14 +1388,16 @@ func (client *AuthenticationClient) GetGroupList () *dto.GroupListRespDto { } return &response } + /* - * @summary 获取部门列表 - * @description 此接口用于获取用户的部门列表,可根据一定排序规则进行排序。 - * @returns UserDepartmentPaginatedRespDto - */ -func (client *AuthenticationClient) GetDepartmentList (reqDto *dto.GetMyDepartmentListDto) *dto.UserDepartmentPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-department-list", fasthttp.MethodGet, reqDto) - var response dto.UserDepartmentPaginatedRespDto + * @summary 修改邮箱 + * @description 终端用户自主修改邮箱,需要提供相应的验证手段,见[发起修改邮箱的验证请求](#tag/用户资料/修改邮箱/operation/ProfileV3Controller_updateEmailVerification)。 + * 此参数需要提供一次性临时凭证 `updateEmailToken`,此数据需要从**发起修改邮箱的验证请求**接口获取。 + * @returns CommonResponseDto +*/ +func (client *AuthenticationClient) UpdateEmail(reqDto *dto.UpdateEmailDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/update-email", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) return nil @@ -1482,14 +1409,15 @@ func (client *AuthenticationClient) GetDepartmentList (reqDto *dto.GetMyDepartme } return &response } + /* - * @summary 获取被授权的资源列表 - * @description 此接口用于获取用户被授权的资源列表。 - * @returns AuthorizedResourcePaginatedRespDto - */ -func (client *AuthenticationClient) GetAuthorizedResources (reqDto *dto.GetMyAuthorizedResourcesDto) *dto.AuthorizedResourcePaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/get-my-authorized-resources", fasthttp.MethodGet, reqDto) - var response dto.AuthorizedResourcePaginatedRespDto +* @summary 发起修改手机号的验证请求 +* @description 终端用户自主修改手机号时,需要提供相应的验证手段。此接口用于验证用户的修改手机号请求是否合法。当前支持通过**短信验证码**的方式进行验证,你需要先调用发送短信接口发送对应的短信验证码。 +* @returns VerifyUpdatePhoneRequestRespDto + */ +func (client *AuthenticationClient) VerifyUpdatePhoneRequest(reqDto *dto.VerifyUpdatePhoneRequestDto) *dto.VerifyUpdatePhoneRequestRespDto { + b, err := client.SendHttpRequest("/api/v3/verify-update-phone-request", fasthttp.MethodPost, reqDto) + var response dto.VerifyUpdatePhoneRequestRespDto if err != nil { fmt.Println(err) return nil @@ -1501,80 +1429,36 @@ func (client *AuthenticationClient) GetAuthorizedResources (reqDto *dto.GetMyAut } return &response } + /* - * @summary 文件上传 - * @returns UploadRespDto - */ -func (client *AuthenticationClient) Upload (reqDto *dto.UploadDto) *dto.UploadRespDto { - b, err := client.SendHttpRequest("/api/v2/upload", fasthttp.MethodPost, reqDto) - var response dto.UploadRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) + * @summary 修改手机号 + * @description 终端用户自主修改手机号,需要提供相应的验证手段,见[发起修改手机号的验证请求](#tag/用户资料/修改邮箱/operation/ProfileV3Controller_updatePhoneVerification)。 + * 此参数需要提供一次性临时凭证 `updatePhoneToken`,此数据需要从**发起修改手机号的验证请求**接口获取。 + * @returns CommonResponseDto +*/ +func (client *AuthenticationClient) UpdatePhone(reqDto *dto.UpdatePhoneDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/update-phone", fasthttp.MethodPost, reqDto) + var response dto.CommonResponseDto if err != nil { fmt.Println(err) - return nil - } - return &response -} -/* - * @summary 使用用户凭证登录 - * @description - * 此端点为基于直接 API 调用形式的登录端点,适用于你需要自建登录页面的场景。**此端点暂时不支持 MFA、信息补全、首次密码重置等流程,如有需要,请使用 OIDC 标准协议认证端点。** - * - * - * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 - * - *
- * 点击展开详情 - * - *
- * - * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** - * 中找到**换取 token 身份验证方式** 配置项: - * - * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 - * - * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) - * - * #### 换取 token 身份验证方式为 none 时 - * - * 调用此接口不需要进行额外操作。 - * - * #### 换取 token 身份验证方式为 client_secret_post 时 - * - * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 - * - * #### 换取 token 身份验证方式为 client_secret_basic 时 - * - * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): - * - * ``` - * Basic base64(:) - * ``` - * - * 结果示例: - * - * ``` - * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 - * ``` - * - * JS 代码示例: - * - * ```js - * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); - * ``` - * - *
- * - * - * @returns LoginTokenRespDto 成功认证 - */ -func (client *AuthenticationClient) SignInByCredentials (reqDto *dto.SigninByCredentialsDto) *dto.LoginTokenRespDto { - b, err := client.SendHttpRequest("/api/v3/signin", fasthttp.MethodPost, reqDto) - var response dto.LoginTokenRespDto + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* +* @summary 发起忘记密码请求 +* @description 当用户忘记密码时,可以通过此端点找回密码。用户需要使用相关验证手段进行验证,目前支持**邮箱验证码**和**手机号验证码**两种验证手段。 +* @returns PasswordResetVerifyResp + */ +func (client *AuthenticationClient) VerifyResetPasswordRequest(reqDto *dto.VerifyResetPasswordRequestDto) *dto.PasswordResetVerifyResp { + b, err := client.SendHttpRequest("/api/v3/verify-reset-password-request", fasthttp.MethodPost, reqDto) + var response dto.PasswordResetVerifyResp if err != nil { fmt.Println(err) return nil @@ -1586,62 +1470,15 @@ func (client *AuthenticationClient) SignInByCredentials (reqDto *dto.SigninByCre } return &response } + /* - * @summary 使用移动端社会化登录 - * @description - * 此端点为移动端社会化登录接口,使用第三方移动社会化登录返回的临时凭证登录,并换取用户的 `id_token` 和 `access_token`。请先阅读相应社会化登录的接入流程。 - * - * - * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 - * - *
- * 点击展开详情 - * - *
- * - * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** - * 中找到**换取 token 身份验证方式** 配置项: - * - * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 - * - * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) - * - * #### 换取 token 身份验证方式为 none 时 - * - * 调用此接口不需要进行额外操作。 - * - * #### 换取 token 身份验证方式为 client_secret_post 时 - * - * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 - * - * #### 换取 token 身份验证方式为 client_secret_basic 时 - * - * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): - * - * ``` - * Basic base64(:) - * ``` - * - * 结果示例: - * - * ``` - * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 - * ``` - * - * JS 代码示例: - * - * ```js - * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); - * ``` - * - *
- * - * - * @returns LoginTokenRespDto - */ -func (client *AuthenticationClient) SignInByMobile (reqDto *dto.SigninByMobileDto) *dto.LoginTokenRespDto { - b, err := client.SendHttpRequest("/api/v3/signin-by-mobile", fasthttp.MethodPost, reqDto) - var response dto.LoginTokenRespDto +* @summary 忘记密码 +* @description 此端点用于用户忘记密码之后,通过**手机号验证码**或者**邮箱验证码**的方式重置密码。此接口需要提供用于重置密码的临时凭证 `passwordResetToken`,此参数需要通过**发起忘记密码请求**接口获取。 +* @returns IsSuccessRespDto + */ +func (client *AuthenticationClient) ResetPassword(reqDto *dto.ResetPasswordDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/reset-password", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) return nil @@ -1653,14 +1490,15 @@ func (client *AuthenticationClient) SignInByMobile (reqDto *dto.SigninByMobileDt } return &response } + /* - * @summary 获取支付宝 AuthInfo - * @description 此接口用于获取发起支付宝认证需要的[初始化参数 AuthInfo](https://opendocs.alipay.com/open/218/105325)。 - * @returns GetAlipayAuthInfoRespDto - */ -func (client *AuthenticationClient) GetAlipayAuthInfo (reqDto *dto.GetAlipayAuthinfoDto) *dto.GetAlipayAuthInfoRespDto { - b, err := client.SendHttpRequest("/api/v3/get-alipay-authinfo", fasthttp.MethodGet, reqDto) - var response dto.GetAlipayAuthInfoRespDto +* @summary 发起注销账号请求 +* @description 当用户希望注销账号时,需提供相应凭证,当前支持**使用邮箱验证码**、使用**手机验证码**、**使用密码**三种验证方式。 +* @returns VerifyDeleteAccountRequestRespDto + */ +func (client *AuthenticationClient) VerifyDeleteAccountRequest(reqDto *dto.VerifyDeleteAccountRequestDto) *dto.VerifyDeleteAccountRequestRespDto { + b, err := client.SendHttpRequest("/api/v3/verify-delete-account-request", fasthttp.MethodPost, reqDto) + var response dto.VerifyDeleteAccountRequestRespDto if err != nil { fmt.Println(err) return nil @@ -1672,14 +1510,15 @@ func (client *AuthenticationClient) GetAlipayAuthInfo (reqDto *dto.GetAlipayAuth } return &response } + /* - * @summary 生成用于登录的二维码 - * @description 生成用于登录的二维码,目前支持生成微信公众号扫码登录、小程序扫码登录、自建移动 APP 扫码登录的二维码。 - * @returns GeneQRCodeRespDto - */ -func (client *AuthenticationClient) GeneQrCode (reqDto *dto.GenerateQrcodeDto) *dto.GeneQRCodeRespDto { - b, err := client.SendHttpRequest("/api/v3/gene-qrcode", fasthttp.MethodPost, reqDto) - var response dto.GeneQRCodeRespDto +* @summary 注销账户 +* @description 此端点用于用户自主注销账号,需要提供用于注销账号的临时凭证 deleteAccountToken,此参数需要通过**发起注销账号请求**接口获取。 +* @returns IsSuccessRespDto + */ +func (client *AuthenticationClient) DeleteAccount(reqDto *dto.DeleteAccounDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/delete-account", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) return nil @@ -1691,14 +1530,15 @@ func (client *AuthenticationClient) GeneQrCode (reqDto *dto.GenerateQrcodeDto) * } return &response } + /* - * @summary 查询二维码状态 - * @description 按照用户扫码顺序,共分为未扫码、已扫码等待用户确认、用户同意/取消授权、二维码过期以及未知错误六种状态,前端应该通过不同的状态给到用户不同的反馈。你可以通过下面这篇文章了解扫码登录详细的流程:https://docs.authing.cn/v2/concepts/how-qrcode-works.html. - * @returns CheckQRCodeStatusRespDto - */ -func (client *AuthenticationClient) CheckQrCodeStatus (reqDto *dto.CheckQrcodeStatusDto) *dto.CheckQRCodeStatusRespDto { - b, err := client.SendHttpRequest("/api/v3/check-qrcode-status", fasthttp.MethodGet, reqDto) - var response dto.CheckQRCodeStatusRespDto +* @summary 获取服务器公开信息 +* @description 可端点可获取服务器的公开信息,如 RSA256 公钥、SM2 公钥、Authing 服务版本号等。 +* @returns SystemInfoResp + */ +func (client *AuthenticationClient) GetSystemInfo() *dto.SystemInfoResp { + b, err := client.SendHttpRequest("/api/v3/system", fasthttp.MethodGet, nil) + var response dto.SystemInfoResp if err != nil { fmt.Println(err) return nil @@ -1710,62 +1550,15 @@ func (client *AuthenticationClient) CheckQrCodeStatus (reqDto *dto.CheckQrcodeSt } return &response } + /* - * @summary 使用二维码 ticket 换取 TokenSet - * @description - * 此端点为使用二维码的 ticket 换取用户的 `access_token` 和 `id_token`。 - * - * - * 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。 - * - *
- * 点击展开详情 - * - *
- * - * 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置** - * 中找到**换取 token 身份验证方式** 配置项: - * - * > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。 - * - * ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg) - * - * #### 换取 token 身份验证方式为 none 时 - * - * 调用此接口不需要进行额外操作。 - * - * #### 换取 token 身份验证方式为 client_secret_post 时 - * - * 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。 - * - * #### 换取 token 身份验证方式为 client_secret_basic 时 - * - * 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。): - * - * ``` - * Basic base64(:) - * ``` - * - * 结果示例: - * - * ``` - * Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3 - * ``` - * - * JS 代码示例: - * - * ```js - * 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64'); - * ``` - * - *
- * - * - * @returns LoginTokenRespDto - */ -func (client *AuthenticationClient) ExchangeTokenSetWithQrCodeTicket (reqDto *dto.ExchangeTokenSetWithQRcodeTicketDto) *dto.LoginTokenRespDto { - b, err := client.SendHttpRequest("/api/v3/exchange-tokenset-with-qrcode-ticket", fasthttp.MethodPost, reqDto) - var response dto.LoginTokenRespDto +* @summary 获取国家列表 +* @description 动态获取国家列表,可以用于前端登录页面国家选择和国际短信输入框选择,以减少前端静态资源体积。 +* @returns GetCountryListRespDto + */ +func (client *AuthenticationClient) GetCountryList() *dto.GetCountryListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-country-list", fasthttp.MethodGet, nil) + var response dto.GetCountryListRespDto if err != nil { fmt.Println(err) return nil @@ -1777,14 +1570,15 @@ func (client *AuthenticationClient) ExchangeTokenSetWithQrCodeTicket (reqDto *dt } return &response } + /* - * @summary 自建 APP 扫码登录:APP 端修改二维码状态 - * @description 此端点用于在自建 APP 扫码登录中修改二维码状态,对应着在浏览器渲染出二维码之后,终端用户扫码、确认授权、取消授权的过程。**此接口要求具备用户的登录态**。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) ChangeQrCodeStatus (reqDto *dto.ChangeQRCodeStatusDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/change-qrcode-status", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto +* @summary 预检验验证码是否正确 +* @description 预检测验证码是否有效,此检验不会使得验证码失效。 +* @returns PreCheckCodeRespDto + */ +func (client *AuthenticationClient) PreCheckCode(reqDto *dto.PreCheckCodeDto) *dto.PreCheckCodeRespDto { + b, err := client.SendHttpRequest("/api/v3/pre-check-code", fasthttp.MethodPost, reqDto) + var response dto.PreCheckCodeRespDto if err != nil { fmt.Println(err) return nil @@ -1796,14 +1590,15 @@ func (client *AuthenticationClient) ChangeQrCodeStatus (reqDto *dto.ChangeQRCode } return &response } + /* - * @summary 发送短信 - * @description 发送短信时必须指定短信 Channel,每个手机号同一 Channel 在一分钟内只能发送一次。 - * @returns SendSMSRespDto - */ -func (client *AuthenticationClient) SendSms (reqDto *dto.SendSMSDto) *dto.SendSMSRespDto { - b, err := client.SendHttpRequest("/api/v3/send-sms", fasthttp.MethodPost, reqDto) - var response dto.SendSMSRespDto +* @summary 发起绑定 MFA 认证要素请求 +* @description 当用户未绑定某个 MFA 认证要素时,可以发起绑定 MFA 认证要素请求。不同类型的 MFA 认证要素绑定请求需要发送不同的参数,详细见 profile 参数。发起验证请求之后,Authing 服务器会根据相应的认证要素类型和传递的参数,使用不同的手段要求验证。此接口会返回 enrollmentToken,你需要在请求「绑定 MFA 认证要素」接口时带上此 enrollmentToken,并提供相应的凭证。 +* @returns SendEnrollFactorRequestRespDto + */ +func (client *AuthenticationClient) SendEnrollFactorRequest(reqDto *dto.SendEnrollFactorRequestDto) *dto.SendEnrollFactorRequestRespDto { + b, err := client.SendHttpRequest("/api/v3/send-enroll-factor-request", fasthttp.MethodPost, reqDto) + var response dto.SendEnrollFactorRequestRespDto if err != nil { fmt.Println(err) return nil @@ -1815,14 +1610,15 @@ func (client *AuthenticationClient) SendSms (reqDto *dto.SendSMSDto) *dto.SendSM } return &response } + /* - * @summary 发送邮件 - * @description 发送邮件时必须指定邮件 Channel,每个邮箱同一 Channel 在一分钟内只能发送一次。 - * @returns SendEmailRespDto - */ -func (client *AuthenticationClient) SendEmail (reqDto *dto.SendEmailDto) *dto.SendEmailRespDto { - b, err := client.SendHttpRequest("/api/v3/send-email", fasthttp.MethodPost, reqDto) - var response dto.SendEmailRespDto +* @summary 绑定 MFA 认证要素 +* @description 绑定 MFA 要素 +* @returns EnrollFactorRespDto + */ +func (client *AuthenticationClient) EnrollFactor(reqDto *dto.EnrollFactorDto) *dto.EnrollFactorRespDto { + b, err := client.SendHttpRequest("/api/v3/enroll-factor", fasthttp.MethodPost, reqDto) + var response dto.EnrollFactorRespDto if err != nil { fmt.Println(err) return nil @@ -1834,14 +1630,15 @@ func (client *AuthenticationClient) SendEmail (reqDto *dto.SendEmailDto) *dto.Se } return &response } + /* - * @summary 获取用户资料 - * @description 此端点用户获取用户资料,需要在请求头中带上用户的 `access_token`,Authing 服务器会根据用户 `access_token` 中的 `scope` 返回对应的字段。 - * @returns UserSingleRespDto - */ -func (client *AuthenticationClient) GetProfile (reqDto *dto.GetProfileDto) *dto.UserSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/get-profile", fasthttp.MethodGet, reqDto) - var response dto.UserSingleRespDto +* @summary 解绑 MFA 认证要素 +* @description 当前不支持通过此接口解绑短信、邮箱验证码类型的认证要素。如果需要,请调用「解绑邮箱」和「解绑手机号」接口。 +* @returns ResetFactorRespDto + */ +func (client *AuthenticationClient) ResetFactor(reqDto *dto.RestFactorDto) *dto.ResetFactorRespDto { + b, err := client.SendHttpRequest("/api/v3/reset-factor", fasthttp.MethodPost, reqDto) + var response dto.ResetFactorRespDto if err != nil { fmt.Println(err) return nil @@ -1853,14 +1650,15 @@ func (client *AuthenticationClient) GetProfile (reqDto *dto.GetProfileDto) *dto. } return &response } + /* - * @summary 修改用户资料 - * @description 此接口用于修改用户的用户资料,包含用户的自定义数据。如果需要**修改邮箱**、**修改手机号**、**修改密码**,请使用对应的单独接口。 - * @returns UserSingleRespDto - */ -func (client *AuthenticationClient) UpdateProfile (reqDto *dto.UpdateUserProfileDto) *dto.UserSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/update-profile", fasthttp.MethodPost, reqDto) - var response dto.UserSingleRespDto +* @summary 获取绑定的所有 MFA 认证要素 +* @description Authing 目前支持四种类型的 MFA 认证要素:手机短信、邮件验证码、OTP、人脸。如果用户绑定了手机号 / 邮箱之后,默认就具备了手机短信、邮箱验证码的 MFA 认证要素。 +* @returns ListEnrolledFactorsRespDto + */ +func (client *AuthenticationClient) ListEnrolledFactors() *dto.ListEnrolledFactorsRespDto { + b, err := client.SendHttpRequest("/api/v3/list-enrolled-factors", fasthttp.MethodGet, nil) + var response dto.ListEnrolledFactorsRespDto if err != nil { fmt.Println(err) return nil @@ -1872,14 +1670,15 @@ func (client *AuthenticationClient) UpdateProfile (reqDto *dto.UpdateUserProfile } return &response } + /* - * @summary 绑定邮箱 - * @description 如果用户还**没有绑定邮箱**,此接口可用于用户**自主**绑定邮箱。如果用户已经绑定邮箱想要修改邮箱,请使用**修改邮箱**接口。你需要先调用**发送邮件**接口发送邮箱验证码。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) BindEmail (reqDto *dto.BindEmailDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/bind-email", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto +* @summary 获取绑定的某个 MFA 认证要素 +* @description 根据 Factor ID 获取用户绑定的某个 MFA Factor 详情。 +* @returns GetFactorRespDto + */ +func (client *AuthenticationClient) GetFactor(reqDto *dto.GetFactorDto) *dto.GetFactorRespDto { + b, err := client.SendHttpRequest("/api/v3/get-factor", fasthttp.MethodGet, reqDto) + var response dto.GetFactorRespDto if err != nil { fmt.Println(err) return nil @@ -1891,14 +1690,15 @@ func (client *AuthenticationClient) BindEmail (reqDto *dto.BindEmailDto) *dto.Co } return &response } + /* - * @summary 解绑邮箱 - * @description 用户解绑邮箱,如果用户没有绑定其他登录方式(手机号、社会化登录账号),将无法解绑邮箱,会提示错误。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) UnbindEmail (reqDto *dto.UnbindEmailDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/unbind-email", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto +* @summary 获取可绑定的 MFA 认证要素 +* @description 获取所有应用已经开启、用户暂未绑定的 MFA 认证要素,用户可以从返回的列表中绑定新的 MFA 认证要素。 +* @returns ListFactorsToEnrollRespDto + */ +func (client *AuthenticationClient) ListFactorsToEnroll() *dto.ListFactorsToEnrollRespDto { + b, err := client.SendHttpRequest("/api/v3/list-factors-to-enroll", fasthttp.MethodGet, nil) + var response dto.ListFactorsToEnrollRespDto if err != nil { fmt.Println(err) return nil @@ -1910,14 +1710,85 @@ func (client *AuthenticationClient) UnbindEmail (reqDto *dto.UnbindEmailDto) *dt } return &response } + /* - * @summary 绑定手机号 - * @description 如果用户还**没有绑定手机号**,此接口可用于用户**自主**绑定手机号。如果用户已经绑定手机号想要修改手机号,请使用**修改手机号**接口。你需要先调用**发送短信**接口发送短信验证码。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) BindPhone (reqDto *dto.BindPhoneDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/bind-phone", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto + * @summary 生成绑定外部身份源的链接 + * @description + * + * 由于绝大多数的外部身份源登录不允许在第三方系统直接输入账号密码进行登录,所以外部身份源的绑定总是需要先跳转到对方的登录页面进行认证。此端点会通过浏览器 `302` 跳转的方式先跳转到第三方的登录页面, + * 终端用户在第三方系统认证完成之后,浏览器再会跳转到 Authing 服务器,Authing 服务器会将此外部身份源绑定到该用户身上。最终的结果会通过浏览器 Window Post Message 的方式传递给开发者。 + * 你可以在你的应用系统中放置一个按钮,引导用户点击之后,弹出一个 Window Popup,地址为此端点,当用户在第三方身份源认证完成之后,此 Popup 会通过 Window Post Message 的方式传递给父窗口。 + * + * 为此我们在 `@authing/web` SDK 中封装了相关方法,为开发者省去了其中大量的细节: + * + * ```typescript + * import { Authing } from "@authing/web" + * const sdk = new Authing({ + * // 应用的认证地址,例如:https://domain.authing.cn + * domain: "", + * + * // Authing 应用 ID + * appId: "AUTHING_APP_ID", + * + * // 登录回调地址,需要在控制台『应用配置 - 登录回调 URL』中指定 + * redirectUri: "your_redirect_uri" + * }); + * + * + * // success 表示此次绑定操作是否成功; + * // errMsg 为如果绑定失败,具体的失败原因,如此身份源已被其他账号绑定等。 + * // identities 为此次绑定操作具体绑定的第三方身份信息 + * const { success, errMsg, identities } = await sdk.bindExtIdpWithPopup({ + * "extIdpConnIdentifier": "my-wechat" + * }) + * + * ``` + * + * 绑定外部身份源成功之后,你可以得到用户在此第三方身份源的信息,以绑定飞书账号为例: + * + * ```json + * [ + * { + * "identityId": "62f20932xxxxbcc10d966ee5", + * "extIdpId": "62f209327xxxxcc10d966ee5", + * "provider": "lark", + * "type": "open_id", + * "userIdInIdp": "ou_8bae746eac07cd2564654140d2a9ac61", + * "originConnIds": ["62f2093244fa5cb19ff21ed3"] + * }, + * { + * "identityId": "62f726239xxxxe3285d21c93", + * "extIdpId": "62f209327xxxxcc10d966ee5", + * "provider": "lark", + * "type": "union_id", + * "userIdInIdp": "on_093ce5023288856aa0abe4099123b18b", + * "originConnIds": ["62f2093244fa5cb19ff21ed3"] + * }, + * { + * "identityId": "62f72623e011cf10c8851e4c", + * "extIdpId": "62f209327xxxxcc10d966ee5", + * "provider": "lark", + * "type": "user_id", + * "userIdInIdp": "23ded785", + * "originConnIds": ["62f2093244fa5cb19ff21ed3"] + * } + * ] + * ``` + * + * 可以看到,我们获取到了用户在飞书中的身份信息: + * + * - `open_id`: ou_8bae746eac07cd2564654140d2a9ac61 + * - `union_id`: on_093ce5023288856aa0abe4099123b18b + * - `user_id`: 23ded785 + * + * 绑定此外部身份源之后,后续用户就可以使用此身份源进行登录了,见**登录**接口。 + * + * + * @returns GenerateBindExtIdpLinkRespDto +*/ +func (client *AuthenticationClient) GenerateLinkExtIdpUrl(reqDto *dto.GenerateLinkExtidpUrlDto) *dto.GenerateBindExtIdpLinkRespDto { + b, err := client.SendHttpRequest("/api/v3/generate-link-extidp-url", fasthttp.MethodGet, reqDto) + var response dto.GenerateBindExtIdpLinkRespDto if err != nil { fmt.Println(err) return nil @@ -1929,13 +1800,14 @@ func (client *AuthenticationClient) BindPhone (reqDto *dto.BindPhoneDto) *dto.Co } return &response } + /* - * @summary 解绑手机号 - * @description 用户解绑手机号,如果用户没有绑定其他登录方式(邮箱、社会化登录账号),将无法解绑手机号,会提示错误。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) UnbindPhone (reqDto *dto.UnbindPhoneDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/unbind-phone", fasthttp.MethodPost, reqDto) +* @summary 解绑外部身份源 +* @description 解绑外部身份源,此接口需要传递用户绑定的外部身份源 ID,**注意不是身份源连接 ID**。 +* @returns CommonResponseDto + */ +func (client *AuthenticationClient) UnlinkExtIdp(reqDto *dto.UnlinkExtIdpDto) *dto.CommonResponseDto { + b, err := client.SendHttpRequest("/api/v3/unlink-extidp", fasthttp.MethodPost, reqDto) var response dto.CommonResponseDto if err != nil { fmt.Println(err) @@ -1948,14 +1820,50 @@ func (client *AuthenticationClient) UnbindPhone (reqDto *dto.UnbindPhoneDto) *dt } return &response } + /* - * @summary 获取密码强度和账号安全等级评分 - * @description 获取用户的密码强度和账号安全等级评分,需要在请求头中带上用户的 `access_token`。 - * @returns GetSecurityInfoRespDto - */ -func (client *AuthenticationClient) GetSecurityLevel () *dto.GetSecurityInfoRespDto { - b, err := client.SendHttpRequest("/api/v3/get-security-info", fasthttp.MethodGet, nil) - var response dto.GetSecurityInfoRespDto + * @summary 获取绑定的外部身份源 + * @description + * 如在**介绍**部分中所描述的,一个外部身份源对应多个外部身份源连接,用户通过某个外部身份源连接绑定了某个外部身份源账号之后, + * 用户会建立一条与此外部身份源之间的关联关系。此接口用于获取此用户绑定的所有外部身份源。 + * + * 取决于外部身份源的具体实现,一个用户在外部身份源中,可能会有多个身份 ID,比如在微信体系中会有 `openid` 和 `unionid`,在非书中有 + * `open_id`、`union_id` 和 `user_id`。在 Authing 中,我们把这样的一条 `open_id` 或者 `unionid_` 叫做一条 `Identity`, 所以用户在一个身份源会有多条 `Identity` 记录。 + * + * 以微信为例,如果用户使用微信登录或者绑定了微信账号,他的 `Identity` 信息如下所示: + * + * ```json + * [ + * { + * "identityId": "62f20932xxxxbcc10d966ee5", + * "extIdpId": "62f209327xxxxcc10d966ee5", + * "provider": "wechat", + * "type": "openid", + * "userIdInIdp": "oH_5k5SflrwjGvk7wqpoBKq_cc6M", + * "originConnIds": ["62f2093244fa5cb19ff21ed3"] + * }, + * { + * "identityId": "62f726239xxxxe3285d21c93", + * "extIdpId": "62f209327xxxxcc10d966ee5", + * "provider": "wechat", + * "type": "unionid", + * "userIdInIdp": "o9Nka5ibU-lUGQaeAHqu0nOZyJg0", + * "originConnIds": ["62f2093244fa5cb19ff21ed3"] + * } + * ] + * ``` + * + * + * 可以看到他们的 `extIdpId` 是一样的,这个是你在 Authing 中创建的**身份源 ID**;`provider` 都是 `wechat`; + * 通过 `type` 可以区分出哪个是 `openid`,哪个是 `unionid`,以及具体的值(`userIdInIdp`);他们都来自于同一个身份源连接(`originConnIds`)。 + * + * + * + * @returns GetIdentitiesRespDto +*/ +func (client *AuthenticationClient) GetIdentities() *dto.GetIdentitiesRespDto { + b, err := client.SendHttpRequest("/api/v3/get-identities", fasthttp.MethodGet, nil) + var response dto.GetIdentitiesRespDto if err != nil { fmt.Println(err) return nil @@ -1967,14 +1875,15 @@ func (client *AuthenticationClient) GetSecurityLevel () *dto.GetSecurityInfoResp } return &response } + /* - * @summary 修改密码 - * @description 此端点用于用户自主修改密码,如果用户之前已经设置密码,需要提供用户的原始密码作为凭证。如果用户忘记了当前密码,请使用**忘记密码**接口。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) UpdatePassword (reqDto *dto.UpdatePasswordDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/update-password", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto +* @summary 获取应用开启的外部身份源列表 +* @description 获取应用开启的外部身份源列表,前端可以基于此渲染外部身份源按钮。 +* @returns GetExtIdpsRespDto + */ +func (client *AuthenticationClient) GetApplicationEnabledExtIdps() *dto.GetExtIdpsRespDto { + b, err := client.SendHttpRequest("/api/v3/get-application-enabled-extidps", fasthttp.MethodGet, nil) + var response dto.GetExtIdpsRespDto if err != nil { fmt.Println(err) return nil @@ -1986,14 +1895,22 @@ func (client *AuthenticationClient) UpdatePassword (reqDto *dto.UpdatePasswordDt } return &response } + /* - * @summary 发起修改邮箱的验证请求 - * @description 终端用户自主修改邮箱时,需要提供相应的验证手段。此接口用于验证用户的修改邮箱请求是否合法。当前支持通过**邮箱验证码**的方式进行验证,你需要先调用发送邮件接口发送对应的邮件验证码。 - * @returns VerifyUpdateEmailRequestRespDto - */ -func (client *AuthenticationClient) VerifyUpdateEmailRequest (reqDto *dto.VerifyUpdateEmailRequestDto) *dto.VerifyUpdateEmailRequestRespDto { - b, err := client.SendHttpRequest("/api/v3/verify-update-email-request", fasthttp.MethodPost, reqDto) - var response dto.VerifyUpdateEmailRequestRespDto + * @summary 注册 + * @description + * 此端点目前支持以下几种基于的注册方式: + * + * 1. 基于密码(PASSWORD):用户名 + 密码,邮箱 + 密码。 + * 2. 基于一次性临时验证码(PASSCODE):手机号 + 验证码,邮箱 + 验证码。你需要先调用发送短信或者发送邮件接口获取验证码。 + * + * 社会化登录等使用外部身份源“注册”请直接使用**登录**接口,我们会在其第一次登录的时候为其创建一个新账号。 + * + * @returns UserSingleRespDto +*/ +func (client *AuthenticationClient) SignUp(reqDto *dto.SignUpDto) *dto.UserSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/signup", fasthttp.MethodPost, reqDto) + var response dto.UserSingleRespDto if err != nil { fmt.Println(err) return nil @@ -2005,15 +1922,14 @@ func (client *AuthenticationClient) VerifyUpdateEmailRequest (reqDto *dto.Verify } return &response } + /* - * @summary 修改邮箱 - * @description 终端用户自主修改邮箱,需要提供相应的验证手段,见[发起修改邮箱的验证请求](#tag/用户资料/修改邮箱/operation/ProfileV3Controller_updateEmailVerification)。 - * 此参数需要提供一次性临时凭证 `updateEmailToken`,此数据需要从**发起修改邮箱的验证请求**接口获取。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) UpdateEmail (reqDto *dto.UpdateEmailDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/update-email", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto +* @summary 解密微信小程序数据 +* @returns DecryptWechatMiniProgramDataRespDto + */ +func (client *AuthenticationClient) DecryptWechatMiniProgramData(reqDto *dto.DecryptWechatMiniProgramDataDto) *dto.DecryptWechatMiniProgramDataRespDto { + b, err := client.SendHttpRequest("/api/v3/decrypt-wechat-miniprogram-data", fasthttp.MethodPost, reqDto) + var response dto.DecryptWechatMiniProgramDataRespDto if err != nil { fmt.Println(err) return nil @@ -2025,14 +1941,14 @@ func (client *AuthenticationClient) UpdateEmail (reqDto *dto.UpdateEmailDto) *dt } return &response } + /* - * @summary 发起修改手机号的验证请求 - * @description 终端用户自主修改手机号时,需要提供相应的验证手段。此接口用于验证用户的修改手机号请求是否合法。当前支持通过**短信验证码**的方式进行验证,你需要先调用发送短信接口发送对应的短信验证码。 - * @returns VerifyUpdatePhoneRequestRespDto - */ -func (client *AuthenticationClient) VerifyUpdatePhoneRequest (reqDto *dto.VerifyUpdatePhoneRequestDto) *dto.VerifyUpdatePhoneRequestRespDto { - b, err := client.SendHttpRequest("/api/v3/verify-update-phone-request", fasthttp.MethodPost, reqDto) - var response dto.VerifyUpdatePhoneRequestRespDto +* @summary 获取小程序的手机号 +* @returns GetWechatMiniProgramPhoneRespDto + */ +func (client *AuthenticationClient) GetWechatMiniprogramPhone(reqDto *dto.GetWechatMiniProgramPhoneDto) *dto.GetWechatMiniProgramPhoneRespDto { + b, err := client.SendHttpRequest("/api/v3/get-wechat-miniprogram-phone", fasthttp.MethodPost, reqDto) + var response dto.GetWechatMiniProgramPhoneRespDto if err != nil { fmt.Println(err) return nil @@ -2044,15 +1960,14 @@ func (client *AuthenticationClient) VerifyUpdatePhoneRequest (reqDto *dto.Verify } return &response } + /* - * @summary 修改手机号 - * @description 终端用户自主修改手机号,需要提供相应的验证手段,见[发起修改手机号的验证请求](#tag/用户资料/修改邮箱/operation/ProfileV3Controller_updatePhoneVerification)。 - * 此参数需要提供一次性临时凭证 `updatePhoneToken`,此数据需要从**发起修改手机号的验证请求**接口获取。 - * @returns CommonResponseDto - */ -func (client *AuthenticationClient) UpdatePhone (reqDto *dto.UpdatePhoneDto) *dto.CommonResponseDto { - b, err := client.SendHttpRequest("/api/v3/update-phone", fasthttp.MethodPost, reqDto) - var response dto.CommonResponseDto +* @summary 获取 Authing 服务器缓存的微信小程序、公众号 Access Token +* @returns GetWechatAccessTokenRespDto + */ +func (client *AuthenticationClient) GetWechatMpAccessToken(reqDto *dto.GetWechatAccessTokenDto) *dto.GetWechatAccessTokenRespDto { + b, err := client.SendHttpRequest("/api/v3/get-wechat-access-token", fasthttp.MethodPost, reqDto) + var response dto.GetWechatAccessTokenRespDto if err != nil { fmt.Println(err) return nil @@ -2064,14 +1979,15 @@ func (client *AuthenticationClient) UpdatePhone (reqDto *dto.UpdatePhoneDto) *dt } return &response } + /* - * @summary 发起忘记密码请求 - * @description 当用户忘记密码时,可以通过此端点找回密码。用户需要使用相关验证手段进行验证,目前支持**邮箱验证码**和**手机号验证码**两种验证手段。 - * @returns PasswordResetVerifyResp - */ -func (client *AuthenticationClient) VerifyResetPasswordRequest (reqDto *dto.VerifyResetPasswordRequestDto) *dto.PasswordResetVerifyResp { - b, err := client.SendHttpRequest("/api/v3/verify-reset-password-request", fasthttp.MethodPost, reqDto) - var response dto.PasswordResetVerifyResp +* @summary 获取登录日志 +* @description 获取登录日志 +* @returns GetLoginHistoryRespDto + */ +func (client *AuthenticationClient) GetLoginHistory(reqDto *dto.GetMyLoginHistoryDto) *dto.GetLoginHistoryRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-login-history", fasthttp.MethodGet, reqDto) + var response dto.GetLoginHistoryRespDto if err != nil { fmt.Println(err) return nil @@ -2083,14 +1999,15 @@ func (client *AuthenticationClient) VerifyResetPasswordRequest (reqDto *dto.Veri } return &response } + /* - * @summary 忘记密码 - * @description 此端点用于用户忘记密码之后,通过**手机号验证码**或者**邮箱验证码**的方式重置密码。此接口需要提供用于重置密码的临时凭证 `passwordResetToken`,此参数需要通过**发起忘记密码请求**接口获取。 - * @returns IsSuccessRespDto - */ -func (client *AuthenticationClient) ResetPassword (reqDto *dto.ResetPasswordDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/reset-password", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +* @summary 获取登录应用 +* @description 获取登录应用 +* @returns GetLoggedInAppsRespDto + */ +func (client *AuthenticationClient) GetLoggedInApps() *dto.GetLoggedInAppsRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-logged-in-apps", fasthttp.MethodGet, nil) + var response dto.GetLoggedInAppsRespDto if err != nil { fmt.Println(err) return nil @@ -2102,14 +2019,15 @@ func (client *AuthenticationClient) ResetPassword (reqDto *dto.ResetPasswordDto) } return &response } + /* - * @summary 发起注销账号请求 - * @description 当用户希望注销账号时,需提供相应凭证,当前支持**使用邮箱验证码**、使用**手机验证码**、**使用密码**三种验证方式。 - * @returns VerifyDeleteAccountRequestRespDto - */ -func (client *AuthenticationClient) VeirfyDeleteAccountRequest (reqDto *dto.VerifyDeleteAccountRequestDto) *dto.VerifyDeleteAccountRequestRespDto { - b, err := client.SendHttpRequest("/api/v3/verify-delete-account-request", fasthttp.MethodPost, reqDto) - var response dto.VerifyDeleteAccountRequestRespDto +* @summary 获取具备访问权限的应用 +* @description 获取具备访问权限的应用 +* @returns GetAccessibleAppsRespDto + */ +func (client *AuthenticationClient) GetAccessibleApps() *dto.GetAccessibleAppsRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-accessible-apps", fasthttp.MethodGet, nil) + var response dto.GetAccessibleAppsRespDto if err != nil { fmt.Println(err) return nil @@ -2121,14 +2039,15 @@ func (client *AuthenticationClient) VeirfyDeleteAccountRequest (reqDto *dto.Veri } return &response } + /* - * @summary 注销账户 - * @description 此端点用于用户自主注销账号,需要提供用于注销账号的临时凭证 deleteAccountToken,此参数需要通过**发起注销账号请求**接口获取。 - * @returns IsSuccessRespDto - */ -func (client *AuthenticationClient) DeleteAccount (reqDto *dto.DeleteAccounDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/delete-account", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +* @summary 获取租户列表 +* @description 获取租户列表 +* @returns GetTenantListRespDto + */ +func (client *AuthenticationClient) GetTenantList() *dto.GetTenantListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-tenant-list", fasthttp.MethodGet, nil) + var response dto.GetTenantListRespDto if err != nil { fmt.Println(err) return nil @@ -2140,14 +2059,15 @@ func (client *AuthenticationClient) DeleteAccount (reqDto *dto.DeleteAccounDto) } return &response } + /* - * @summary 获取服务器公开信息 - * @description 可端点可获取服务器的公开信息,如 RSA256 公钥、SM2 公钥、Authing 服务版本号等。 - * @returns SystemInfoResp - */ -func (client *AuthenticationClient) GetSystemInfo () *dto.SystemInfoResp { - b, err := client.SendHttpRequest("/api/v3/system", fasthttp.MethodGet, nil) - var response dto.SystemInfoResp +* @summary 获取角色列表 +* @description 获取角色列表 +* @returns RoleListRespDto + */ +func (client *AuthenticationClient) GetRoleList(reqDto *dto.GetMyRoleListDto) *dto.RoleListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-role-list", fasthttp.MethodGet, reqDto) + var response dto.RoleListRespDto if err != nil { fmt.Println(err) return nil @@ -2159,14 +2079,35 @@ func (client *AuthenticationClient) GetSystemInfo () *dto.SystemInfoResp { } return &response } + /* - * @summary 获取国家列表 - * @description 动态获取国家列表,可以用于前端登录页面国家选择和国际短信输入框选择,以减少前端静态资源体积。 - * @returns GetCountryListRespDto - */ -func (client *AuthenticationClient) GetCountryList () *dto.GetCountryListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-country-list", fasthttp.MethodGet, nil) - var response dto.GetCountryListRespDto +* @summary 获取分组列表 +* @description 获取分组列表 +* @returns GroupListRespDto + */ +func (client *AuthenticationClient) GetGroupList() *dto.GroupListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-group-list", fasthttp.MethodGet, nil) + var response dto.GroupListRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* +* @summary 获取部门列表 +* @description 此接口用于获取用户的部门列表,可根据一定排序规则进行排序。 +* @returns UserDepartmentPaginatedRespDto + */ +func (client *AuthenticationClient) GetDepartmentList(reqDto *dto.GetMyDepartmentListDto) *dto.UserDepartmentPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-department-list", fasthttp.MethodGet, reqDto) + var response dto.UserDepartmentPaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -2178,14 +2119,15 @@ func (client *AuthenticationClient) GetCountryList () *dto.GetCountryListRespDto } return &response } + /* - * @summary 预检验验证码是否正确 - * @description 预检测验证码是否有效,此检验不会使得验证码失效。 - * @returns PreCheckCodeRespDto - */ -func (client *AuthenticationClient) PreCheckCode (reqDto *dto.PreCheckCodeDto) *dto.PreCheckCodeRespDto { - b, err := client.SendHttpRequest("/api/v3/pre-check-code", fasthttp.MethodPost, reqDto) - var response dto.PreCheckCodeRespDto +* @summary 获取被授权的资源列表 +* @description 此接口用于获取用户被授权的资源列表。 +* @returns AuthorizedResourcePaginatedRespDto + */ +func (client *AuthenticationClient) GetAuthorizedResources(reqDto *dto.GetMyAuthorizedResourcesDto) *dto.AuthorizedResourcePaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/get-my-authorized-resources", fasthttp.MethodGet, reqDto) + var response dto.AuthorizedResourcePaginatedRespDto if err != nil { fmt.Println(err) return nil diff --git a/dto/ApplicationBrandingConfig.go b/dto/ApplicationBrandingConfig.go index de2d1c1..7f1603e 100644 --- a/dto/ApplicationBrandingConfig.go +++ b/dto/ApplicationBrandingConfig.go @@ -13,6 +13,6 @@ type ApplicationBrandingConfig struct{ ShowEnterpriseConnections bool `json:"showEnterpriseConnections"` ShowSocialConnections bool `json:"showSocialConnections"` ShowAgreement bool `json:"showAgreement"` - Agreements ApplicationAgreementDto `json:"agreements"` + Agreements []ApplicationAgreementDto `json:"agreements"` } diff --git a/dto/ApplicationSimpleInfoPaginatedDataDto.go b/dto/ApplicationSimpleInfoPaginatedDataDto.go new file mode 100644 index 0000000..c04ee85 --- /dev/null +++ b/dto/ApplicationSimpleInfoPaginatedDataDto.go @@ -0,0 +1,8 @@ +package dto + + +type ApplicationSimpleInfoPaginatedDataDto struct{ + List []ApplicationSimpleInfoDto `json:"list"` + TotalCount int `json:"totalCount"` +} + diff --git a/dto/ApplicationSimpleInfoPaginatedRespDto.go b/dto/ApplicationSimpleInfoPaginatedRespDto.go new file mode 100644 index 0000000..76940ec --- /dev/null +++ b/dto/ApplicationSimpleInfoPaginatedRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type ApplicationSimpleInfoPaginatedRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data ApplicationSimpleInfoPaginatedDataDto `json:"data"` +} + diff --git a/dto/AssociateTenantResourceDto.go b/dto/AssociateTenantResourceDto.go new file mode 100644 index 0000000..800ad4b --- /dev/null +++ b/dto/AssociateTenantResourceDto.go @@ -0,0 +1,10 @@ +package dto + + +type AssociateTenantResourceDto struct{ + AppId string `json:"appId"` + Association bool `json:"association"` + Code string `json:"code"` + TenantId string `json:"tenantId,omitempty"` +} + diff --git a/dto/AuthorizeApplicationAccessDto.go b/dto/AuthorizeApplicationAccessDto.go new file mode 100644 index 0000000..4f8615a --- /dev/null +++ b/dto/AuthorizeApplicationAccessDto.go @@ -0,0 +1,8 @@ +package dto + + +type AuthorizeApplicationAccessDto struct{ + List []ApplicationPermissionRecordItem `json:"list"` + AppId string `json:"appId"` +} + diff --git a/dto/ChangeExtIdpAssociationStateDto.go b/dto/ChangeExtIdpAssociationStateDto.go new file mode 100644 index 0000000..ee468af --- /dev/null +++ b/dto/ChangeExtIdpAssociationStateDto.go @@ -0,0 +1,9 @@ +package dto + + +type ChangeExtIdpAssociationStateDto struct{ + Association bool `json:"association"` + Id string `json:"id"` + TenantId string `json:"tenantId,omitempty"` +} + diff --git a/dto/ChangeExtIdpConnStateDto.go b/dto/ChangeExtIdpConnStateDto.go new file mode 100644 index 0000000..4240225 --- /dev/null +++ b/dto/ChangeExtIdpConnStateDto.go @@ -0,0 +1,11 @@ +package dto + + +type ChangeExtIdpConnStateDto struct{ + AppId string `json:"appId"` + Enabled bool `json:"enabled"` + Id string `json:"id"` + TenantId string `json:"tenantId,omitempty"` + AppIds []string `json:"appIds,omitempty"` +} + diff --git a/dto/CostCurrentPackageInfo.go b/dto/CostCurrentPackageInfo.go new file mode 100644 index 0000000..6884907 --- /dev/null +++ b/dto/CostCurrentPackageInfo.go @@ -0,0 +1,10 @@ +package dto + + +type CostCurrentPackageInfo struct{ + Code string `json:"code"` + EndTime string `json:"endTime"` + OverdueDays string `json:"overdueDays"` + GoodsPackage GoodsPackageDto `json:"goodsPackage"` +} + diff --git a/dto/CostGetAllRightItemRespDto.go b/dto/CostGetAllRightItemRespDto.go new file mode 100644 index 0000000..cce97b4 --- /dev/null +++ b/dto/CostGetAllRightItemRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type CostGetAllRightItemRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data RightItemRes `json:"data"` +} + diff --git a/dto/CostGetCurrentPackageRespDto.go b/dto/CostGetCurrentPackageRespDto.go new file mode 100644 index 0000000..a96afae --- /dev/null +++ b/dto/CostGetCurrentPackageRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type CostGetCurrentPackageRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data CostCurrentPackageInfo `json:"data"` +} + diff --git a/dto/CostGetCurrentUsageRespDto.go b/dto/CostGetCurrentUsageRespDto.go new file mode 100644 index 0000000..75bac06 --- /dev/null +++ b/dto/CostGetCurrentUsageRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type CostGetCurrentUsageRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data CurrentUsageRespDto `json:"data"` +} + diff --git a/dto/CostGetMauPeriodUsageHistoryRespDto.go b/dto/CostGetMauPeriodUsageHistoryRespDto.go new file mode 100644 index 0000000..690f65e --- /dev/null +++ b/dto/CostGetMauPeriodUsageHistoryRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type CostGetMauPeriodUsageHistoryRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data MauPeriodUsageHistory `json:"data"` +} + diff --git a/dto/CostGetOrderDetailRespDto.go b/dto/CostGetOrderDetailRespDto.go new file mode 100644 index 0000000..10729c7 --- /dev/null +++ b/dto/CostGetOrderDetailRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type CostGetOrderDetailRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data OrderItem `json:"data"` +} + diff --git a/dto/CostGetOrderPayDetailRespDto.go b/dto/CostGetOrderPayDetailRespDto.go new file mode 100644 index 0000000..238c206 --- /dev/null +++ b/dto/CostGetOrderPayDetailRespDto.go @@ -0,0 +1,18 @@ +package dto + + +type CostGetOrderPayDetailRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + OrderNo string `json:"orderNo"` + ChannelOrderNo string `json:"channelOrderNo"` + PaidAmount string `json:"paidAmount"` + PaidTime string `json:"paidTime"` + PaidAccountNo string `json:"paidAccountNo"` + PayStatus string `json:"payStatus"` + CreateTime string `json:"createTime"` + PayType string `json:"payType"` +} + diff --git a/dto/CostGetOrdersRespDto.go b/dto/CostGetOrdersRespDto.go new file mode 100644 index 0000000..67e3b0f --- /dev/null +++ b/dto/CostGetOrdersRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type CostGetOrdersRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data GetOrdersRes `json:"data"` +} + diff --git a/dto/CreateSyncTaskDto.go b/dto/CreateSyncTaskDto.go index ad58a1c..2cf7d37 100644 --- a/dto/CreateSyncTaskDto.go +++ b/dto/CreateSyncTaskDto.go @@ -5,9 +5,9 @@ type CreateSyncTaskDto struct{ FieldMapping []SyncTaskFieldMapping `json:"fieldMapping"` SyncTaskTrigger string `json:"syncTaskTrigger"` SyncTaskFlow string `json:"syncTaskFlow"` + ClientConfig SyncTaskClientConfig `json:"clientConfig"` SyncTaskType string `json:"syncTaskType"` SyncTaskName string `json:"syncTaskName"` - ClientConfig SyncTaskClientConfig `json:"clientConfig,omitempty"` OrganizationCode string `json:"organizationCode,omitempty"` ProvisioningScope SyncTaskProvisioningScope `json:"provisioningScope,omitempty"` TimedScheduler SyncTaskTimedScheduler `json:"timedScheduler,omitempty"` diff --git a/dto/CreateUserInfoDto.go b/dto/CreateUserInfoDto.go index 62cceed..34ddeeb 100644 --- a/dto/CreateUserInfoDto.go +++ b/dto/CreateUserInfoDto.go @@ -4,7 +4,6 @@ package dto type CreateUserInfoDto struct{ Status string `json:"status,omitempty"` Email string `json:"email,omitempty"` - PasswordEncryptType string `json:"passwordEncryptType,omitempty"` Phone string `json:"phone,omitempty"` PhoneCountryCode string `json:"phoneCountryCode,omitempty"` Username string `json:"username,omitempty"` @@ -35,12 +34,12 @@ type CreateUserInfoDto struct{ Locale string `json:"locale,omitempty"` Formatted string `json:"formatted,omitempty"` Region string `json:"region,omitempty"` - DepartmentIds []string `json:"departmentIds,omitempty"` - CustomData interface{} `json:"customData,omitempty"` Password string `json:"password,omitempty"` Salt string `json:"salt,omitempty"` TenantIds []string `json:"tenantIds,omitempty"` Otp CreateUserOtpDto `json:"otp,omitempty"` + DepartmentIds []string `json:"departmentIds,omitempty"` + CustomData interface{} `json:"customData,omitempty"` Identities []CreateIdentityDto `json:"identities,omitempty"` } diff --git a/dto/CreateUserOptionsDto.go b/dto/CreateUserOptionsDto.go index 1ca9c9c..a548a08 100644 --- a/dto/CreateUserOptionsDto.go +++ b/dto/CreateUserOptionsDto.go @@ -7,5 +7,6 @@ type CreateUserOptionsDto struct{ ResetPasswordOnFirstLogin bool `json:"resetPasswordOnFirstLogin,omitempty"` DepartmentIdType string `json:"departmentIdType,omitempty"` SendNotification SendCreateAccountNotificationDto `json:"sendNotification,omitempty"` + PasswordEncryptType string `json:"passwordEncryptType,omitempty"` } diff --git a/dto/CreateUserReqDto.go b/dto/CreateUserReqDto.go index 3885d03..167b5b4 100644 --- a/dto/CreateUserReqDto.go +++ b/dto/CreateUserReqDto.go @@ -4,7 +4,6 @@ package dto type CreateUserReqDto struct{ Status string `json:"status,omitempty"` Email string `json:"email,omitempty"` - PasswordEncryptType string `json:"passwordEncryptType,omitempty"` Phone string `json:"phone,omitempty"` PhoneCountryCode string `json:"phoneCountryCode,omitempty"` Username string `json:"username,omitempty"` @@ -35,12 +34,12 @@ type CreateUserReqDto struct{ Locale string `json:"locale,omitempty"` Formatted string `json:"formatted,omitempty"` Region string `json:"region,omitempty"` - DepartmentIds []string `json:"departmentIds,omitempty"` - CustomData interface{} `json:"customData,omitempty"` Password string `json:"password,omitempty"` Salt string `json:"salt,omitempty"` TenantIds []string `json:"tenantIds,omitempty"` Otp CreateUserOtpDto `json:"otp,omitempty"` + DepartmentIds []string `json:"departmentIds,omitempty"` + CustomData interface{} `json:"customData,omitempty"` Identities []CreateIdentityDto `json:"identities,omitempty"` Options CreateUserOptionsDto `json:"options,omitempty"` } diff --git a/dto/CurrentUsageDto.go b/dto/CurrentUsageDto.go new file mode 100644 index 0000000..5e83999 --- /dev/null +++ b/dto/CurrentUsageDto.go @@ -0,0 +1,11 @@ +package dto + + +type CurrentUsageDto struct{ + Amount string `json:"amount"` + Current string `json:"current"` + Experience bool `json:"experience"` + ModelCode string `json:"modelCode"` + ModelName string `json:"modelName"` +} + diff --git a/dto/CurrentUsageRespDto.go b/dto/CurrentUsageRespDto.go new file mode 100644 index 0000000..056b704 --- /dev/null +++ b/dto/CurrentUsageRespDto.go @@ -0,0 +1,7 @@ +package dto + + +type CurrentUsageRespDto struct{ + Usages []CurrentUsageDto `json:"usages"` +} + diff --git a/dto/EmailProviderRespDto.go b/dto/EmailProviderRespDto.go new file mode 100644 index 0000000..dccb560 --- /dev/null +++ b/dto/EmailProviderRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type EmailProviderRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data EmailProviderDto `json:"data"` +} + diff --git a/dto/FinishLoginParams.go b/dto/FinishLoginParams.go new file mode 100644 index 0000000..bd2aa37 --- /dev/null +++ b/dto/FinishLoginParams.go @@ -0,0 +1,6 @@ +package dto + + +type FinishLoginParams struct{ +} + diff --git a/dto/GetMauPeriodUsageHistoryDto.go b/dto/GetMauPeriodUsageHistoryDto.go new file mode 100644 index 0000000..d08062f --- /dev/null +++ b/dto/GetMauPeriodUsageHistoryDto.go @@ -0,0 +1,8 @@ +package dto + + +type GetMauPeriodUsageHistoryDto struct{ + StartTime string `json:"startTime,omitempty"` + EndTime string `json:"endTime,omitempty"` +} + diff --git a/dto/GetOrderDetailDto.go b/dto/GetOrderDetailDto.go new file mode 100644 index 0000000..eccb630 --- /dev/null +++ b/dto/GetOrderDetailDto.go @@ -0,0 +1,7 @@ +package dto + + +type GetOrderDetailDto struct{ + OrderNo string `json:"orderNo,omitempty"` +} + diff --git a/dto/GetOrderPayDetailDto.go b/dto/GetOrderPayDetailDto.go new file mode 100644 index 0000000..31f3756 --- /dev/null +++ b/dto/GetOrderPayDetailDto.go @@ -0,0 +1,7 @@ +package dto + + +type GetOrderPayDetailDto struct{ + OrderNo string `json:"orderNo,omitempty"` +} + diff --git a/dto/GetOrdersDto.go b/dto/GetOrdersDto.go new file mode 100644 index 0000000..ad77d9c --- /dev/null +++ b/dto/GetOrdersDto.go @@ -0,0 +1,8 @@ +package dto + + +type GetOrdersDto struct{ + Page int `json:"page,omitempty"` + Limit int `json:"limit,omitempty"` +} + diff --git a/dto/GetOrdersRes.go b/dto/GetOrdersRes.go new file mode 100644 index 0000000..94394e2 --- /dev/null +++ b/dto/GetOrdersRes.go @@ -0,0 +1,8 @@ +package dto + + +type GetOrdersRes struct{ + TotalCount string `json:"totalCount"` + List []OrderItem `json:"list"` +} + diff --git a/dto/GetResourceAuthorizedTargetDataDto.go b/dto/GetResourceAuthorizedTargetDataDto.go new file mode 100644 index 0000000..bbe19b2 --- /dev/null +++ b/dto/GetResourceAuthorizedTargetDataDto.go @@ -0,0 +1,8 @@ +package dto + + +type GetResourceAuthorizedTargetDataDto struct{ + TotalCount int `json:"totalCount"` + List []ResourceAuthorizedTargetDto `json:"list"` +} + diff --git a/dto/GetResourceAuthorizedTargetRespDto.go b/dto/GetResourceAuthorizedTargetRespDto.go new file mode 100644 index 0000000..1022fa8 --- /dev/null +++ b/dto/GetResourceAuthorizedTargetRespDto.go @@ -0,0 +1,11 @@ +package dto + + +type GetResourceAuthorizedTargetRespDto struct{ + StatusCode int `json:"statusCode"` + Message string `json:"message"` + ApiCode int `json:"apiCode,omitempty"` + RequestId string `json:"requestId,omitempty"` + Data GetResourceAuthorizedTargetDataDto `json:"data"` +} + diff --git a/dto/GetResourceAuthorizedTargetsDto.go b/dto/GetResourceAuthorizedTargetsDto.go new file mode 100644 index 0000000..24fec2d --- /dev/null +++ b/dto/GetResourceAuthorizedTargetsDto.go @@ -0,0 +1,11 @@ +package dto + + +type GetResourceAuthorizedTargetsDto struct{ + Resource string `json:"resource"` + Namespace string `json:"namespace,omitempty"` + TargetType string `json:"targetType,omitempty"` + Page int `json:"page,omitempty"` + Limit int `json:"limit,omitempty"` +} + diff --git a/dto/GoodsPackageDto.go b/dto/GoodsPackageDto.go new file mode 100644 index 0000000..442ffd7 --- /dev/null +++ b/dto/GoodsPackageDto.go @@ -0,0 +1,13 @@ +package dto + + +type GoodsPackageDto struct{ + Name string `json:"name"` + NameEn string `json:"nameEn"` + UnitPrice string `json:"unitPrice"` + Code string `json:"code"` + Group string `json:"group"` + SceneCode string `json:"sceneCode"` + Amount string `json:"amount"` +} + diff --git a/dto/LangUnit.go b/dto/LangUnit.go index 14fcda4..065b278 100644 --- a/dto/LangUnit.go +++ b/dto/LangUnit.go @@ -3,6 +3,6 @@ package dto type LangUnit struct{ Enabled bool `json:"enabled"` - Value bool `json:"value"` + Value string `json:"value"` } diff --git a/dto/ListPipelineFunctionsDto.go b/dto/ListPipelineFunctionsDto.go new file mode 100644 index 0000000..cbb589a --- /dev/null +++ b/dto/ListPipelineFunctionsDto.go @@ -0,0 +1,7 @@ +package dto + + +type ListPipelineFunctionsDto struct{ + Scene string `json:"scene,omitempty"` +} + diff --git a/dto/ListTenantExtIdpDto.go b/dto/ListTenantExtIdpDto.go index d652482..0504e7d 100644 --- a/dto/ListTenantExtIdpDto.go +++ b/dto/ListTenantExtIdpDto.go @@ -5,7 +5,7 @@ type ListTenantExtIdpDto struct{ TenantId string `json:"tenantId,omitempty"` AppId string `json:"appId,omitempty"` Type string `json:"type,omitempty"` - Page string `json:"page,omitempty"` - Limit string `json:"limit,omitempty"` + Page int `json:"page,omitempty"` + Limit int `json:"limit,omitempty"` } diff --git a/dto/MauPeriodUsageHistory.go b/dto/MauPeriodUsageHistory.go new file mode 100644 index 0000000..cbcefee --- /dev/null +++ b/dto/MauPeriodUsageHistory.go @@ -0,0 +1,7 @@ +package dto + + +type MauPeriodUsageHistory struct{ + Records []MauPeriodUsageHistoryDto `json:"records"` +} + diff --git a/dto/MauPeriodUsageHistoryDto.go b/dto/MauPeriodUsageHistoryDto.go new file mode 100644 index 0000000..bd274ae --- /dev/null +++ b/dto/MauPeriodUsageHistoryDto.go @@ -0,0 +1,10 @@ +package dto + + +type MauPeriodUsageHistoryDto struct{ + PeriodStartTime string `json:"periodStartTime"` + PeriodEndTime string `json:"periodEndTime"` + Amount string `json:"amount"` + Current string `json:"current"` +} + diff --git a/dto/OidcDiscoveryMetadata.go b/dto/OidcDiscoveryMetadata.go new file mode 100644 index 0000000..fa07d9a --- /dev/null +++ b/dto/OidcDiscoveryMetadata.go @@ -0,0 +1,30 @@ +package dto + + +type OidcDiscoveryMetadata struct{ + Issuer string `json:"issuer"` + AuthorizationEndpoint string `json:"authorization_endpoint"` + TokenEndpoint string `json:"token_endpoint"` + UserinfoEndpoint string `json:"userinfo_endpoint"` + JwksUri string `json:"jwks_uri"` + ScopesSupported []string `json:"scopes_supported"` + ResponseTypesSupported []string `json:"response_types_supported"` + ResponseModesSupported []string `json:"response_modes_supported"` + GrantTypesSupported []string `json:"grant_types_supported"` + IdTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"` + IdTokenEncryptionAlgValuesSupported []string `json:"id_token_encryption_alg_values_supported"` + IdTokenEncryptionEncValuesSupported []string `json:"id_token_encryption_enc_values_supported"` + UserinfoSigningAlgValuesSupported []string `json:"userinfo_signing_alg_values_supported"` + UserinfoEncryptionAlgValuesSupported []string `json:"userinfo_encryption_alg_values_supported"` + UserinfoEncryptionEncValuesSupported []string `json:"userinfo_encryption_enc_values_supported"` + TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"` + ClaimTypesSupported []string `json:"claim_types_supported"` + ClaimsSupported []string `json:"claims_supported"` + CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"` + EndSessionEndpoint string `json:"end_session_endpoint"` + IntrospectionEndpoint string `json:"introspection_endpoint"` + IntrospectionEndpointAuthMethodsSupported []string `json:"introspection_endpoint_auth_methods_supported"` + RevocationEndpoint string `json:"revocation_endpoint"` + RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported"` +} + diff --git a/dto/OrderItem.go b/dto/OrderItem.go new file mode 100644 index 0000000..35a2230 --- /dev/null +++ b/dto/OrderItem.go @@ -0,0 +1,16 @@ +package dto + + +type OrderItem struct{ + OrderNo string `json:"orderNo"` + GoodsName string `json:"goodsName"` + GoodsNameEn string `json:"goodsNameEn"` + GoodsUnitPrice string `json:"goodsUnitPrice"` + Quantity string `json:"quantity"` + ActualAmount string `json:"actualAmount"` + Status string `json:"status"` + OrderType string `json:"orderType"` + CreateTime string `json:"createTime"` + Source string `json:"source"` +} + diff --git a/dto/PreviewEmailTemplateDto.go b/dto/PreviewEmailTemplateDto.go index 7b58fd3..70d2286 100644 --- a/dto/PreviewEmailTemplateDto.go +++ b/dto/PreviewEmailTemplateDto.go @@ -2,10 +2,10 @@ package dto type PreviewEmailTemplateDto struct{ - Sender string `json:"sender"` Type string `json:"type"` Content string `json:"content,omitempty"` Subject string `json:"subject,omitempty"` + Sender string `json:"sender,omitempty"` ExpiresIn int `json:"expiresIn,omitempty"` TplEngine string `json:"tplEngine,omitempty"` } diff --git a/dto/ResourceAuthorizedTargetDto.go b/dto/ResourceAuthorizedTargetDto.go new file mode 100644 index 0000000..fb52b17 --- /dev/null +++ b/dto/ResourceAuthorizedTargetDto.go @@ -0,0 +1,9 @@ +package dto + + +type ResourceAuthorizedTargetDto struct{ + TargetType string `json:"targetType"` + TargetIdentifier string `json:"targetIdentifier"` + Actions []string `json:"actions"` +} + diff --git a/dto/RevokeApplicationAccessDto.go b/dto/RevokeApplicationAccessDto.go new file mode 100644 index 0000000..6531dab --- /dev/null +++ b/dto/RevokeApplicationAccessDto.go @@ -0,0 +1,8 @@ +package dto + + +type RevokeApplicationAccessDto struct{ + List []DeleteApplicationPermissionRecordItem `json:"list"` + AppId string `json:"appId"` +} + diff --git a/dto/RightItemDto.go b/dto/RightItemDto.go new file mode 100644 index 0000000..e8ef934 --- /dev/null +++ b/dto/RightItemDto.go @@ -0,0 +1,10 @@ +package dto + + +type RightItemDto struct{ + RightsModelCode string `json:"rightsModelCode"` + RightsModelName string `json:"rightsModelName"` + DataType string `json:"dataType"` + DataValue string `json:"dataValue"` +} + diff --git a/dto/RightItemRes.go b/dto/RightItemRes.go new file mode 100644 index 0000000..a04b03c --- /dev/null +++ b/dto/RightItemRes.go @@ -0,0 +1,7 @@ +package dto + + +type RightItemRes struct{ + RightsItems []RightItemDto `json:"rightsItems"` +} + diff --git a/dto/SMTPEmailProviderConfig.go b/dto/SMTPEmailProviderConfig.go index a0746ec..e866c5f 100644 --- a/dto/SMTPEmailProviderConfig.go +++ b/dto/SMTPEmailProviderConfig.go @@ -2,10 +2,10 @@ package dto type SMTPEmailProviderConfig struct{ - SmtpHost string `json:"smtpHost"` - SmtpPort int `json:"smtpPort"` + SmtpHost string `json:"smtp_host"` + SmtpPort int `json:"smtp_port"` Sender string `json:"sender"` SenderPass string `json:"senderPass"` - EnableSSL bool `json:"enableSSL"` + Secure bool `json:"secure"` } diff --git a/dto/SMTPEmailProviderConfigInput.go b/dto/SMTPEmailProviderConfigInput.go index 241fb68..f6cc0a4 100644 --- a/dto/SMTPEmailProviderConfigInput.go +++ b/dto/SMTPEmailProviderConfigInput.go @@ -2,10 +2,10 @@ package dto type SMTPEmailProviderConfigInput struct{ - SmtpHost string `json:"smtpHost"` - SmtpPort int `json:"smtpPort"` - Sender string `json:"sender"` + SmtpHost string `json:"smtp_host"` + SmtpPort int `json:"smtp_port"` + Sender string `json:"sender,omitempty"` SenderPass string `json:"senderPass"` - EnableSSL bool `json:"enableSSL"` + Secure bool `json:"secure,omitempty"` } diff --git a/dto/SignInByApplePayloadDto.go b/dto/SignInByApplePayloadDto.go new file mode 100644 index 0000000..8106f20 --- /dev/null +++ b/dto/SignInByApplePayloadDto.go @@ -0,0 +1,7 @@ +package dto + + +type SignInByApplePayloadDto struct{ + Code string `json:"code,omitempty"` +} + diff --git a/dto/SignInByWechatworkDto.go b/dto/SignInByWechatworkDto.go new file mode 100644 index 0000000..aebaf8f --- /dev/null +++ b/dto/SignInByWechatworkDto.go @@ -0,0 +1,7 @@ +package dto + + +type SignInByWechatworkDto struct{ + Code string `json:"code,omitempty"` +} + diff --git a/dto/SigninByMobileDto.go b/dto/SigninByMobileDto.go index 481b6e8..4b27387 100644 --- a/dto/SigninByMobileDto.go +++ b/dto/SigninByMobileDto.go @@ -5,8 +5,9 @@ type SigninByMobileDto struct{ ExtIdpConnidentifier string `json:"extIdpConnidentifier"` Connection string `json:"connection"` WechatPayload SignInByWechatPayloadDto `json:"wechatPayload,omitempty"` + ApplePayload SignInByApplePayloadDto `json:"applePayload,omitempty"` AlipayPayload SignInByAlipayPayloadDto `json:"alipayPayload,omitempty"` - WechatworkPayload AuthenticateByWechatworkDto `json:"wechatworkPayload,omitempty"` + WechatworkPayload SignInByWechatworkDto `json:"wechatworkPayload,omitempty"` WechatworkAgencyPayload SignInByWechatworkAgencyPayloadDto `json:"wechatworkAgencyPayload,omitempty"` LarkPublicPayload SignInByLarkPublicPayloadDto `json:"larkPublicPayload,omitempty"` LarkInternalPayload SignInByLarkInternalPayloadDto `json:"larkInternalPayload,omitempty"` diff --git a/dto/SignupDto.go b/dto/SignupDto.go index fbca2f4..782955a 100644 --- a/dto/SignupDto.go +++ b/dto/SignupDto.go @@ -1,11 +1,11 @@ package dto -type SignupDto struct{ +type SignUpDto struct{ Connection string `json:"connection"` PasswordPayload SignUpByPasswordDto `json:"passwordPayload,omitempty"` PassCodePayload SignUpByPassCodeDto `json:"passCodePayload,omitempty"` - Profile SignupProfileDto `json:"profile,omitempty"` - Options SignupOptionsDto `json:"options,omitempty"` + Profile SignUpProfileDto `json:"profile,omitempty"` + Options SignUpOptionsDto `json:"options,omitempty"` } diff --git a/dto/SignupOptionsDto.go b/dto/SignupOptionsDto.go index 7b04191..45e890d 100644 --- a/dto/SignupOptionsDto.go +++ b/dto/SignupOptionsDto.go @@ -1,7 +1,7 @@ package dto -type SignupOptionsDto struct{ +type SignUpOptionsDto struct{ ClientIp string `json:"clientIp,omitempty"` PhonePassCodeForInformationCompletion string `json:"phonePassCodeForInformationCompletion,omitempty"` EmailPassCodeForInformationCompletion string `json:"emailPassCodeForInformationCompletion,omitempty"` diff --git a/dto/SignupProfileDto.go b/dto/SignupProfileDto.go index 35ae2d6..b40af2c 100644 --- a/dto/SignupProfileDto.go +++ b/dto/SignupProfileDto.go @@ -1,7 +1,7 @@ package dto -type SignupProfileDto struct{ +type SignUpProfileDto struct{ Nickname string `json:"nickname,omitempty"` Company string `json:"company,omitempty"` Photo string `json:"photo,omitempty"` diff --git a/dto/SyncTaskDto.go b/dto/SyncTaskDto.go index 1f9f6af..dc6b7a8 100644 --- a/dto/SyncTaskDto.go +++ b/dto/SyncTaskDto.go @@ -9,7 +9,7 @@ type SyncTaskDto struct{ SyncTaskType string `json:"syncTaskType"` SyncFlow string `json:"syncFlow"` SyncTrigger string `json:"syncTrigger"` - LastSyncMessage bool `json:"lastSyncMessage,omitempty"` + LastSyncMessage string `json:"lastSyncMessage,omitempty"` LastSyncRate int `json:"lastSyncRate,omitempty"` LastSyncStatus string `json:"lastSyncStatus,omitempty"` LastSyncTime string `json:"lastSyncTime,omitempty"` diff --git a/dto/TokenEndPointParams.go b/dto/TokenEndPointParams.go new file mode 100644 index 0000000..d5556de --- /dev/null +++ b/dto/TokenEndPointParams.go @@ -0,0 +1,13 @@ +package dto + + +type TokenEndPointParams struct{ + ClientId string `json:"client_id,omitempty"` + ClientSecret string `json:"client_secret,omitempty"` + GrantType string `json:"grant_type"` + RedirectUri string `json:"redirect_uri"` + Code string `json:"code,omitempty"` + CodeVerifier string `json:"code_verifier,omitempty"` + RefreshToken string `json:"refresh_token,omitempty"` +} + diff --git a/dto/TokenIntrospectEndpointParams.go b/dto/TokenIntrospectEndpointParams.go new file mode 100644 index 0000000..290db39 --- /dev/null +++ b/dto/TokenIntrospectEndpointParams.go @@ -0,0 +1,9 @@ +package dto + + +type TokenIntrospectEndpointParams struct{ + ClientId string `json:"client_id,omitempty"` + ClientSecret string `json:"client_secret,omitempty"` + Token string `json:"token"` +} + diff --git a/dto/TokenIntrospectResponse.go b/dto/TokenIntrospectResponse.go new file mode 100644 index 0000000..6de7e05 --- /dev/null +++ b/dto/TokenIntrospectResponse.go @@ -0,0 +1,15 @@ +package dto + + +type TokenIntrospectResponse struct{ + Active bool `json:"active"` + Sub string `json:"sub,omitempty"` + ClientId string `json:"client_id,omitempty"` + Exp int `json:"exp,omitempty"` + Iat int `json:"iat,omitempty"` + Iss string `json:"iss,omitempty"` + Jti string `json:"jti,omitempty"` + Scope string `json:"scope,omitempty"` + TokenType string `json:"token_type,omitempty"` +} + diff --git a/dto/TokenRevocationEndpointParams.go b/dto/TokenRevocationEndpointParams.go new file mode 100644 index 0000000..4ca958c --- /dev/null +++ b/dto/TokenRevocationEndpointParams.go @@ -0,0 +1,9 @@ +package dto + + +type TokenRevocationEndpointParams struct{ + ClientId string `json:"client_id,omitempty"` + ClientSecret string `json:"client_secret,omitempty"` + Token string `json:"token"` +} + diff --git a/dto/UnlinkExtIdpDto.go b/dto/UnlinkExtIdpDto.go new file mode 100644 index 0000000..1694764 --- /dev/null +++ b/dto/UnlinkExtIdpDto.go @@ -0,0 +1,7 @@ +package dto + + +type UnlinkExtIdpDto struct{ + ExtIdpId string `json:"extIdpId"` +} + diff --git a/dto/UpdateGroupReqDto.go b/dto/UpdateGroupReqDto.go index 2278bb4..72223d3 100644 --- a/dto/UpdateGroupReqDto.go +++ b/dto/UpdateGroupReqDto.go @@ -3,8 +3,8 @@ package dto type UpdateGroupReqDto struct{ Description string `json:"description"` - Name string `json:"name"` Code string `json:"code"` + Name string `json:"name,omitempty"` NewCode string `json:"newCode,omitempty"` } diff --git a/dto/UpdateUserInfoDto.go b/dto/UpdateUserInfoDto.go index 7051ab3..02b8a7b 100644 --- a/dto/UpdateUserInfoDto.go +++ b/dto/UpdateUserInfoDto.go @@ -20,7 +20,6 @@ type UpdateUserInfoDto struct{ PostalCode string `json:"postalCode,omitempty"` Gender string `json:"gender,omitempty"` Username string `json:"username,omitempty"` - PasswordEncryptType string `json:"passwordEncryptType,omitempty"` Email string `json:"email,omitempty"` Phone string `json:"phone,omitempty"` Password string `json:"password,omitempty"` diff --git a/dto/UpdateUserReqDto.go b/dto/UpdateUserReqDto.go index 171078e..ee5521f 100644 --- a/dto/UpdateUserReqDto.go +++ b/dto/UpdateUserReqDto.go @@ -20,7 +20,6 @@ type UpdateUserReqDto struct{ PostalCode string `json:"postalCode,omitempty"` Gender string `json:"gender,omitempty"` Username string `json:"username,omitempty"` - PasswordEncryptType string `json:"passwordEncryptType,omitempty"` Email string `json:"email,omitempty"` Phone string `json:"phone,omitempty"` Password string `json:"password,omitempty"` diff --git a/dto/UserDto.go b/dto/UserDto.go index a702c6c..56154bb 100644 --- a/dto/UserDto.go +++ b/dto/UserDto.go @@ -6,6 +6,7 @@ type UserDto struct{ CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` Status string `json:"status"` + WorkStatus string `json:"workStatus"` ExternalId string `json:"externalId,omitempty"` Email string `json:"email,omitempty"` Phone string `json:"phone,omitempty"` diff --git a/dto/ValidatePEMKeyDto.go b/dto/ValidatePEMKeyDto.go new file mode 100644 index 0000000..1e51262 --- /dev/null +++ b/dto/ValidatePEMKeyDto.go @@ -0,0 +1,6 @@ +package dto + + +type ValidatePEMKeyDto struct{ +} + diff --git a/dto/VerifyUpdateEmailRequestDto.go b/dto/VerifyUpdateEmailRequestDto.go index 6a45200..3d46ad9 100644 --- a/dto/VerifyUpdateEmailRequestDto.go +++ b/dto/VerifyUpdateEmailRequestDto.go @@ -2,7 +2,7 @@ package dto type VerifyUpdateEmailRequestDto struct{ - EmailPasscodePayload UpdateEmailByEmailPassCodeDto `json:"emailPasscodePayload"` + EmailPassCodePayload UpdateEmailByEmailPassCodeDto `json:"emailPassCodePayload"` VerifyMethod string `json:"verifyMethod"` } diff --git a/management/management_client.go b/management/management_client.go index 930bcf5..f4cffcd 100644 --- a/management/management_client.go +++ b/management/management_client.go @@ -8,296 +8,183 @@ import ( ) /* -* @summary 获取/搜索用户列表 -* @description -* 此接口用于获取用户列表,支持模糊搜索,以及通过用户基础字段、用户自定义字段、用户所在部门、用户历史登录应用等维度筛选用户。 -* -* ### 模糊搜素示例 -* -* 模糊搜索默认会从 `phone`, `email`, `name`, `username`, `nickname` 五个字段对用户进行模糊搜索,你也可以通过设置 `options.fuzzySearchOn` -* 决定模糊匹配的字段范围: -* -* ```json -* { - - - "query": "北京", - - - "options": { - - - "fuzzySearchOn": [ - - - "address" - - - ] - - - } - - - } - - - ``` - * - - - ### 高级搜索示例 - * - - - 你可以通过 `advancedFilter` 进行高级搜索,高级搜索支持通过用户的基础信息、自定义数据、所在部门、用户来源、登录应用、外部身份源信息等维度对用户进行筛选。 - - - **且这些筛选条件可以任意组合。** - * - - - #### 筛选状态为禁用的用户 - * - - - 用户状态(`status`)为字符串类型,可选值为 `Activated` 和 `Suspended`: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "status", - - - "operator": "EQUAL", - - - "value": "Suspended" - - - } - - - ] - - - } - - - ``` - * - - - #### 筛选邮箱中包含 `@example.com` 的用户 - * - - - 用户邮箱(`email`)为字符串类型,可以进行模糊搜索: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "email", - - - "operator": "CONTAINS", - - - "value": "@example.com" - - - } - - - ] - - - } - - - ``` - * - - - #### 根据用户登录次数筛选 - * - - - 筛选登录次数大于 10 的用户: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "loginsCount", - - - "operator": "GREATER", - - - "value": 10 - - - } - - - ] - - - } - - - ``` - * - - - 筛选登录次数在 10 - 100 次的用户: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "loginsCount", - - - "operator": "BETWEEN", - - - "value": [10, 100] - - - } - - - ] - - - } - - - ``` - * - - - #### 根据用户上次登录时间进行筛选 - * - - - 筛选最近 7 天内登录过的用户: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "lastLoginTime", - - - "operator": "GREATER", - - - "value": new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) - - - } - - - ] - - - } - - - ``` - * - - - 筛选在某一段时间内登录过的用户: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "lastLoginTime", - - - "operator": "BETWEEN", - - - "value": [ - - - new Date(Date.now() - 14 * 24 * 60 * 60 * 1000), - - - new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) - - - ] - - - } - - - ] - - - } - - - ``` - * - - - #### 根据用户曾经登录过的应用筛选 - * - - - 筛选出曾经登录过应用 `appId1` 或者 `appId2` 的用户: - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "loggedInApps", - - - "operator": "IN", - - - "value": [ - - - "appId1", - - - "appId2" - - - ] - - - } - - - ] - - - } - - - ``` - * - - - #### 根据用户所在部门进行筛选 - * - - - ```json - - - { - - - "advancedFilter": [ - - - { - - - "field": "department", - - - "operator": "IN", - - - "value": [ - - - { - - - "organizationCode": "steamory", - - - "departmentId": "root", - - - "departmentIdType": "department_id", - - - "includeChildrenDepartments": true - - - } - - - ] - - - } - - - ] - - - } - - - ``` - * - * - - - @param requestBody - - - @returns UserPaginatedRespDto + * @summary 获取/搜索用户列表 + * @description + * 此接口用于获取用户列表,支持模糊搜索,以及通过用户基础字段、用户自定义字段、用户所在部门、用户历史登录应用等维度筛选用户。 + * + * ### 模糊搜素示例 + * + * 模糊搜索默认会从 `phone`, `email`, `name`, `username`, `nickname` 五个字段对用户进行模糊搜索,你也可以通过设置 `options.fuzzySearchOn` + * 决定模糊匹配的字段范围: + * + * ```json + * { + * "query": "北京", + * "options": { + * "fuzzySearchOn": [ + * "address" + * ] + * } + * } + * ``` + * + * ### 高级搜索示例 + * + * 你可以通过 `advancedFilter` 进行高级搜索,高级搜索支持通过用户的基础信息、自定义数据、所在部门、用户来源、登录应用、外部身份源信息等维度对用户进行筛选。 + * **且这些筛选条件可以任意组合。** + * + * #### 筛选状态为禁用的用户 + * + * 用户状态(`status`)为字符串类型,可选值为 `Activated` 和 `Suspended`: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "status", + * "operator": "EQUAL", + * "value": "Suspended" + * } + * ] + * } + * ``` + * + * #### 筛选邮箱中包含 `@example.com` 的用户 + * + * 用户邮箱(`email`)为字符串类型,可以进行模糊搜索: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "email", + * "operator": "CONTAINS", + * "value": "@example.com" + * } + * ] + * } + * ``` + * + * #### 根据用户的任意扩展字段进行搜索 + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "some-custom-key", + * "operator": "EQUAL", + * "value": "some-value" + * } + * ] + * } + * ``` + * + * #### 根据用户登录次数筛选 + * + * 筛选登录次数大于 10 的用户: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "loginsCount", + * "operator": "GREATER", + * "value": 10 + * } + * ] + * } + * ``` + * + * 筛选登录次数在 10 - 100 次的用户: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "loginsCount", + * "operator": "BETWEEN", + * "value": [10, 100] + * } + * ] + * } + * ``` + * + * #### 根据用户上次登录时间进行筛选 + * + * 筛选最近 7 天内登录过的用户: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "lastLoginTime", + * "operator": "GREATER", + * "value": new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) + * } + * ] + * } + * ``` + * + * 筛选在某一段时间内登录过的用户: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "lastLoginTime", + * "operator": "BETWEEN", + * "value": [ + * new Date(Date.now() - 14 * 24 * 60 * 60 * 1000), + * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) + * ] + * } + * ] + * } + * ``` + * + * #### 根据用户曾经登录过的应用筛选 + * + * 筛选出曾经登录过应用 `appId1` 或者 `appId2` 的用户: + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "loggedInApps", + * "operator": "IN", + * "value": [ + * "appId1", + * "appId2" + * ] + * } + * ] + * } + * ``` + * + * #### 根据用户所在部门进行筛选 + * + * ```json + * { + * "advancedFilter": [ + * { + * "field": "department", + * "operator": "IN", + * "value": [ + * { + * "organizationCode": "steamory", + * "departmentId": "root", + * "departmentIdType": "department_id", + * "includeChildrenDepartments": true + * } + * ] + * } + * ] + * } + * ``` + * + * + * @param requestBody + * @returns UserPaginatedRespDto */ func (client *ManagementClient) ListUsers(reqDto *dto.ListUsersRequestDto) *dto.UserPaginatedRespDto { b, err := client.SendHttpRequest("/api/v3/list-users", fasthttp.MethodPost, reqDto) @@ -410,23 +297,14 @@ func (client *ManagementClient) GetUserBatch(reqDto *dto.GetUserBatchDto) *dto.U } /* - * @summary 获取用户的外部身份源 - * @description 通过用户 ID,获取用户的外部身份源、选择指定用户 ID 类型。 - * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 - * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: - * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` - * - `phone`: 用户手机号 - * - `email`: 用户邮箱 - * - `username`: 用户名 - * - `external_id`: 用户在外部系统的 ID,对应 Authing 用户信息的 `externalId` 字段 - * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 - * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 - * - * @returns IdentityListRespDto + * @summary 创建用户 + * @description 创建用户,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建用户因此不需要进行手机号验证码检验等安全检测。 + * @param requestBody + * @returns UserSingleRespDto */ -func (client *ManagementClient) GetUserIdentities(reqDto *dto.GetUserIdentitiesDto) *dto.IdentityListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-identities", fasthttp.MethodGet, reqDto) - var response dto.IdentityListRespDto +func (client *ManagementClient) CreateUser(reqDto *dto.CreateUserReqDto) *dto.UserSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/create-user", fasthttp.MethodPost, reqDto) + var response dto.UserSingleRespDto if err != nil { fmt.Println(err) return nil @@ -440,24 +318,14 @@ func (client *ManagementClient) GetUserIdentities(reqDto *dto.GetUserIdentitiesD } /* - * @summary 获取用户角色列表 - * @description 通过用户 ID,获取用户角色列表,可以选择所属权限分组 code、选择指定用户 ID 类型等。 - * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 - * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: - * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` - * - `phone`: 用户手机号 - * - `email`: 用户邮箱 - * - `username`: 用户名 - * - `external_id`: 用户在外部系统的 ID,对应 Authing 用户信息的 `externalId` 字段 - * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 - * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 - * - * @param namespace 所属权限分组的 code - * @returns RolePaginatedRespDto + * @summary 批量创建用户 + * @description 批量创建用户,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建用户因此不需要进行手机号验证码检验等安全检测。 + * @param requestBody + * @returns UserListRespDto */ -func (client *ManagementClient) GetUserRoles(reqDto *dto.GetUserRolesDto) *dto.RolePaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-roles", fasthttp.MethodGet, reqDto) - var response dto.RolePaginatedRespDto +func (client *ManagementClient) CreateUsersBatch(reqDto *dto.CreateUserBatchReqDto) *dto.UserListRespDto { + b, err := client.SendHttpRequest("/api/v3/create-users-batch", fasthttp.MethodPost, reqDto) + var response dto.UserListRespDto if err != nil { fmt.Println(err) return nil @@ -471,23 +339,14 @@ func (client *ManagementClient) GetUserRoles(reqDto *dto.GetUserRolesDto) *dto.R } /* - * @summary 获取用户实名认证信息 - * @description 通过用户 ID,获取用户实名认证信息,可以选择指定用户 ID 类型。 - * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 - * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: - * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` - * - `phone`: 用户手机号 - * - `email`: 用户邮箱 - * - `username`: 用户名 - * - `external_id`: 用户在外部系统的 ID,对应 Authing 用户信息的 `externalId` 字段 - * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 - * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 - * - * @returns PrincipalAuthenticationInfoPaginatedRespDto + * @summary 修改用户资料 + * @description 通过用户 ID,修改用户资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改用户资料因此不需要进行手机号验证码检验等安全检测。 + * @param requestBody + * @returns UserSingleRespDto */ -func (client *ManagementClient) GetUserPrincipalAuthenticationInfo(reqDto *dto.GetUserPrincipalAuthenticationInfoDto) *dto.PrincipalAuthenticationInfoPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-principal-authentication-info", fasthttp.MethodGet, reqDto) - var response dto.PrincipalAuthenticationInfoPaginatedRespDto +func (client *ManagementClient) UpdateUser(reqDto *dto.UpdateUserReqDto) *dto.UserSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/update-user", fasthttp.MethodPost, reqDto) + var response dto.UserSingleRespDto if err != nil { fmt.Println(err) return nil @@ -501,13 +360,34 @@ func (client *ManagementClient) GetUserPrincipalAuthenticationInfo(reqDto *dto.G } /* - * @summary 删除用户实名认证信息 - * @description 通过用户 ID,删除用户实名认证信息,可以选择指定用户 ID 类型等。 + * @summary 批量修改用户资料 + * @description 批量修改用户资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改用户资料因此不需要进行手机号验证码检验等安全检测。 + * @param requestBody + * @returns UserListRespDto + */ +func (client *ManagementClient) UpdateUserBatch(reqDto *dto.UpdateUserBatchReqDto) *dto.UserListRespDto { + b, err := client.SendHttpRequest("/api/v3/update-user-batch", fasthttp.MethodPost, reqDto) + var response dto.UserListRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 删除用户 + * @description 通过用户 ID 列表,删除用户,支持批量删除,可以选择指定用户 ID 类型等。 * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) ResetUserPrincipalAuthenticationInfo(reqDto *dto.ResetUserPrincipalAuthenticationInfoDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/reset-user-principal-authentication-info", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) DeleteUsersBatch(reqDto *dto.DeleteUsersBatchDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/delete-users-batch", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -522,8 +402,8 @@ func (client *ManagementClient) ResetUserPrincipalAuthenticationInfo(reqDto *dto } /* - * @summary 获取用户部门列表 - * @description 通过用户 ID,获取用户部门列表,支持分页,可以选择获取自定义数据、选择指定用户 ID 类型、增序或降序等。 + * @summary 获取用户的外部身份源 + * @description 通过用户 ID,获取用户的外部身份源、选择指定用户 ID 类型。 * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` @@ -534,16 +414,11 @@ func (client *ManagementClient) ResetUserPrincipalAuthenticationInfo(reqDto *dto * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 * - * @param page 当前页数,从 1 开始 - * @param limit 每页数目,最大不能超过 50,默认为 10 - * @param withCustomData 是否获取自定义数据 - * @param sortBy 排序依据,如 部门创建时间、加入部门时间、部门名称、部门标志符 - * @param orderBy 增序或降序 - * @returns UserDepartmentPaginatedRespDto + * @returns IdentityListRespDto */ -func (client *ManagementClient) GetUserDepartments(reqDto *dto.GetUserDepartmentsDto) *dto.UserDepartmentPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-departments", fasthttp.MethodGet, reqDto) - var response dto.UserDepartmentPaginatedRespDto +func (client *ManagementClient) GetUserIdentities(reqDto *dto.GetUserIdentitiesDto) *dto.IdentityListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-identities", fasthttp.MethodGet, reqDto) + var response dto.IdentityListRespDto if err != nil { fmt.Println(err) return nil @@ -557,14 +432,24 @@ func (client *ManagementClient) GetUserDepartments(reqDto *dto.GetUserDepartment } /* - * @summary 设置用户所在部门 - * @description 通过用户 ID,设置用户所在部门,可以选择指定用户 ID 类型等。 - * @param requestBody - * @returns IsSuccessRespDto + * @summary 获取用户角色列表 + * @description 通过用户 ID,获取用户角色列表,可以选择所属权限分组 code、选择指定用户 ID 类型等。 + * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 + * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: + * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` + * - `phone`: 用户手机号 + * - `email`: 用户邮箱 + * - `username`: 用户名 + * - `external_id`: 用户在外部系统的 ID,对应 Authing 用户信息的 `externalId` 字段 + * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 + * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 + * + * @param namespace 所属权限分组的 code + * @returns RolePaginatedRespDto */ -func (client *ManagementClient) SetUserDepartments(reqDto *dto.SetUserDepartmentsDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/set-user-departments", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) GetUserRoles(reqDto *dto.GetUserRolesDto) *dto.RolePaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-roles", fasthttp.MethodGet, reqDto) + var response dto.RolePaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -578,8 +463,8 @@ func (client *ManagementClient) SetUserDepartments(reqDto *dto.SetUserDepartment } /* - * @summary 获取用户分组列表 - * @description 通过用户 ID,获取用户分组列表,可以选择指定用户 ID 类型等。 + * @summary 获取用户实名认证信息 + * @description 通过用户 ID,获取用户实名认证信息,可以选择指定用户 ID 类型。 * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` @@ -590,11 +475,11 @@ func (client *ManagementClient) SetUserDepartments(reqDto *dto.SetUserDepartment * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 * - * @returns GroupPaginatedRespDto + * @returns PrincipalAuthenticationInfoPaginatedRespDto */ -func (client *ManagementClient) GetUserGroups(reqDto *dto.GetUserGroupsDto) *dto.GroupPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-groups", fasthttp.MethodGet, reqDto) - var response dto.GroupPaginatedRespDto +func (client *ManagementClient) GetUserPrincipalAuthenticationInfo(reqDto *dto.GetUserPrincipalAuthenticationInfoDto) *dto.PrincipalAuthenticationInfoPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-principal-authentication-info", fasthttp.MethodGet, reqDto) + var response dto.PrincipalAuthenticationInfoPaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -608,13 +493,13 @@ func (client *ManagementClient) GetUserGroups(reqDto *dto.GetUserGroupsDto) *dto } /* - * @summary 删除用户 - * @description 通过用户 ID 列表,删除用户,支持批量删除,可以选择指定用户 ID 类型等。 + * @summary 删除用户实名认证信息 + * @description 通过用户 ID,删除用户实名认证信息,可以选择指定用户 ID 类型等。 * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) DeleteUsersBatch(reqDto *dto.DeleteUsersBatchDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/delete-users-batch", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) ResetUserPrincipalAuthenticationInfo(reqDto *dto.ResetUserPrincipalAuthenticationInfoDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/reset-user-principal-authentication-info", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -629,8 +514,8 @@ func (client *ManagementClient) DeleteUsersBatch(reqDto *dto.DeleteUsersBatchDto } /* - * @summary 获取用户 MFA 绑定信息 - * @description 通过用户 ID,获取用户 MFA 绑定信息,可以选择指定用户 ID 类型等。 + * @summary 获取用户部门列表 + * @description 通过用户 ID,获取用户部门列表,支持分页,可以选择获取自定义数据、选择指定用户 ID 类型、增序或降序等。 * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` @@ -641,34 +526,16 @@ func (client *ManagementClient) DeleteUsersBatch(reqDto *dto.DeleteUsersBatchDto * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 * - * @returns UserMfaSingleRespDto - */ -func (client *ManagementClient) GetUserMfaInfo(reqDto *dto.GetUserMfaInfoDto) *dto.UserMfaSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-mfa-info", fasthttp.MethodGet, reqDto) - var response dto.UserMfaSingleRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) - if err != nil { - fmt.Println(err) - return nil - } - return &response -} - -/* - * @summary 获取已归档的用户列表 - * @description 获取已归档的用户列表,支持分页,可以筛选开始时间等。 * @param page 当前页数,从 1 开始 * @param limit 每页数目,最大不能超过 50,默认为 10 - * @param startAt 开始时间,为精确到秒的 UNIX 时间戳,默认不指定 - * @returns ListArchivedUsersSingleRespDto + * @param withCustomData 是否获取自定义数据 + * @param sortBy 排序依据,如 部门创建时间、加入部门时间、部门名称、部门标志符 + * @param orderBy 增序或降序 + * @returns UserDepartmentPaginatedRespDto */ -func (client *ManagementClient) ListArchivedUsers(reqDto *dto.ListArchivedUsersDto) *dto.ListArchivedUsersSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/list-archived-users", fasthttp.MethodGet, reqDto) - var response dto.ListArchivedUsersSingleRespDto +func (client *ManagementClient) GetUserDepartments(reqDto *dto.GetUserDepartmentsDto) *dto.UserDepartmentPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-departments", fasthttp.MethodGet, reqDto) + var response dto.UserDepartmentPaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -682,13 +549,13 @@ func (client *ManagementClient) ListArchivedUsers(reqDto *dto.ListArchivedUsersD } /* - * @summary 强制下线用户 - * @description 通过用户 ID、App ID 列表,强制让用户下线,可以选择指定用户 ID 类型等。 + * @summary 设置用户所在部门 + * @description 通过用户 ID,设置用户所在部门,可以选择指定用户 ID 类型等。 * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) KickUsers(reqDto *dto.KickUsersDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/kick-users", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) SetUserDepartments(reqDto *dto.SetUserDepartmentsDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/set-user-departments", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -703,14 +570,23 @@ func (client *ManagementClient) KickUsers(reqDto *dto.KickUsersDto) *dto.IsSucce } /* - * @summary 判断用户是否存在 - * @description 根据条件判断用户是否存在,可以筛选用户名、邮箱、手机号、第三方外部 ID 等。 - * @param requestBody - * @returns IsUserExistsRespDto + * @summary 获取用户分组列表 + * @description 通过用户 ID,获取用户分组列表,可以选择指定用户 ID 类型等。 + * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 + * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: + * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` + * - `phone`: 用户手机号 + * - `email`: 用户邮箱 + * - `username`: 用户名 + * - `external_id`: 用户在外部系统的 ID,对应 Authing 用户信息的 `externalId` 字段 + * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 + * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 + * + * @returns GroupPaginatedRespDto */ -func (client *ManagementClient) IsUserExists(reqDto *dto.IsUserExistsReqDto) *dto.IsUserExistsRespDto { - b, err := client.SendHttpRequest("/api/v3/is-user-exists", fasthttp.MethodPost, reqDto) - var response dto.IsUserExistsRespDto +func (client *ManagementClient) GetUserGroups(reqDto *dto.GetUserGroupsDto) *dto.GroupPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-groups", fasthttp.MethodGet, reqDto) + var response dto.GroupPaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -724,14 +600,23 @@ func (client *ManagementClient) IsUserExists(reqDto *dto.IsUserExistsReqDto) *dt } /* - * @summary 创建用户 - * @description 创建用户,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份创建用户因此不需要进行手机号验证码检验等安全检测。 - * @param requestBody - * @returns UserSingleRespDto + * @summary 获取用户 MFA 绑定信息 + * @description 通过用户 ID,获取用户 MFA 绑定信息,可以选择指定用户 ID 类型等。 + * @param userId 用户唯一标志,可以是用户 ID、用户名、邮箱、手机号、外部 ID、在外部身份源的 ID。 + * @param userIdType 用户 ID 类型,默认值为 `user_id`,可选值为: + * - `user_id`: Authing 用户 ID,如 `6319a1504f3xxxxf214dd5b7` + * - `phone`: 用户手机号 + * - `email`: 用户邮箱 + * - `username`: 用户名 + * - `external_id`: 用户在外部系统的 ID,对应 Authing 用户信息的 `externalId` 字段 + * - `identity`: 用户的外部身份源信息,格式为 `:`,其中 `` 为 Authing 身份源的 ID,`` 为用户在外部身份源的 ID。 + * 示例值:`62f20932716fbcc10d966ee5:ou_8bae746eac07cd2564654140d2a9ac61`。 + * + * @returns UserMfaSingleRespDto */ -func (client *ManagementClient) CreateUser(reqDto *dto.CreateUserReqDto) *dto.UserSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/create-user", fasthttp.MethodPost, reqDto) - var response dto.UserSingleRespDto +func (client *ManagementClient) GetUserMfaInfo(reqDto *dto.GetUserMfaInfoDto) *dto.UserMfaSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-mfa-info", fasthttp.MethodGet, reqDto) + var response dto.UserMfaSingleRespDto if err != nil { fmt.Println(err) return nil @@ -745,14 +630,16 @@ func (client *ManagementClient) CreateUser(reqDto *dto.CreateUserReqDto) *dto.Us } /* - * @summary 批量创建用户 - * @description 批量创建用户,邮箱、手机号、用户名必须包含其中一个,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份批量创建用户因此不需要进行手机号验证码检验等安全检测。 - * @param requestBody - * @returns UserListRespDto + * @summary 获取已归档的用户列表 + * @description 获取已归档的用户列表,支持分页,可以筛选开始时间等。 + * @param page 当前页数,从 1 开始 + * @param limit 每页数目,最大不能超过 50,默认为 10 + * @param startAt 开始时间,为精确到秒的 UNIX 时间戳,默认不指定 + * @returns ListArchivedUsersSingleRespDto */ -func (client *ManagementClient) CreateUsersBatch(reqDto *dto.CreateUserBatchReqDto) *dto.UserListRespDto { - b, err := client.SendHttpRequest("/api/v3/create-users-batch", fasthttp.MethodPost, reqDto) - var response dto.UserListRespDto +func (client *ManagementClient) ListArchivedUsers(reqDto *dto.ListArchivedUsersDto) *dto.ListArchivedUsersSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/list-archived-users", fasthttp.MethodGet, reqDto) + var response dto.ListArchivedUsersSingleRespDto if err != nil { fmt.Println(err) return nil @@ -766,14 +653,14 @@ func (client *ManagementClient) CreateUsersBatch(reqDto *dto.CreateUserBatchReqD } /* - * @summary 修改用户资料 - * @description 通过用户 ID,修改用户资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改用户资料因此不需要进行手机号验证码检验等安全检测。 + * @summary 强制下线用户 + * @description 通过用户 ID、App ID 列表,强制让用户下线,可以选择指定用户 ID 类型等。 * @param requestBody - * @returns UserSingleRespDto + * @returns IsSuccessRespDto */ -func (client *ManagementClient) UpdateUser(reqDto *dto.UpdateUserReqDto) *dto.UserSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/update-user", fasthttp.MethodPost, reqDto) - var response dto.UserSingleRespDto +func (client *ManagementClient) KickUsers(reqDto *dto.KickUsersDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/kick-users", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) return nil @@ -787,14 +674,14 @@ func (client *ManagementClient) UpdateUser(reqDto *dto.UpdateUserReqDto) *dto.Us } /* - * @summary 修改用户资料 - * @description 通过用户 ID,修改用户资料,邮箱、手机号、用户名、externalId 用户池内唯一,此接口将以管理员身份修改用户资料因此不需要进行手机号验证码检验等安全检测。 + * @summary 判断用户是否存在 + * @description 根据条件判断用户是否存在,可以筛选用户名、邮箱、手机号、第三方外部 ID 等。 * @param requestBody - * @returns UserListRespDto + * @returns IsUserExistsRespDto */ -func (client *ManagementClient) UpdateUserBatch(reqDto *dto.UpdateUserBatchReqDto) *dto.UserListRespDto { - b, err := client.SendHttpRequest("/api/v3/update-user-batch", fasthttp.MethodPost, reqDto) - var response dto.UserListRespDto +func (client *ManagementClient) IsUserExists(reqDto *dto.IsUserExistsReqDto) *dto.IsUserExistsRespDto { + b, err := client.SendHttpRequest("/api/v3/is-user-exists", fasthttp.MethodPost, reqDto) + var response dto.IsUserExistsRespDto if err != nil { fmt.Println(err) return nil @@ -1145,8 +1032,8 @@ func (client *ManagementClient) GetOrganizationsBatch(reqDto *dto.GetOrganizatio } /* - * @summary 获取顶层组织机构列表 - * @description 获取顶层组织机构列表,支持分页。 + * @summary 获取组织机构列表 + * @description 获取组织机构列表,支持分页。 * @param page 当前页数,从 1 开始 * @param limit 每页数目,最大不能超过 50,默认为 10 * @param fetchAll 拉取所有 @@ -1169,7 +1056,7 @@ func (client *ManagementClient) ListOrganizations(reqDto *dto.ListOrganizationsD } /* - * @summary 创建顶层组织机构 + * @summary 创建组织机构 * @description 创建组织机构,会创建一个只有一个节点的组织机构,可以选择组织描述信息、根节点自定义 ID、多语言等。 * @param requestBody * @returns OrganizationSingleRespDto @@ -1190,8 +1077,8 @@ func (client *ManagementClient) CreateOrganization(reqDto *dto.CreateOrganizatio } /* - * @summary 修改顶层组织机构 - * @description 通过组织 code,修改顶层组织机构,可以选择部门描述、新组织 code、组织名称等。 + * @summary 修改组织机构 + * @description 通过组织 code,修改组织机构,可以选择部门描述、新组织 code、组织名称等。 * @param requestBody * @returns OrganizationSingleRespDto */ @@ -1232,8 +1119,8 @@ func (client *ManagementClient) DeleteOrganization(reqDto *dto.DeleteOrganizatio } /* - * @summary 搜索顶层组织机构列表 - * @description 通过搜索关键词,搜索顶层组织机构列表,支持分页。 + * @summary 搜索组织机构列表 + * @description 通过搜索关键词,搜索组织机构列表,支持分页。 * @param keywords 搜索关键词,如组织机构名称 * @param page 当前页数,从 1 开始 * @param limit 每页数目,最大不能超过 50,默认为 10 @@ -1946,7 +1833,7 @@ func (client *ManagementClient) CreateRole(reqDto *dto.CreateRoleDto) *dto.RoleS /* * @summary 获取角色列表 * @description 获取角色列表,支持分页。 - * @param keywords 搜索角色 code + * @param keywords 用于根据角色的 code 进行模糊搜索,可选。 * @param namespace 所属权限分组的 code * @param page 当前页数,从 1 开始 * @param limit 每页数目,最大不能超过 50,默认为 10 @@ -2161,14 +2048,214 @@ func (client *ManagementClient) CreateExtIdpConn(reqDto *dto.CreateExtIdpConnDto } /* - * @summary 更新身份源连接 - * @description 更新身份源连接,可以设置身份源图标、是否只支持登录等。 + * @summary 更新身份源连接 + * @description 更新身份源连接,可以设置身份源图标、是否只支持登录等。 + * @param requestBody + * @returns ExtIdpConnDetailSingleRespDto + */ +func (client *ManagementClient) UpdateExtIdpConn(reqDto *dto.UpdateExtIdpConnDto) *dto.ExtIdpConnDetailSingleRespDto { + b, err := client.SendHttpRequest("/api/v3/update-ext-idp-conn", fasthttp.MethodPost, reqDto) + var response dto.ExtIdpConnDetailSingleRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 删除身份源连接 + * @description 通过身份源连接 ID,删除身份源连接。 + * @param requestBody + * @returns IsSuccessRespDto + */ +func (client *ManagementClient) DeleteExtIdpConn(reqDto *dto.DeleteExtIdpConnDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/delete-ext-idp-conn", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 身份源连接开关 + * @description 身份源连接开关,可以打开或关闭身份源连接。 + * @param requestBody + * @returns IsSuccessRespDto + */ +func (client *ManagementClient) ChangeExtIdpConnState(reqDto *dto.ChangeExtIdpConnStateDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/change-ext-idp-conn-state", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 租户关联身份源 + * @description 租户可以关联或取消关联身份源连接。 + * @param requestBody + * @returns IsSuccessRespDto + */ +func (client *ManagementClient) ChangeExtIdpConnAssociationState(reqDto *dto.ChangeExtIdpAssociationStateDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/change-ext-idp-conn-association-state", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 租户控制台获取身份源列表 + * @description 在租户控制台内获取身份源列表,可以根据 应用 ID 筛选。 + * @param tenantId 租户 ID + * @param appId 应用 ID + * @param type 身份源类型 + * @param page 当前页数,从 1 开始 + * @param limit 每页数目,最大不能超过 50,默认为 10 + * @returns ExtIdpListPaginatedRespDto + */ +func (client *ManagementClient) ListTenantExtIdp(reqDto *dto.ListTenantExtIdpDto) *dto.ExtIdpListPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/list-tenant-ext-idp", fasthttp.MethodGet, reqDto) + var response dto.ExtIdpListPaginatedRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 身份源下应用的连接详情 + * @description 在身份源详情页获取应用的连接情况 + * @param id 身份源 ID + * @param tenantId 租户 ID + * @param appId 应用 ID + * @param type 身份源类型 + * @returns ExtIdpListPaginatedRespDto + */ +func (client *ManagementClient) ExtIdpConnStateByApps(reqDto *dto.ExtIdpConnAppsDto) *dto.ExtIdpListPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/ext-idp-conn-apps", fasthttp.MethodGet, reqDto) + var response dto.ExtIdpListPaginatedRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 获取用户内置字段列表 + * @description 获取用户内置的字段列表 + * @returns CustomFieldListRespDto + */ +func (client *ManagementClient) GetUserBaseFields() *dto.CustomFieldListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-user-base-fields", fasthttp.MethodGet, nil) + var response dto.CustomFieldListRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 修改用户内置字段配置 + * @description 修改用户内置字段配置,内置字段不允许修改数据类型、唯一性。 + * @param requestBody + * @returns CustomFieldListRespDto + */ +func (client *ManagementClient) SetUserBaseFields(reqDto *dto.SetUserBaseFieldsReqDto) *dto.CustomFieldListRespDto { + b, err := client.SendHttpRequest("/api/v3/set-user-base-fields", fasthttp.MethodPost, reqDto) + var response dto.CustomFieldListRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 获取自定义字段列表 + * @description 通过主体类型,获取用户、部门或角色的自定义字段列表。 + * @param targetType 目标对象类型: + * - `USER`: 用户 + * - `ROLE`: 角色 + * - `GROUP`: 分组 + * - `DEPARTMENT`: 部门 + * + * @returns CustomFieldListRespDto + */ +func (client *ManagementClient) GetCustomFields(reqDto *dto.GetCustomFieldsDto) *dto.CustomFieldListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-custom-fields", fasthttp.MethodGet, reqDto) + var response dto.CustomFieldListRespDto + if err != nil { + fmt.Println(err) + return nil + } + err = json.Unmarshal(b, &response) + if err != nil { + fmt.Println(err) + return nil + } + return &response +} + +/* + * @summary 创建/修改自定义字段定义 + * @description 创建/修改用户、部门或角色自定义字段定义,如果传入的 key 不存在则创建,存在则更新。 * @param requestBody - * @returns ExtIdpConnDetailSingleRespDto + * @returns CustomFieldListRespDto */ -func (client *ManagementClient) UpdateExtIdpConn(reqDto *dto.UpdateExtIdpConnDto) *dto.ExtIdpConnDetailSingleRespDto { - b, err := client.SendHttpRequest("/api/v3/update-ext-idp-conn", fasthttp.MethodPost, reqDto) - var response dto.ExtIdpConnDetailSingleRespDto +func (client *ManagementClient) SetCustomFields(reqDto *dto.SetCustomFieldsReqDto) *dto.CustomFieldListRespDto { + b, err := client.SendHttpRequest("/api/v3/set-custom-fields", fasthttp.MethodPost, reqDto) + var response dto.CustomFieldListRespDto if err != nil { fmt.Println(err) return nil @@ -2182,13 +2269,13 @@ func (client *ManagementClient) UpdateExtIdpConn(reqDto *dto.UpdateExtIdpConnDto } /* - * @summary 删除身份源连接 - * @description 通过身份源连接 ID,删除身份源连接。 + * @summary 设置自定义字段的值 + * @description 给用户、角色或部门设置自定义字段的值,如果存在则更新,不存在则创建。 * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) DeleteExtIdpConn(reqDto *dto.DeleteExtIdpConnDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/delete-ext-idp-conn", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) SetCustomData(reqDto *dto.SetCustomDataReqDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/set-custom-data", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -2203,14 +2290,26 @@ func (client *ManagementClient) DeleteExtIdpConn(reqDto *dto.DeleteExtIdpConnDto } /* - * @summary 身份源连接开关 - * @description 身份源连接开关,可以打开或关闭身份源连接。 - * @param requestBody - * @returns IsSuccessRespDto + * @summary 获取用户、分组、角色、组织机构的自定义字段值 + * @description 通过筛选条件,获取用户、分组、角色、组织机构的自定义字段值。 + * @param targetType 目标对象类型: + * - `USER`: 用户 + * - `ROLE`: 角色 + * - `GROUP`: 分组 + * - `DEPARTMENT`: 部门 + * + * @param targetIdentifier 目标对象的唯一标志符: + * - 如果是用户,为用户的 ID,如 `6343b98b7cfxxx9366e9b7c` + * - 如果是角色,为角色的 code,如 `admin` + * - 如果是分组,为分组的 code,如 `developer` + * - 如果是部门,为部门的 ID,如 `6343bafc019xxxx889206c4c` + * + * @param namespace 所属权限分组的 code,当 targetType 为角色的时候需要填写,否则可以忽略 + * @returns GetCustomDataRespDto */ -func (client *ManagementClient) ChangeConnState(reqDto *dto.EnableExtIdpConnDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/enable-ext-idp-conn", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) GetCustomData(reqDto *dto.GetCustomDataDto) *dto.GetCustomDataRespDto { + b, err := client.SendHttpRequest("/api/v3/get-custom-data", fasthttp.MethodGet, reqDto) + var response dto.GetCustomDataRespDto if err != nil { fmt.Println(err) return nil @@ -2224,14 +2323,14 @@ func (client *ManagementClient) ChangeConnState(reqDto *dto.EnableExtIdpConnDto) } /* - * @summary 租户关联身份源 - * @description 租户可以关联或取消关联身份源连接。 + * @summary 创建资源 + * @description 创建资源,可以设置资源的描述、定义的操作类型、URL 标识等。 * @param requestBody - * @returns IsSuccessRespDto + * @returns ResourceRespDto */ -func (client *ManagementClient) ChangeAssociationState(reqDto *dto.AssociationExtIdpDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/association-ext-idp", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) CreateResource(reqDto *dto.CreateResourceDto) *dto.ResourceRespDto { + b, err := client.SendHttpRequest("/api/v3/create-resource", fasthttp.MethodPost, reqDto) + var response dto.ResourceRespDto if err != nil { fmt.Println(err) return nil @@ -2245,18 +2344,14 @@ func (client *ManagementClient) ChangeAssociationState(reqDto *dto.AssociationEx } /* - * @summary 租户控制台获取身份源列表 - * @description 在租户控制台内获取身份源列表,可以根据 应用 ID 筛选。 - * @param tenantId 租户 ID - * @param appId 应用 ID - * @param type 身份源类型 - * @param page 页码 - * @param limit 每页获取的数据量 - * @returns ExtIdpListPaginatedRespDto + * @summary 批量创建资源 + * @description 批量创建资源,可以设置资源的描述、定义的操作类型、URL 标识等。 + * @param requestBody + * @returns IsSuccessRespDto */ -func (client *ManagementClient) ListTenantExtIdp(reqDto *dto.ListTenantExtIdpDto) *dto.ExtIdpListPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/list-tenant-ext-idp", fasthttp.MethodGet, reqDto) - var response dto.ExtIdpListPaginatedRespDto +func (client *ManagementClient) CreateResourcesBatch(reqDto *dto.CreateResourcesBatchDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/create-resources-batch", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) return nil @@ -2270,17 +2365,15 @@ func (client *ManagementClient) ListTenantExtIdp(reqDto *dto.ListTenantExtIdpDto } /* - * @summary 身份源下应用的连接详情 - * @description 在身份源详情页获取应用的连接情况 - * @param id 身份源 ID - * @param tenantId 租户 ID - * @param appId 应用 ID - * @param type 身份源类型 - * @returns ExtIdpListPaginatedRespDto + * @summary 获取资源详情 + * @description 根据筛选条件,获取资源详情。 + * @param code 资源唯一标志符 + * @param namespace 所属权限分组的 code + * @returns ResourceRespDto */ -func (client *ManagementClient) ExtIdpConnStateByApps(reqDto *dto.ExtIdpConnAppsDto) *dto.ExtIdpListPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/ext-idp-conn-apps", fasthttp.MethodGet, reqDto) - var response dto.ExtIdpListPaginatedRespDto +func (client *ManagementClient) GetResource(reqDto *dto.GetResourceDto) *dto.ResourceRespDto { + b, err := client.SendHttpRequest("/api/v3/get-resource", fasthttp.MethodGet, reqDto) + var response dto.ResourceRespDto if err != nil { fmt.Println(err) return nil @@ -2294,13 +2387,15 @@ func (client *ManagementClient) ExtIdpConnStateByApps(reqDto *dto.ExtIdpConnApps } /* - * @summary 获取用户内置字段列表 - * @description 获取用户内置的字段列表 - * @returns CustomFieldListRespDto + * @summary 批量获取资源详情 + * @description 根据筛选条件,批量获取资源详情。 + * @param codeList 资源 code 列表,批量可以使用逗号分隔 + * @param namespace 所属权限分组的 code + * @returns ResourceListRespDto */ -func (client *ManagementClient) GetUserBaseFields() *dto.CustomFieldListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-user-base-fields", fasthttp.MethodGet, nil) - var response dto.CustomFieldListRespDto +func (client *ManagementClient) GetResourcesBatch(reqDto *dto.GetResourcesBatchDto) *dto.ResourceListRespDto { + b, err := client.SendHttpRequest("/api/v3/get-resources-batch", fasthttp.MethodGet, reqDto) + var response dto.ResourceListRespDto if err != nil { fmt.Println(err) return nil @@ -2314,14 +2409,17 @@ func (client *ManagementClient) GetUserBaseFields() *dto.CustomFieldListRespDto } /* - * @summary 修改用户内置字段配置 - * @description 修改用户内置字段配置,内置字段不允许修改数据类型、唯一性。 - * @param requestBody - * @returns CustomFieldListRespDto + * @summary 分页获取资源列表 + * @description 根据筛选条件,分页获取资源详情列表。 + * @param namespace 所属权限分组的 code + * @param type 资源类型 + * @param page 当前页数,从 1 开始 + * @param limit 每页数目,最大不能超过 50,默认为 10 + * @returns ResourcePaginatedRespDto */ -func (client *ManagementClient) SetUserBaseFields(reqDto *dto.SetUserBaseFieldsReqDto) *dto.CustomFieldListRespDto { - b, err := client.SendHttpRequest("/api/v3/set-user-base-fields", fasthttp.MethodPost, reqDto) - var response dto.CustomFieldListRespDto +func (client *ManagementClient) ListResources(reqDto *dto.ListResourcesDto) *dto.ResourcePaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/list-resources", fasthttp.MethodGet, reqDto) + var response dto.ResourcePaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -2335,14 +2433,14 @@ func (client *ManagementClient) SetUserBaseFields(reqDto *dto.SetUserBaseFieldsR } /* - * @summary 获取自定义字段列表 - * @description 通过主体类型,获取用户、部门或角色的自定义字段列表。 - * @param targetType 主体类型,目前支持用户、角色、分组、部门 - * @returns CustomFieldListRespDto + * @summary 修改资源 + * @description 修改资源,可以设置资源的描述、定义的操作类型、URL 标识等。 + * @param requestBody + * @returns ResourceRespDto */ -func (client *ManagementClient) GetCustomFields(reqDto *dto.GetCustomFieldsDto) *dto.CustomFieldListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-custom-fields", fasthttp.MethodGet, reqDto) - var response dto.CustomFieldListRespDto +func (client *ManagementClient) UpdateResource(reqDto *dto.UpdateResourceDto) *dto.ResourceRespDto { + b, err := client.SendHttpRequest("/api/v3/update-resource", fasthttp.MethodPost, reqDto) + var response dto.ResourceRespDto if err != nil { fmt.Println(err) return nil @@ -2356,14 +2454,14 @@ func (client *ManagementClient) GetCustomFields(reqDto *dto.GetCustomFieldsDto) } /* - * @summary 创建/修改自定义字段定义 - * @description 创建/修改用户、部门或角色自定义字段定义,如果传入的 key 不存在则创建,存在则更新。 + * @summary 删除资源 + * @description 通过资源唯一标志符以及所属权限分组,删除资源。 * @param requestBody - * @returns CustomFieldListRespDto + * @returns IsSuccessRespDto */ -func (client *ManagementClient) SetCustomFields(reqDto *dto.SetCustomFieldsReqDto) *dto.CustomFieldListRespDto { - b, err := client.SendHttpRequest("/api/v3/set-custom-fields", fasthttp.MethodPost, reqDto) - var response dto.CustomFieldListRespDto +func (client *ManagementClient) DeleteResource(reqDto *dto.DeleteResourceDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/delete-resource", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) return nil @@ -2377,13 +2475,13 @@ func (client *ManagementClient) SetCustomFields(reqDto *dto.SetCustomFieldsReqDt } /* - * @summary 设置自定义字段的值 - * @description 给用户、角色或部门设置自定义字段的值,如果存在则更新,不存在则创建。 + * @summary 批量删除资源 + * @description 通过资源唯一标志符以及所属权限分组,批量删除资源 * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) SetCustomData(reqDto *dto.SetCustomDataReqDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/set-custom-data", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) DeleteResourcesBatch(reqDto *dto.DeleteResourcesBatchDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/delete-resources-batch", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -2398,16 +2496,14 @@ func (client *ManagementClient) SetCustomData(reqDto *dto.SetCustomDataReqDto) * } /* - * @summary 获取用户、分组、角色、组织机构的自定义字段值 - * @description 通过筛选条件,获取用户、分组、角色、组织机构的自定义字段值。 - * @param targetType 主体类型,目前支持用户、角色、分组、部门 - * @param targetIdentifier 目标对象唯一标志符 - * @param namespace 所属权限分组的 code,当 targetType 为角色的时候需要填写,否则可以忽略 - * @returns GetCustomDataRespDto + * @summary 关联/取消关联应用资源到租户 + * @description 通过资源唯一标识以及权限分组,关联或取消关联资源到租户 + * @param requestBody + * @returns IsSuccessRespDto */ -func (client *ManagementClient) GetCustomData(reqDto *dto.GetCustomDataDto) *dto.GetCustomDataRespDto { - b, err := client.SendHttpRequest("/api/v3/get-custom-data", fasthttp.MethodGet, reqDto) - var response dto.GetCustomDataRespDto +func (client *ManagementClient) AssociateTenantResource(reqDto *dto.AssociateTenantResourceDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/associate-tenant-resource", fasthttp.MethodPost, reqDto) + var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) return nil @@ -2591,8 +2687,18 @@ func (client *ManagementClient) AuthorizeResources(reqDto *dto.AuthorizeResource /* * @summary 获取某个主体被授权的资源列表 * @description 根据筛选条件,获取某个主体被授权的资源列表。 - * @param targetType 目标对象类型 - * @param targetIdentifier 目标对象唯一标志符 + * @param targetType 目标对象类型: + * - `USER`: 用户 + * - `ROLE`: 角色 + * - `GROUP`: 分组 + * - `DEPARTMENT`: 部门 + * + * @param targetIdentifier 目标对象的唯一标志符: + * - 如果是用户,为用户的 ID,如 `6343b98b7cfxxx9366e9b7c` + * - 如果是角色,为角色的 code,如 `admin` + * - 如果是分组,为分组的 code,如 `developer` + * - 如果是部门,为部门的 ID,如 `6343bafc019xxxx889206c4c` + * * @param namespace 所属权限分组的 code * @param resourceType 限定资源类型,如数据、API、按钮、菜单 * @param resourceList 限定查询的资源列表,如果指定,只会返回所指定的资源列表。 @@ -2639,11 +2745,11 @@ func (client *ManagementClient) IsActionAllowed(reqDto *dto.IsActionAllowedDto) * @summary 获取资源被授权的主体 * @description 获取资源被授权的主体 * @param requestBody - * @returns GetAuthorizedTargetRespDto + * @returns GetResourceAuthorizedTargetRespDto */ -func (client *ManagementClient) GetAuthorizedTargets(reqDto *dto.GetAuthorizedTargetsDto) *dto.GetAuthorizedTargetRespDto { - b, err := client.SendHttpRequest("/api/v3/get-authorized-targets", fasthttp.MethodPost, reqDto) - var response dto.GetAuthorizedTargetRespDto +func (client *ManagementClient) GetResourceAuthorizedTargets(reqDto *dto.GetResourceAuthorizedTargetsDto) *dto.GetResourceAuthorizedTargetRespDto { + b, err := client.SendHttpRequest("/api/v3/get-resource-authorized-targets", fasthttp.MethodPost, reqDto) + var response dto.GetResourceAuthorizedTargetRespDto if err != nil { fmt.Println(err) return nil @@ -3032,11 +3138,11 @@ func (client *ManagementClient) PreviewEmailTemplate(reqDto *dto.PreviewEmailTem /* * @summary 获取第三方邮件服务配置 * @description 获取第三方邮件服务配置 - * @returns EmailProviderDto + * @returns EmailProviderRespDto */ -func (client *ManagementClient) GetEmailProvider() *dto.EmailProviderDto { - b, err := client.SendHttpRequest("/api/v3/get-email-provier", fasthttp.MethodGet, nil) - var response dto.EmailProviderDto +func (client *ManagementClient) GetEmailProvider() *dto.EmailProviderRespDto { + b, err := client.SendHttpRequest("/api/v3/get-email-provider", fasthttp.MethodGet, nil) + var response dto.EmailProviderRespDto if err != nil { fmt.Println(err) return nil @@ -3053,11 +3159,11 @@ func (client *ManagementClient) GetEmailProvider() *dto.EmailProviderDto { * @summary 配置第三方邮件服务 * @description 配置第三方邮件服务 * @param requestBody - * @returns EmailProviderDto + * @returns EmailProviderRespDto */ -func (client *ManagementClient) ConfigEmailProvider(reqDto *dto.ConfigEmailProviderDto) *dto.EmailProviderDto { +func (client *ManagementClient) ConfigEmailProvider(reqDto *dto.ConfigEmailProviderDto) *dto.EmailProviderRespDto { b, err := client.SendHttpRequest("/api/v3/config-email-provier", fasthttp.MethodPost, reqDto) - var response dto.EmailProviderDto + var response dto.EmailProviderRespDto if err != nil { fmt.Println(err) return nil @@ -3147,11 +3253,11 @@ func (client *ManagementClient) GetApplicationSimpleInfo(reqDto *dto.GetApplicat * @param isSelfBuiltApp 是否为自建应用 * @param ssoEnabled 是否开启单点登录 * @param keyword 模糊搜索字符串 - * @returns ApplicationSimpleInfoSingleRespDto + * @returns ApplicationSimpleInfoPaginatedRespDto */ -func (client *ManagementClient) ListApplicationSimpleInfo(reqDto *dto.ListApplicationSimpleInfoDto) *dto.ApplicationSimpleInfoSingleRespDto { +func (client *ManagementClient) ListApplicationSimpleInfo(reqDto *dto.ListApplicationSimpleInfoDto) *dto.ApplicationSimpleInfoPaginatedRespDto { b, err := client.SendHttpRequest("/api/v3/list-application-simple-info", fasthttp.MethodGet, reqDto) - var response dto.ApplicationSimpleInfoSingleRespDto + var response dto.ApplicationSimpleInfoPaginatedRespDto if err != nil { fmt.Println(err) return nil @@ -3317,8 +3423,8 @@ func (client *ManagementClient) UpdateApplicationPermissionStrategy(reqDto *dto. * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) AuthorizeApplicationAccess(reqDto *dto.AddApplicationPermissionRecord) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/add-application-permission-record", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) AuthorizeApplicationAccess(reqDto *dto.AuthorizeApplicationAccessDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/authorize-application-access", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -3338,8 +3444,8 @@ func (client *ManagementClient) AuthorizeApplicationAccess(reqDto *dto.AddApplic * @param requestBody * @returns IsSuccessRespDto */ -func (client *ManagementClient) RevokeApplicationAccess(reqDto *dto.DeleteApplicationPermissionRecord) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/delete-application-permission-record", fasthttp.MethodPost, reqDto) +func (client *ManagementClient) RevokeApplicationAccess(reqDto *dto.RevokeApplicationAccessDto) *dto.IsSuccessRespDto { + b, err := client.SendHttpRequest("/api/v3/revoke-application-access", fasthttp.MethodPost, reqDto) var response dto.IsSuccessRespDto if err != nil { fmt.Println(err) @@ -3380,7 +3486,7 @@ func (client *ManagementClient) CheckDomainAvailable(reqDto *dto.CheckDomainAvai * @returns SecuritySettingsRespDto */ func (client *ManagementClient) GetSecuritySettings() *dto.SecuritySettingsRespDto { - b, err := client.SendHttpRequest("/api/v3/update-security-settings", fasthttp.MethodGet, nil) + b, err := client.SendHttpRequest("/api/v3/get-security-settings", fasthttp.MethodGet, nil) var response dto.SecuritySettingsRespDto if err != nil { fmt.Println(err) @@ -3457,14 +3563,13 @@ func (client *ManagementClient) UpdateGlobalMfaSettings(reqDto *dto.MFASettingsD } /* - * @summary 创建资源 - * @description 创建资源,可以设置资源的描述、定义的操作类型、URL 标识等。 - * @param requestBody - * @returns ResourceRespDto + * @summary 获取套餐详情 + * @description 获取当前用户池套餐详情。 + * @returns CostGetCurrentPackageRespDto */ -func (client *ManagementClient) CreateResource(reqDto *dto.CreateResourceDto) *dto.ResourceRespDto { - b, err := client.SendHttpRequest("/api/v3/create-resource", fasthttp.MethodPost, reqDto) - var response dto.ResourceRespDto +func (client *ManagementClient) GetCurrentPackageInfo() *dto.CostGetCurrentPackageRespDto { + b, err := client.SendHttpRequest("/api/v3/get-current-package-info", fasthttp.MethodGet, nil) + var response dto.CostGetCurrentPackageRespDto if err != nil { fmt.Println(err) return nil @@ -3478,14 +3583,13 @@ func (client *ManagementClient) CreateResource(reqDto *dto.CreateResourceDto) *d } /* - * @summary 批量创建资源 - * @description 批量创建资源,可以设置资源的描述、定义的操作类型、URL 标识等。 - * @param requestBody - * @returns IsSuccessRespDto + * @summary 获取用量详情 + * @description 获取当前用户池用量详情。 + * @returns CostGetCurrentUsageRespDto */ -func (client *ManagementClient) CreateResourcesBatch(reqDto *dto.CreateResourcesBatchDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/create-resources-batch", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) GetUsageInfo() *dto.CostGetCurrentUsageRespDto { + b, err := client.SendHttpRequest("/api/v3/get-usage-info", fasthttp.MethodGet, nil) + var response dto.CostGetCurrentUsageRespDto if err != nil { fmt.Println(err) return nil @@ -3499,15 +3603,15 @@ func (client *ManagementClient) CreateResourcesBatch(reqDto *dto.CreateResources } /* - * @summary 获取资源详情 - * @description 根据筛选条件,获取资源详情。 - * @param code 资源唯一标志符 - * @param namespace 所属权限分组的 code - * @returns ResourceRespDto + * @summary 获取 MAU 使用记录 + * @description 获取当前用户池 MAU 使用记录 + * @param startTime 起始时间(年月日) + * @param endTime 截止时间(年月日) + * @returns CostGetMauPeriodUsageHistoryRespDto */ -func (client *ManagementClient) GetResource(reqDto *dto.GetResourceDto) *dto.ResourceRespDto { - b, err := client.SendHttpRequest("/api/v3/get-resource", fasthttp.MethodGet, reqDto) - var response dto.ResourceRespDto +func (client *ManagementClient) GetMauPeriodUsageHistory(reqDto *dto.GetMauPeriodUsageHistoryDto) *dto.CostGetMauPeriodUsageHistoryRespDto { + b, err := client.SendHttpRequest("/api/v3/get-mau-period-usage-history", fasthttp.MethodGet, reqDto) + var response dto.CostGetMauPeriodUsageHistoryRespDto if err != nil { fmt.Println(err) return nil @@ -3521,15 +3625,13 @@ func (client *ManagementClient) GetResource(reqDto *dto.GetResourceDto) *dto.Res } /* - * @summary 批量获取资源详情 - * @description 根据筛选条件,批量获取资源详情。 - * @param codeList 资源 code 列表,批量可以使用逗号分隔 - * @param namespace 所属权限分组的 code - * @returns ResourceListRespDto + * @summary 获取所有权益 + * @description 获取当前用户池所有权益 + * @returns CostGetAllRightItemRespDto */ -func (client *ManagementClient) GetResourcesBatch(reqDto *dto.GetResourcesBatchDto) *dto.ResourceListRespDto { - b, err := client.SendHttpRequest("/api/v3/get-resources-batch", fasthttp.MethodGet, reqDto) - var response dto.ResourceListRespDto +func (client *ManagementClient) GetAllRightsItem() *dto.CostGetAllRightItemRespDto { + b, err := client.SendHttpRequest("/api/v3/get-all-rights-items", fasthttp.MethodGet, nil) + var response dto.CostGetAllRightItemRespDto if err != nil { fmt.Println(err) return nil @@ -3543,59 +3645,15 @@ func (client *ManagementClient) GetResourcesBatch(reqDto *dto.GetResourcesBatchD } /* - * @summary 分页获取资源列表 - * @description 根据筛选条件,分页获取资源详情列表。 - * @param namespace 所属权限分组的 code - * @param type 资源类型 + * @summary 获取订单列表 + * @description 获取当前用户池订单列表 * @param page 当前页数,从 1 开始 * @param limit 每页数目,最大不能超过 50,默认为 10 - * @returns ResourcePaginatedRespDto - */ -func (client *ManagementClient) ListResources(reqDto *dto.ListResourcesDto) *dto.ResourcePaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/list-resources", fasthttp.MethodGet, reqDto) - var response dto.ResourcePaginatedRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) - if err != nil { - fmt.Println(err) - return nil - } - return &response -} - -/* - * @summary 修改资源 - * @description 修改资源,可以设置资源的描述、定义的操作类型、URL 标识等。 - * @param requestBody - * @returns ResourceRespDto - */ -func (client *ManagementClient) UpdateResource(reqDto *dto.UpdateResourceDto) *dto.ResourceRespDto { - b, err := client.SendHttpRequest("/api/v3/update-resource", fasthttp.MethodPost, reqDto) - var response dto.ResourceRespDto - if err != nil { - fmt.Println(err) - return nil - } - err = json.Unmarshal(b, &response) - if err != nil { - fmt.Println(err) - return nil - } - return &response -} - -/* - * @summary 删除资源 - * @description 通过资源唯一标志符以及所属权限分组,删除资源。 - * @param requestBody - * @returns IsSuccessRespDto + * @returns CostGetOrdersRespDto */ -func (client *ManagementClient) DeleteResource(reqDto *dto.DeleteResourceDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/delete-resource", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) GetOrders(reqDto *dto.GetOrdersDto) *dto.CostGetOrdersRespDto { + b, err := client.SendHttpRequest("/api/v3/get-orders", fasthttp.MethodGet, reqDto) + var response dto.CostGetOrdersRespDto if err != nil { fmt.Println(err) return nil @@ -3609,14 +3667,14 @@ func (client *ManagementClient) DeleteResource(reqDto *dto.DeleteResourceDto) *d } /* - * @summary 批量删除资源 - * @description 通过资源唯一标志符以及所属权限分组,批量删除资源 - * @param requestBody - * @returns IsSuccessRespDto + * @summary 获取订单详情 + * @description 获取当前用户池订单详情 + * @param orderNo 订单号 + * @returns CostGetOrderDetailRespDto */ -func (client *ManagementClient) DeleteResourcesBatch(reqDto *dto.DeleteResourcesBatchDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/delete-resources-batch", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) GetOrderDetail(reqDto *dto.GetOrderDetailDto) *dto.CostGetOrderDetailRespDto { + b, err := client.SendHttpRequest("/api/v3/get-order-detail", fasthttp.MethodGet, reqDto) + var response dto.CostGetOrderDetailRespDto if err != nil { fmt.Println(err) return nil @@ -3630,14 +3688,14 @@ func (client *ManagementClient) DeleteResourcesBatch(reqDto *dto.DeleteResources } /* - * @summary 关联/取消关联应用资源到租户 - * @description 通过资源唯一标识以及权限分组,关联或取消关联资源到租户 - * @param requestBody - * @returns IsSuccessRespDto + * @summary 获取订单支付明细 + * @description 获取当前用户池订单支付明细 + * @param orderNo 订单号 + * @returns CostGetOrderPayDetailRespDto */ -func (client *ManagementClient) AssociationResources(reqDto *dto.AssociationResourceDto) *dto.IsSuccessRespDto { - b, err := client.SendHttpRequest("/api/v3/associate-tenant-resource", fasthttp.MethodPost, reqDto) - var response dto.IsSuccessRespDto +func (client *ManagementClient) GetOrderPayDetail(reqDto *dto.GetOrderPayDetailDto) *dto.CostGetOrderPayDetailRespDto { + b, err := client.SendHttpRequest("/api/v3/get-order-pay-detail", fasthttp.MethodGet, reqDto) + var response dto.CostGetOrderPayDetailRespDto if err != nil { fmt.Println(err) return nil @@ -3790,8 +3848,8 @@ func (client *ManagementClient) DeletePipelineFunction(reqDto *dto.DeletePipelin * * @returns PipelineFunctionPaginatedRespDto */ -func (client *ManagementClient) ListPipelineFunctions(reqDto *dto.ListPipelineFunctionDto) *dto.PipelineFunctionPaginatedRespDto { - b, err := client.SendHttpRequest("/api/v3/list-pipeline-function", fasthttp.MethodGet, reqDto) +func (client *ManagementClient) ListPipelineFunctions(reqDto *dto.ListPipelineFunctionsDto) *dto.PipelineFunctionPaginatedRespDto { + b, err := client.SendHttpRequest("/api/v3/list-pipeline-functions", fasthttp.MethodGet, reqDto) var response dto.PipelineFunctionPaginatedRespDto if err != nil { fmt.Println(err)