From a2a8ccc6e2d9d34a55cab03ad58ada83ba5fdbe3 Mon Sep 17 00:00:00 2001 From: cclicn Date: Mon, 28 Aug 2023 12:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=9F=9F=E8=B4=A6=E5=8F=B7=E3=80=91?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E5=9F=9F=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E8=B5=84=E6=96=99=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cclicn --- .../reference/apis/js-apis-osAccount.md | 157 ++++++++++++++++-- 1 file changed, 141 insertions(+), 16 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index f2af2382a6..b0743215dd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -4626,7 +4626,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -4690,7 +4690,7 @@ authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback) }, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -4741,7 +4741,7 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: }; callback.onResult(0, result); }, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -4757,7 +4757,7 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: ### getAccountInfo10+ -getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<DomainAccountInfo>): void +getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallback<DomainAccountInfo>): void 查询指定域帐号的信息。 @@ -4769,8 +4769,7 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D | 参数名 | 类型 | 必填 | 说明 | | ---------- | --------------------------------------- | ---- | --------------- | -| domain | string | 是 | 指示帐号所属域。| -| accountName | string | 是 | 指示帐号的名称。| +| options | [GetDomainAccountInfoPluginOptions](#getdomainaccountinfopluginoptions10) | 是 | 指示域帐号信息。| | callback | AsyncCallback<[DomainAccountInfo](#domainaccountinfo8)> | 是 | 指示查询结果回调。| **示例:** @@ -4783,7 +4782,7 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => { // mock getting account information // notify result @@ -4793,8 +4792,8 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<D message: "" }; let accountInfo: account_osAccount.DomainAccountInfo = { - domain: domain, - accountName: accountName, + domain: options.domain, + accountName: options.accountName, accountId: 'xxxx' }; callback(code, accountInfo); @@ -4838,7 +4837,7 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback& callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => { @@ -4890,7 +4889,7 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -4940,7 +4939,7 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<v callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -4991,7 +4990,7 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -5041,7 +5040,7 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback< callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -5102,7 +5101,7 @@ static registerPlugin(plugin: DomainPlugin): void callback: account_osAccount.IUserAuthCallback) => {}, authWithToken: (domainAccountInfo: account_osAccount.DomainAccountInfo, token: Uint8Array, callback: account_osAccount.IUserAuthCallback) => {}, - getAccountInfo: (domain: string, accountName: string, + getAccountInfo: (options: account_osAccount.GetDomainAccountInfoPluginOptions, callback: AsyncCallback) => {}, getAuthStatusInfo: (domainAccountInfo: account_osAccount.DomainAccountInfo, callback: AsyncCallback) => {}, @@ -5325,7 +5324,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<bool **示例:** ```js import { BusinessError } from '@ohos.base'; - let domainAccountInfo = { + let domainAccountInfo: account_osAccount.DomainAccountInfo = { domain: 'CHINA', accountName: 'zhangsan' } @@ -5496,6 +5495,107 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro } ``` +### getAccountInfo10+ + +getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback<DomainAccountInfo>): void + +查询指定的域帐号信息,callback方式。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.GET_DOMAIN_ACCOUNTS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| options | [GetDomainAccountInfoOptions](#getdomainaccountinfooptions10) | 是 | 指示域帐号信息。| +| callback | AsyncCallback<DomainAccountInfo> | 是 | 指示查询结果回调。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | +| 12300111 | Operation timeout. | + +**示例:** + ```js + import { BusinessError } from '@ohos.base'; + let domainAccountInfo: account_osAccount.DomainAccountInfo = { + domain: 'CHINA', + accountName: 'zhangsan' + } + try { + account_osAccount.DomainAccountManager.getAccountInfo(domainAccountInfo, + (err: BusinessError, result: account_osAccount.DomainAccountInfo) => { + if (err) { + console.log('call getAccountInfo failed, error: ' + JSON.stringify(err)); + } else { + console.log('getAccountInfo result: ' + result); + } + }); + } catch (err) { + console.log('getAccountInfo exception = ' + JSON.stringify(err)); + } + ``` + +### getAccountInfo10+ + +getAccountInfo(options: GetDomainAccountInfoOptions): Promise<DomainAccountInfo> + +查询指定的域帐号信息,promise方式。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.GET_DOMAIN_ACCOUNTS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| options | [GetDomainAccountInfoOptions](#getdomainaccountinfooptions10) | 是 | 指示域帐号信息。| + +**返回值:** + +| 类型 | 说明 | +| :------------------------ | ----------------------- | +| Promise<DomainAccountInfo> | Promise对象,返回指定的域帐号信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | +| 12300111 | Operation timeout. | + +**示例:** + ```js + import { BusinessError } from '@ohos.base'; + let domainAccountInfo: account_osAccount.DomainAccountInfo = { + domain: 'CHINA', + accountName: 'zhangsan' + } + try { + account_osAccount.DomainAccountManager.getAccountInfo(domainAccountInfo) + .then((result: account_osAccount.DomainAccountInfo) => { + console.log('getAccountInfo result: ' + result); + }).catch((err: BusinessError) => { + console.log('call getAccountInfo failed, error: ' + JSON.stringify(err)); + }); + } catch (err) { + console.log('getAccountInfo exception = ' + JSON.stringify(err)); + } + ``` + ## UserIdentityManager8+ 获取用户身份管理类。 @@ -6622,3 +6722,28 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | domainAccountToken | Uint8Array | 是 | 域帐号的令牌 | | businessParams | { [key: string]: object } | 是 | 业务参数,由业务方根据请求协议自定义 | | callerUid | number | 是 | 调用方唯一标识符 | + +## GetDomainAccountInfoOptions10+ + +表示查询域帐号信息的选项。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| accountName | string | 是 | 域帐号名。 | +| domain | string | 否 | 域名。 | + +## GetDomainAccountInfoPluginOptions10+ + +表示插件查询域帐号信息的选项。GetDomainAccountInfoPluginOptions类继承[GetDomainAccountInfoOptions](#getdomainaccountinfooptions10) + +**系统接口:** 此接口为系统接口。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| callerUid | number | 是 | 调用方唯一标识符 | -- GitLab