1 Star 0 Fork 3.9K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.account.appAccount.d.ts 124.09 KB
一键复制 编辑 原始数据 按行查看 历史
cc_ggboy 提交于 2024-07-06 10:47 +08:00 . jsapi lint告警处理
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit BasicServicesKit
*/
import type { AsyncCallback, Callback } from './@ohos.base';
import type Want from './@ohos.app.ability.Want';
import type rpc from './@ohos.rpc';
/**
* This module provides the capability to manage application accounts.
*
* @namespace appAccount
* @syscap SystemCapability.Account.AppAccount
* @since 7
*/
declare namespace appAccount {
/**
* Obtains the AppAccountManager instance.
*
* @returns { AppAccountManager } Returns the instance of the AppAccountManager.
* @syscap SystemCapability.Account.AppAccount
* @since 7
*/
function createAppAccountManager(): AppAccountManager;
/**
* Provides methods for managing application accounts.
*
* @interface AppAccountManager
* @syscap SystemCapability.Account.AppAccount
* @since 7
*/
interface AppAccountManager {
/**
* Adds the account name and extra information of this application to the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#createAccount
*/
addAccount(name: string, callback: AsyncCallback<void>): void;
/**
* Adds the account name and extra information of this application to the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { string } extraInfo - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#createAccount
*/
addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>): void;
/**
* Adds the account name and extra information of this application to the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { string } [extraInfo] - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#createAccount
*/
addAccount(name: string, extraInfo?: string): Promise<void>;
/**
* Creates the account name and extra information of this application to the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccount(name: string, callback: AsyncCallback<void>): void;
/**
* Creates the account name and extra information of this application to the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { CreateAccountOptions } options - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or options.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallback<void>): void;
/**
* Creates the account name and extra information of this application to the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to add.
* @param { CreateAccountOptions } [options] - Indicates the extra information of the application account to add.
* The extra information cannot be sensitive information of the application account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or options.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccount(name: string, options?: CreateAccountOptions): Promise<void>;
/**
* Adds an application account of a specified owner implicitly.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { object } options - Indicates the authenticator-specific options for the request.
* @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#createAccountImplicitly
*/
addAccountImplicitly(
owner: string,
authType: string,
options: { [key: string]: any },
callback: AuthenticatorCallback
): void;
/**
* Creates an application account of a specified owner implicitly.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccountImplicitly(owner: string, callback: AuthCallback): void;
/**
* Creates an application account of a specified owner implicitly.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner or options.
* @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;
/**
* Deletes an application account from the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#removeAccount
*/
deleteAccount(name: string, callback: AsyncCallback<void>): void;
/**
* Deletes an application account from the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#removeAccount
*/
deleteAccount(name: string): Promise<void>;
/**
* Removes an application account from the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
removeAccount(name: string, callback: AsyncCallback<void>): void;
/**
* Removes an application account from the account management service.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the name of the application account to delete.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
removeAccount(name: string): Promise<void>;
/**
* Disables a third-party application with the specified bundle name from
* accessing the given application account.
*
* @param { string } name - Indicates the name of the application account to disable access from
* the third-party application.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAppAccess
*/
disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void;
/**
* Disables a third-party application with the specified bundle name from
* accessing the given application account.
*
* @param { string } name - Indicates the name of the application account to disable access from
* the third-party application.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAppAccess
*/
disableAppAccess(name: string, bundleName: string): Promise<void>;
/**
* Enables a third-party application with the specified bundle name to access the given application
* account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAppAccess
*/
enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void;
/**
* Enables a third-party application with the specified bundle name to access the given application
* account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAppAccess
*/
enableAppAccess(name: string, bundleName: string): Promise<void>;
/**
* Sets a third-party application with the specified bundle name to access the given application
* account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback<void>): void;
/**
* Sets a third-party application with the specified bundle name to access the given application
* account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise<void>;
/**
* Checks whether a third-party application with the specified bundle name is allowed to access
* the given application account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAppAccess(name: string, bundleName: string, callback: AsyncCallback<boolean>): void;
/**
* Checks whether a third-party application with the specified bundle name is allowed to access
* the given application account for data query and listening.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise<boolean> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAppAccess(name: string, bundleName: string): Promise<boolean>;
/**
* Checks whether a specified application account allows application data synchronization.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#checkDataSyncEnabled
*/
checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>): void;
/**
* Checks whether a specified application account allows application data synchronization.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @returns { Promise<boolean> } Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#checkDataSyncEnabled
*/
checkAppAccountSyncEnable(name: string): Promise<boolean>;
/**
* Checks whether application data synchronization is enabled for the specified account.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkDataSyncEnabled(name: string, callback: AsyncCallback<boolean>): void;
/**
* Checks whether application data synchronization is enabled for the specified account.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to check
* whether application data can be synchronized.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @returns { Promise<boolean> } Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkDataSyncEnabled(name: string): Promise<boolean>;
/**
* Sets the credential for this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to set.
* @param { string } credential - Indicates the credential to set.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setCredential
*/
setAccountCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void;
/**
* Sets the credential for this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to set.
* @param { string } credential - Indicates the credential to set.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setCredential
*/
setAccountCredential(name: string, credentialType: string, credential: string): Promise<void>;
/**
* Sets the credential for this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to set.
* @param { string } credential - Indicates the credential to set.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, credentialType or credential.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void;
/**
* Sets the credential for this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to set.
* @param { string } credential - Indicates the credential to set.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, credentialType or credential.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCredential(name: string, credentialType: string, credential: string): Promise<void>;
/**
* Sets extra information for this application account.
* <p>
* You can call this method when you forget the extra information of your application account or
* need to modify the extra information.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } extraInfo - Indicates the extra information to set.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setCustomData
*/
setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback<void>): void;
/**
* Sets extra information for this application account.
* <p>
* You can call this method when you forget the extra information of your application account or
* need to modify the extra information.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } extraInfo - Indicates the extra information to set.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setCustomData
*/
setAccountExtraInfo(name: string, extraInfo: string): Promise<void>;
/**
* Sets whether a specified application account allows application data synchronization.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not allowed, the application data is stored only on the local device.
* <p>
* <b>Application account-related changes</b>: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
* <p>
* <b>Application data that can be synchronized</b>: application account name, token,
* and data associated with this application account
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnable - Specifies whether to allow application data synchronization.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setDataSyncEnabled
*/
setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback<void>): void;
/**
* Sets whether a specified application account allows application data synchronization.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not allowed, the application data is stored only on the local device.
* <p>
* <b>Application account-related changes</b>: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
* <p>
* <b>Application data that can be synchronized</b>: application account name, token,
* and data associated with this application account
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnable - Specifies whether to allow application data synchronization.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setDataSyncEnabled
*/
setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void>;
/**
* Sets whether a specified application account enables application data synchronization.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not enabled, the application data is stored only on the local device.
* <p>
* <b>Application account-related changes</b>: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
* <p>
* <b>Application data that can be synchronized</b>: application account name, token,
* and data associated with this application account
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnabled - Specifies whether to enable application data synchronization.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback<void>): void;
/**
* Sets whether a specified application account enables application data synchronization.
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to set whether to
* enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized
* among these devices in the event of any changes related to the application account.
* If synchronization is not enabled, the application data is stored only on the local device.
* <p>
* <b>Application account-related changes</b>: adding or deleting an application account, setting extra
* information (such as updating a token), and setting data associated with this application account
* <p>
* <b>Application data that can be synchronized</b>: application account name, token,
* and data associated with this application account
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC
* @param { string } name - Indicates the name of the application account.
* @param { boolean } isEnabled - Specifies whether to enable application data synchronization.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setDataSyncEnabled(name: string, isEnabled: boolean): Promise<void>;
/**
* Sets data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to set. The key can be customized.
* @param { string } value - Indicates the value of the data to set.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setCustomData
*/
setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback<void>): void;
/**
* Sets data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to set. The key can be customized.
* @param { string } value - Indicates the value of the data to set.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setCustomData
*/
setAssociatedData(name: string, key: string, value: string): Promise<void>;
/**
* Sets data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to set. The key can be customized.
* @param { string } value - Indicates the value of the data to set.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, key or value.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCustomData(name: string, key: string, value: string, callback: AsyncCallback<void>): void;
/**
* Sets data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to set. The key can be customized.
* @param { string } value - Indicates the value of the data to set.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, key or value.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setCustomData(name: string, key: string, value: string): Promise<void>;
/**
* Obtains information about all accessible accounts.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAllAccounts
*/
getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void;
/**
* Obtains information about all accessible accounts.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAllAccounts
*/
getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>>;
/**
* Obtains information about all accessible accounts.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications or
* <br> have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface. Returns a list of application accounts.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void;
/**
* Obtains information about all accessible accounts.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications or
* <br> have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAccounts(): Promise<Array<AppAccountInfo>>;
/**
* Obtains information about all accounts of a specified account owner.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface. Returns a list of application accounts.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAccountsByOwner
*/
getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void;
/**
* Obtains information about all accounts of a specified account owner.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications.
*
* @permission ohos.permission.GET_ALL_APP_ACCOUNTS
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAccountsByOwner
*/
getAllAccounts(owner: string): Promise<Array<AppAccountInfo>>;
/**
* Gets information about all accounts of a specified account owner.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications or
* <br> have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface. Returns a list of application accounts.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void;
/**
* Gets information about all accounts of a specified account owner.
* This method applies to the following accounts:
* <br> Accounts of this application.
* <br> Accounts of third-party applications. To obtain such information,
* <br> your application must have gained authorization from the third-party applications or
* <br> have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>;
/**
* Obtains the credential of this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to obtain.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the credential of the application account.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getCredential
*/
getAccountCredential(name: string, credentialType: string, callback: AsyncCallback<string>): void;
/**
* Obtains the credential of this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to obtain.
* @returns { Promise<string> } Returns the credential of the application account.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getCredential
*/
getAccountCredential(name: string, credentialType: string): Promise<string>;
/**
* Obtains the credential of this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to obtain.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the credential of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or credentialType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - Credential not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCredential(name: string, credentialType: string, callback: AsyncCallback<string>): void;
/**
* Obtains the credential of this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } credentialType - Indicates the type of the credential to obtain.
* @returns { Promise<string> } Returns the credential of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or credentialType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - Credential not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCredential(name: string, credentialType: string): Promise<string>;
/**
* Obtains extra information of this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface.
* Returns the extra information of the account; returns {@code null} in other scenarios,
* for example, if the account does not exist.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getCustomData
*/
getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void;
/**
* Obtains extra information of this application account.
*
* @param { string } name - Indicates the name of the application account.
* @returns { Promise<string> } Returns the extra information of the account; returns {@code null} in other scenarios,
* for example, if the account does not exist.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getCustomData
*/
getAccountExtraInfo(name: string): Promise<string>;
/**
* Obtains data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to obtain.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the associated data of the application account.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getCustomData
*/
getAssociatedData(name: string, key: string, callback: AsyncCallback<string>): void;
/**
* Obtains data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to obtain.
* @returns { Promise<string> } Returns the associated data of the application account.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getCustomData
*/
getAssociatedData(name: string, key: string): Promise<string>;
/**
* Obtains data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to obtain.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the associated data of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or key.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400002 - Custom data not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCustomData(name: string, key: string, callback: AsyncCallback<string>): void;
/**
* Obtains data associated with this application account.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to obtain.
* @returns { Promise<string> } Returns the associated data of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or key.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400002 - Custom data not found
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCustomData(name: string, key: string): Promise<string>;
/**
* Obtains data associated with the specified account synchronously.
*
* @param { string } name - Indicates the name of the application account.
* @param { string } key - Indicates the key of the data to obtain.
* @returns { string } Returns the associated data of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or key.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400002 - Custom data not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getCustomDataSync(name: string, key: string): string;
/**
* Subscribes to the change events of accounts of the specified owners.
* <p>
* When the account owner updates the account, the subscriber will receive a notification
* about the account change event.
*
* @param { 'change' } type - Event type.
* @param { Array<string> } owners - Indicates the account owners, which are specified
* by {@link AppAccount#AppAccount(String name, String owner)}.
* @param { Callback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#on
*/
on(type: 'change', owners: Array<string>, callback: Callback<Array<AppAccountInfo>>): void;
/**
* Subscribes to the change events of accounts of the specified owners.
* <p>
* When the account owner updates the account, the subscriber will receive a notification
* about the account change event.
*
* @param { 'accountChange' } type - Event type.
* @param { Array<string> } owners - Indicates the account owners, which are specified
* by {@link AppAccount#AppAccount(String name, String owner)}.
* @param { Callback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type or owners.
* @throws { BusinessError } 12400001 - Application not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
on(type: 'accountChange', owners: Array<string>, callback: Callback<Array<AppAccountInfo>>): void;
/**
* Unsubscribes from account events.
*
* @param { 'change' } type - Event type.
* @param { Callback<Array<AppAccountInfo>> } [callback] - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 7
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#off
*/
off(type: 'change', callback?: Callback<Array<AppAccountInfo>>): void;
/**
* Unsubscribes from account events.
*
* @param { 'accountChange' } type - Event type.
* @param { Callback<Array<AppAccountInfo>> } [callback] - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>>): void;
/**
* Authenticates an application account to get an oauth token.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { object } options - Indicates the authenticator-specific options for the request.
* @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#auth
*/
authenticate(
name: string,
owner: string,
authType: string,
options: { [key: string]: any },
callback: AuthenticatorCallback
): void;
/**
* Authenticates an application account to get an auth token.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
auth(name: string, owner: string, authType: string, callback: AuthCallback): void;
/**
* Authenticates an application account to get an auth token.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { Record<string, Object> } options - Indicates the authenticator-specific options for the request.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner, authType or options.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
auth(
name: string,
owner: string,
authType: string,
options: Record<string, Object>,
callback: AuthCallback
): void;
/**
* Gets an oauth token with the specified authentication type from a particular application account.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns an oauth token.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAuthToken
*/
getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback<string>): void;
/**
* Gets an oauth token with the specified authentication type from a particular application account.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @returns { Promise<string> } Returns an oauth token.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAuthToken
*/
getOAuthToken(name: string, owner: string, authType: string): Promise<string>;
/**
* Gets an auth token with the specified authentication type from a particular application account.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns an auth token.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback<string>): void;
/**
* Gets an auth token with the specified authentication type from a particular application account.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @returns { Promise<string> } Returns an auth token.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthToken(name: string, owner: string, authType: string): Promise<string>;
/**
* Sets an oauth token with the specified authentication type for a particular account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAuthToken
*/
setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void;
/**
* Sets an oauth token with the specified authentication type for a particular account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAuthToken
*/
setOAuthToken(name: string, authType: string, token: string): Promise<void>;
/**
* Sets an auth token with the specified authentication type for a particular account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void;
/**
* Sets an auth token with the specified authentication type for a particular account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthToken(name: string, authType: string, token: string): Promise<void>;
/**
* Deletes an oauth token for the specified application account.
* <p>
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @param { AsyncCallback<void> } callback Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#deleteAuthToken
*/
deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback<void>): void;
/**
* Deletes an oauth token for the specified application account.
* <p>
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the oauth token.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#deleteAuthToken
*/
deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise<void>;
/**
* Deletes an auth token for the specified application account.
* <p>
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
deleteAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback<void>): void;
/**
* Deletes an auth token for the specified application account.
* <p>
* Only tokens visible to the caller application can be deleted.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } token - Indicates the auth token.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner, authType or token.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
deleteAuthToken(name: string, owner: string, authType: string, token: string): Promise<void>;
/**
* Sets the oauth token visibility of the specified authentication type to a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAuthTokenVisibility
*/
setOAuthTokenVisibility(
name: string,
authType: string,
bundleName: string,
isVisible: boolean,
callback: AsyncCallback<void>
): void;
/**
* Sets the oauth token visibility of the specified authentication type to a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#setAuthTokenVisibility
*/
setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise<void>;
/**
* Sets the auth token visibility of the specified authentication type to a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @throws { BusinessError } 12400001 - Application not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthTokenVisibility(
name: string,
authType: string,
bundleName: string,
isVisible: boolean,
callback: AsyncCallback<void>
): void;
/**
* Sets the auth token visibility of the specified authentication type to a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { boolean } isVisible - Indicates the bool value of visibility.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @throws { BusinessError } 12400001 - Application not found.
* @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise<void>;
/**
* Checks the oauth token visibility of the specified authentication type for a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback<boolean> } callback - Asynchronous callback interface. Returns the bool value of visibility.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#checkAuthTokenVisibility
*/
checkOAuthTokenVisibility(
name: string,
authType: string,
bundleName: string,
callback: AsyncCallback<boolean>
): void;
/**
* Checks the oauth token visibility of the specified authentication type for a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise<boolean> } Returns the bool value of visibility.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#checkAuthTokenVisibility
*/
checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise<boolean>;
/**
* Checks the auth token visibility of the specified authentication type for a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAuthTokenVisibility(
name: string,
authType: string,
bundleName: string,
callback: AsyncCallback<boolean>
): void;
/**
* Checks the auth token visibility of the specified authentication type for a third-party application.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } authType - Indicates the authentication type.
* @param { string } bundleName - Indicates the bundle name of the third-party application.
* @returns { Promise<boolean> } Returns the bool value of visibility.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise<boolean>;
/**
* Gets all oauth tokens visible to the caller application.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback<Array<OAuthTokenInfo>> } callback - Asynchronous callback interface.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAllAuthTokens
*/
getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback<Array<OAuthTokenInfo>>): void;
/**
* Gets all oauth tokens visible to the caller application.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise<Array<OAuthTokenInfo>> } Returns a list of oauth tokens visible to the caller application.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAllAuthTokens
*/
getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenInfo>>;
/**
* Gets all auth tokens visible to the caller application.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback<Array<AuthTokenInfo>> } callback - Asynchronous callback interface.
* Returns a list of auth tokens visible to the caller application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or owner.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAuthTokens(name: string, owner: string, callback: AsyncCallback<Array<AuthTokenInfo>>): void;
/**
* Gets all auth tokens visible to the caller application.
*
* @param { string } name - Indicates the account name of your application or third-party applications.
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise<Array<AuthTokenInfo>> } Returns a list of auth tokens visible to the caller application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or owner.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAllAuthTokens(name: string, owner: string): Promise<Array<AuthTokenInfo>>;
/**
* Gets the open authorization list with a specified authentication type for a particular application account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { AsyncCallback<Array<string>> } callback - Asynchronous callback interface.
* Returns the open authorization list of the specified authentication type.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAuthList
*/
getOAuthList(name: string, authType: string, callback: AsyncCallback<Array<string>>): void;
/**
* Gets the open authorization list with a specified authentication type for a particular application account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @returns { Promise<Array<string>> } Returns the open authorization list of the specified authentication type.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAuthList
*/
getOAuthList(name: string, authType: string): Promise<Array<string>>;
/**
* Gets the open authorization list with a specified authentication type for a particular application account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @param { AsyncCallback<Array<string>> } callback - Asynchronous callback interface.
* Returns the open authorization list of the specified authentication type.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthList(name: string, authType: string, callback: AsyncCallback<Array<string>>): void;
/**
* Gets the open authorization list with a specified authentication type for a particular application account.
* <p>
* Only the owner of the application account has the permission to call this method.
*
* @param { string } name - Indicates the account name of your application.
* @param { string } authType - Indicates the authentication type.
* @returns { Promise<Array<string>> } Returns the open authorization list of the specified authentication type.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300107 - AuthType not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthList(name: string, authType: string): Promise<Array<string>>;
/**
* Gets the authenticator callback with the specified session id.
* <p>
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @param { AsyncCallback<AuthenticatorCallback> } callback - Asynchronous callback interface.
* Returns the authenticator callback related to the session id.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAuthCallback
*/
getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<AuthenticatorCallback>): void;
/**
* Gets the authenticator callback with the specified session id.
* <p>
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @returns { Promise<AuthenticatorCallback> } Returns the authenticator callback related to the session id.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#getAuthCallback
*/
getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>;
/**
* Obtains the authenticator callback with the specified session id.
* <p>
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @param { AsyncCallback<AuthCallback> } callback - Asynchronous callback interface.
* Returns the authenticator callback related to the session id.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid sessionId.
* @throws { BusinessError } 12300108 - Session not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>): void;
/**
* Obtains the authenticator callback with the specified session id.
* <p>
* Only the owner of the authenticator has the permission to call this method.
*
* @param { string } sessionId - Indicates the id of a authentication session.
* @returns { Promise<AuthCallback> } Returns the authenticator callback related to the session id.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid sessionId.
* @throws { BusinessError } 12300108 - Session not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getAuthCallback(sessionId: string): Promise<AuthCallback>;
/**
* Gets the authenticator information of an application account.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback<AuthenticatorInfo> } callback - Asynchronous callback interface.
* Returns the authenticator information of the application account.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#queryAuthenticatorInfo
*/
getAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo>): void;
/**
* Gets the authenticator information of an application account.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise<AuthenticatorInfo> } Returns the authenticator information of the application account.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AppAccountManager#queryAuthenticatorInfo
*/
getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>;
/**
* Queries the authenticator information of an application account.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @param { AsyncCallback<AuthenticatorInfo> } callback - Asynchronous callback interface.
* Returns the authenticator information of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
queryAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo>): void;
/**
* Queries the authenticator information of an application account.
*
* @param { string } owner - Indicates the account owner of your application or third-party applications.
* @returns { Promise<AuthenticatorInfo> } Returns the authenticator information of the application account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
queryAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>;
/**
* Checks whether a particular account has all specified labels.
*
* @param { string } name - Indicates the account name.
* @param { string } owner - Indicates the account owner.
* @param { Array<string> } labels - Indicates an array of labels to check.
* @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or labels.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAccountLabels(name: string, owner: string, labels: Array<string>, callback: AsyncCallback<boolean>): void;
/**
* Checks whether a particular account has all specified labels.
*
* @param { string } name - Indicates the account name.
* @param { string } owner - Indicates the account owner.
* @param { Array<string> } labels - Indicates an array of labels to check.
* @returns { Promise<boolean> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or labels.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<boolean>;
/**
* Deletes the credential of the specified application account.
*
* @param { string } name - Indicates the account name.
* @param { string } credentialType - Indicates the type of the credential to delete.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or credentialType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - Credential not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
deleteCredential(name: string, credentialType: string, callback: AsyncCallback<void>): void;
/**
* Deletes the credential of the specified application account.
*
* @param { string } name - Indicates the account name.
* @param { string } credentialType - Indicates the type of the credential to delete.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or credentialType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - Credential not found.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
deleteCredential(name: string, credentialType: string): Promise<void>;
/**
* Selects a list of accounts that satisfied with the specified options.
*
* @param { SelectAccountsOptions } options - Indicates the options for selecting account.
* @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid options.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback<Array<AppAccountInfo>>): void;
/**
* Selects a list of accounts that satisfied with the specified options.
*
* @param { SelectAccountsOptions } options - Indicates the options for selecting account.
* @returns { Promise<Array<AppAccountInfo>> } Returns a list of accounts.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid options.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<AppAccountInfo>>;
/**
* Verifies the credential to ensure the user is the owner of the specified account.
*
* @param { string } name - Indicates the account name.
* @param { string } owner - Indicates the account owner.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or owner.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
verifyCredential(name: string, owner: string, callback: AuthCallback): void;
/**
* Verifies the credential to ensure the user is the owner of the specified account.
*
* @param { string } name - Indicates the account name.
* @param { string } owner - Indicates the account owner.
* @param { VerifyCredentialOptions } options - Indicates the options for verifying credential.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name, owner or options.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthCallback): void;
/**
* Sets properties for the specified account authenticator.
* <p>
* If the authenticator supports setting its properties,
* the caller will normally be redirected to an Ability specified by Want for property setting.
*
* @param { string } owner - Indicates the owner of authenticator.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
/**
* Sets properties for the specified account authenticator.
* <p>
* If the authenticator supports setting its properties,
* the caller will normally be redirected to an Ability specified by Want for property setting.
*
* @param { string } owner - Indicates the owner of authenticator.
* @param { SetPropertiesOptions } options - Indicates the options for setting properties.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid owner or options.
* @throws { BusinessError } 12300010 - Account service busy.
* @throws { BusinessError } 12300113 - Authenticator service not found.
* @throws { BusinessError } 12300114 - Authenticator service exception.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callback: AuthCallback): void;
}
/**
* Provides basic information of an application account, including the account owner and name.
*
* @interface AppAccountInfo
* @syscap SystemCapability.Account.AppAccount
* @since 7
*/
interface AppAccountInfo {
/**
* The owner an application account.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 7
*/
owner: string;
/**
* The name an application account.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 7
*/
name: string;
}
/**
* Provides basic information of an oauth token, including the authentication type and token value.
*
* @interface OAuthTokenInfo
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.AuthTokenInfo
*/
interface OAuthTokenInfo {
/**
* The authentication type.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
authType: string;
/**
* The token value.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
token: string;
}
/**
* Provides basic information of an auth token, including the authentication type and token value.
*
* @interface AuthTokenInfo
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface AuthTokenInfo {
/**
* The authentication type.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
authType: string;
/**
* The token value.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
token: string;
/**
* The account to which the token belongs.
*
* @type { ?AppAccountInfo }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
account?: AppAccountInfo;
}
/**
* Provides basic information of an authenticator, including the authenticator owner, icon id and label id.
*
* @interface AuthenticatorInfo
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
interface AuthenticatorInfo {
/**
* The owner of an authenticator.
*
* @type { string }
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
owner: string;
/**
* The icon id of an authenticator.
*
* @type { number }
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
iconId: number;
/**
* The label id of an authenticator.
*
* @type { number }
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
labelId: number;
}
/**
* Provides the definition of the authentication result.
*
* @interface AuthResult
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface AuthResult {
/**
* The account information.
*
* @type { ?AppAccountInfo }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
account?: AppAccountInfo;
/**
* The token information.
*
* @type { ?AuthTokenInfo }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
tokenInfo?: AuthTokenInfo;
}
/**
* Provides the available options for creating an account.
*
* @interface CreateAccountOptions
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface CreateAccountOptions {
/**
* The custom data for creating an account,
* which can be further modified by function setCustomData.
*
* @type { ?Record<string, string> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
customData?: Record<string, string>;
}
/**
* Provides the available options for creating an account implicitly.
*
* @interface CreateAccountImplicitlyOptions
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface CreateAccountImplicitlyOptions {
/**
* The required labels for creating an account.
*
* @type { ?Array<string> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
requiredLabels?: Array<string>;
/**
* The authentication type.
*
* @type { ?string }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
authType?: string;
/**
* The authenticator-specific parameters.
* The list of reserved parameter name:
* 1. Constants.KEY_CALLER_BUNDLE_NAME;
* The above parameters are set by the appAccount management service and can be used for identify the caller.
*
* @type { ?Record<string, Object> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
parameters?: Record<string, Object>;
}
/**
* Provides the available options for selecting accounts.
*
* @interface SelectAccountsOptions
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface SelectAccountsOptions {
/**
* The list of accounts allowed to be selected.
*
* @type { ?Array<AppAccountInfo> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
allowedAccounts?: Array<AppAccountInfo>;
/**
* The list of account owners, whose accounts allowed to be selected.
*
* @type { ?Array<string> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
allowedOwners?: Array<string>;
/**
* The labels required for the selected accounts.
*
* @type { ?Array<string> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
requiredLabels?: Array<string>;
}
/**
* Provides the available options for verifying credential.
*
* @interface VerifyCredentialOptions
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface VerifyCredentialOptions {
/**
* The credential type to be verified.
*
* @type { ?string }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
credentialType?: string;
/**
* The credential to be verified.
*
* @type { ?string }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
credential?: string;
/**
* The authenticator-specific parameters.
* The list of reserved parameter name:
* 1. Constants.KEY_CALLER_BUNDLE_NAME;
* The above parameters are set by the appAccount management service and can be used for identify the caller.
*
* @type { ?Record<string, Object> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
parameters?: Record<string, Object>;
}
/**
* Provides the available options for setting properties.
*
* @interface SetPropertiesOptions
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface SetPropertiesOptions {
/**
* The properties to be set.
*
* @type { ?Record<string, Object> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
properties?: Record<string, Object>;
/**
* The authenticator-specific parameters.
* The list of reserved parameter name:
* 1. Constants.KEY_CALLER_BUNDLE_NAME;
* The above parameters are set by the appAccount management service and can be used for identify the caller.
*
* @type { ?Record<string, Object> }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
parameters?: Record<string, Object>;
}
/**
* Provides constants definition.
*
* @enum { string } Constants
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
enum Constants {
/**
* Indicates the action for adding account implicitly.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.Constants#ACTION_CREATE_ACCOUNT_IMPLICITLY
*/
ACTION_ADD_ACCOUNT_IMPLICITLY = 'addAccountImplicitly',
/**
* Indicates the action for authenticating.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.Constants#ACTION_AUTH
*/
ACTION_AUTHENTICATE = 'authenticate',
/**
* Indicates the action for creating account implicitly.
*
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
ACTION_CREATE_ACCOUNT_IMPLICITLY = 'createAccountImplicitly',
/**
* Indicates the action for authenticating.
*
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
ACTION_AUTH = 'auth',
/**
* Indicates the action for verifying credential.
*
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
ACTION_VERIFY_CREDENTIAL = 'verifyCredential',
/**
* Indicates the action for set authenticator properties.
*
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
ACTION_SET_AUTHENTICATOR_PROPERTIES = 'setAuthenticatorProperties',
/**
* Indicates the key of name.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_NAME = 'name',
/**
* Indicates the key of owner.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_OWNER = 'owner',
/**
* Indicates the key of token.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_TOKEN = 'token',
/**
* Indicates the key of action.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_ACTION = 'action',
/**
* Indicates the key of authentication type.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_AUTH_TYPE = 'authType',
/**
* Indicates the key of session id.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_SESSION_ID = 'sessionId',
/**
* Indicates the key of caller pid.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_CALLER_PID = 'callerPid',
/**
* Indicates the key of caller uid.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_CALLER_UID = 'callerUid',
/**
* Indicates the key of caller bundle name.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
*/
KEY_CALLER_BUNDLE_NAME = 'callerBundleName',
/**
* Indicates the key of required labels.
*
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
KEY_REQUIRED_LABELS = 'requiredLabels',
/**
* Indicates the key of boolean result.
*
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
KEY_BOOLEAN_RESULT = 'booleanResult'
}
/**
* Provides result code definition.
*
* @enum { number } ResultCode
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
enum ResultCode {
/**
* Indicates the success result.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
SUCCESS = 0,
/**
* Indicates the result of account not exist.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_ACCOUNT_NOT_EXIST = 10001,
/**
* Indicates the result of account service exception.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_APP_ACCOUNT_SERVICE_EXCEPTION = 10002,
/**
* Indicates the result of password is invalid.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_INVALID_PASSWORD = 10003,
/**
* Indicates the result of request is invalid.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_INVALID_REQUEST = 10004,
/**
* Indicates the result of response is invalid.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_INVALID_RESPONSE = 10005,
/**
* Indicates the result of network exception.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_NETWORK_EXCEPTION = 10006,
/**
* Indicates the result of network exception.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST = 10007,
/**
* Indicates the result of auth has been canceled.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_CANCELED = 10008,
/**
* Indicates the result of auth list is too large.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_LIST_TOO_LARGE = 10009,
/**
* Indicates the result of auth service is busy.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_SERVICE_BUSY = 10010,
/**
* Indicates the result of auth service exception.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_SERVICE_EXCEPTION = 10011,
/**
* Indicates the result of auth session is not exist.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_SESSION_NOT_EXIST = 10012,
/**
* Indicates the result of auth timeout.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_TIMEOUT = 10013,
/**
* Indicates the result of token is not exist.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_TOKEN_NOT_EXIST = 10014,
/**
* Indicates the result of token is too many.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_TOKEN_TOO_MANY = 10015,
/**
* Indicates the result of not supported action.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_UNSUPPORT_ACTION = 10016,
/**
* Indicates the result of not supported auth type.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_OAUTH_UNSUPPORT_AUTH_TYPE = 10017,
/**
* Indicates the result of permission denied.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
ERROR_PERMISSION_DENIED = 10018
}
/**
* Provides methods for authenticator callback.
*
* @interface AuthenticatorCallback
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead AppAccount.AuthCallback
*/
interface AuthenticatorCallback {
/**
* Notifies the client of the authentication result.
*
* @type { function }
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
onResult: (code: number, result: { [key: string]: any }) => void;
/**
* Notifies the client that the authentication request need to be redirected.
*
* @type { function }
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
*/
onRequestRedirected: (request: Want) => void;
}
/**
* Provides methods for authentication callback.
*
* @interface AuthCallback
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
interface AuthCallback {
/**
* Notifies the client of the authentication result.
*
* @type { function }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
onResult: (code: number, result?: AuthResult) => void;
/**
* Notifies the client that the authentication request need to be redirected.
*
* @type { function }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
onRequestRedirected: (request: Want) => void;
/**
* Notifies the client that the request is continued.
*
* @type { ?function }
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
onRequestContinued?: () => void;
}
/**
* Provides methods for authenticator.
*
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @name Authenticator
*/
class Authenticator {
/**
* Adds an application account of a specified owner implicitly.
*
* @param { string } authType - Indicates the authentication type.
* @param { string } callerBundleName - Indicates the caller bundle name.
* @param { object } options - Indicates the authenticator-specific options for the request.
* @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.Authenticator#createAccountImplicitly
*/
addAccountImplicitly(
authType: string,
callerBundleName: string,
options: { [key: string]: any },
callback: AuthenticatorCallback
): void;
/**
* Creates an application account of a specified owner implicitly.
*
* @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
createAccountImplicitly(options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;
/**
* Authenticates an application account to get an oauth token.
*
* @param { string } name - Indicates the account name.
* @param { string } authType - Indicates the authentication type.
* @param { string } callerBundleName - Indicates the caller bundle name.
* @param { object } options - Indicates the authenticator-specific options for the request.
* @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 8
* @deprecated since 9
* @useinstead appAccount.Authenticator#auth
*/
authenticate(
name: string,
authType: string,
callerBundleName: string,
options: { [key: string]: any },
callback: AuthenticatorCallback
): void;
/**
* Authenticates an application account to get an oauth token.
*
* @param { string } name - Indicates the account name.
* @param { string } authType - Indicates the authentication type.
* @param { Record<string, Object> } options - Indicates the authenticator-specific options for the request.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
auth(name: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void;
/**
* Verifies the credential to ensure the user is the owner of the specified application account.
* <p>
* The credential can be provided in the options, otherwise an Ability will normally be returned,
* which can be started by the caller to further verify credential.
*
* @param { string } name - Indicates the name of the application account.
* @param { VerifyCredentialOptions } options - Indicates the options for verifying credential.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthCallback): void;
/**
* Sets properties for the authenticator.
*
* @param { SetPropertiesOptions } options - Indicates the options for setting properties.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
setProperties(options: SetPropertiesOptions, callback: AuthCallback): void;
/**
* Checks whether a particular account has all specified labels.
*
* @param { string } name - Indicates the account name.
* @param { Array<string> } labels - Indicates an array of labels to check.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAccountLabels(name: string, labels: Array<string>, callback: AuthCallback): void;
/**
* Checks whether the specified account can be removed.
*
* @param { string } name - Indicates the account name.
* @param { AuthCallback } callback - Indicates the authenticator callback.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
checkAccountRemovable(name: string, callback: AuthCallback): void;
/**
* Gets the remote object of the authenticator for remote procedure call.
*
* @returns { rpc.RemoteObject } Returns a remote object.
* @syscap SystemCapability.Account.AppAccount
* @since 9
*/
getRemoteObject(): rpc.RemoteObject;
}
}
export default appAccount;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助