namespace Tizen.Account.AccountManager
{
/// <summary>
- /// The AccountManager APIs is separated into two major sections:
+ /// The AccountManager APIs are separated into two major sections:
/// 1. Registering an account provider while an application is installed. This information will be used for the Add account screen.
/// 2. Adding an account information when an application signs in successfully to share the account information to the Tizen system. This information will be shown in the Tizen settings account menu.
///
/// The APIs of both of the sections consist of the following functionality:
- /// <list>
- /// <item> Create an account or account provider </item>
- /// <item> Update an account or account provider(Only available for the creator) </item>
- /// <item> Delete an account or account provider(Only available for the creator) </item>
- /// <item> Read an account or account provider with some filter </item>
+ /// <list type="bullet">
+ /// <item><description>Create an account or account provider.</description></item>
+ /// <item><description>Update an account or account provider (Only available for the creator).</description></item>
+ /// <item><description>Delete an account or account provider (Only available for the creator).</description></item>
+ /// <item><description>Read an account or account provider with some filter.</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static class AccountService
{
/// <summary>
- /// This is contact capability string.
+ /// This is the contact capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string ContactCapability = "http://tizen.org/account/capability/contact";
/// <summary>
- /// This is calendar capability string.
+ /// This is the calendar capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string CalendarCapability = "http://tizen.org/account/capability/calendar";
/// <summary>
- /// This is email capability string.
+ /// This is the email capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string EmailCapability = "http://tizen.org/account/capability/email";
/// <summary>
- /// This is photo capability string.
+ /// This is the photo capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string PhotoCapability = "http://tizen.org/account/capability/photo";
/// <summary>
- /// This is video capability string.
+ /// This is the video capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string VideoCapability = "http://tizen.org/account/capability/video";
/// <summary>
- /// This is music capability string.
+ /// This is the music capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string MusicCapability = "http://tizen.org/account/capability/music";
/// <summary>
- /// This is document capability string.
+ /// This is the document capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string DocumentCapability = "http://tizen.org/account/capability/document";
/// <summary>
- /// This is message capability string.
+ /// This is the message capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string MessageCapability = "http://tizen.org/account/capability/message";
/// <summary>
- /// This is game capability string.
+ /// This is the game capability string.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static readonly string GameCapability = "http://tizen.org/account/capability/game";
/// <summary>
- /// Retrieves all accounts details from the account database.
+ /// Retrieves all the accounts details from the account database.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <returns>List of Accounts</returns>
+ /// <returns>List of accounts.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error. </exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static IEnumerable<Account> GetAccountsAsync()
{
List<Account> accounts = new List<Account>();
List<int> values = new List<int>();
Interop.Account.AccountCallback accountCallback = (IntPtr data, IntPtr userdata) =>
{
- Account account = new Account(data);
+ Account account = new Account(new SafeAccountHandle(data, false));
values.Add(account.AccountId);
account.Dispose();
return true;
}
/// <summary>
- /// Retrieve an account with the account ID.
+ /// Retrieves the account with the account ID.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="accountId"> The account Id to be searched.</param>
- /// <returns>Account instance with reference to the given id.</returns>
+ /// <param name="accountId"> The account ID to be searched.</param>
+ /// <returns>Account instance with reference to the given ID.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account id</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account ID.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static Account GetAccountById(int accountId)
{
Account account = Account.CreateAccount();
- IntPtr handle = account.Handle;
- AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, out handle);
+ SafeAccountHandle handle = account.SafeAccountHandle;
+
+ AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, ref handle);
if (res != AccountError.None)
{
throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId);
}
+ Account ref_account = new Account(handle);
- account.Handle = handle;
- return account;
+ return ref_account;
}
/// <summary>
- /// Retrieves all AccountProviders details from the account database.
+ /// Retrieves all the AccountProviders details from the account database.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <returns>List of AccountProviders</returns>
+ /// <returns>List of AccountProviders.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static IEnumerable<AccountProvider> GetAccountProviders()
{
List<string> values = new List<string>();
}
/// <summary>
- /// Retrieves the account provider information with application Id.
+ /// Retrieves the account provider information with the application ID.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="appId">Application Id.</param>
- /// <returns>The AccountProvider instance associated with the given application Id.</returns>
+ /// <param name="appId">The application ID.</param>
+ /// <returns>The AccountProvider instance associated with the given application ID.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appid</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given appId.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static AccountProvider GetAccountProviderByAppId(string appId)
{
IntPtr handle;
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="feature">The capability value to search for account providers.</param>
- /// <returns>Retrieves AccountProviders information with the capability name.</returns>
+ /// <returns>Retrieves the AccountProviders information with the capability name.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given feature</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given feature.</exception>
+ /// <exception cref="ArgumentException"> In case of invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static IEnumerable<AccountProvider> GetAccountProvidersByFeature(string feature)
{
List<string> values = new List<string>();
}
/// <summary>
- /// Inserts into the Database with the new account Infomration.
+ /// Inserts into the Database with the new account Information.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="account">New Account instance to be added.</param>
+ /// <returns>The account ID of the account instance.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
/// <privilege>http://tizen.org/privilege/account.write </privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
/// <exception cref="OutOfMemoryException"> In case of OutOfMemory error.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static int AddAccount(Account account)
{
if (account == null)
}
int id = -1;
- AccountError err = (AccountError)Interop.AccountService.AddAccount(account.Handle, out id);
+ AccountError err = (AccountError)Interop.AccountService.AddAccount(account.SafeAccountHandle, out id);
if (err != AccountError.None)
{
throw AccountErrorFactory.CreateException(err, "Failed to AddAccount");
/// Updates the account details to the account database.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="account">account instance to be updated.</param>
+ /// <param name="account">Account instance to be updated.</param>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
/// <privilege>http://tizen.org/privilege/account.write </privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error </exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
/// <exception cref="OutOfMemoryException"> In case of OutOfMemory error.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static void UpdateAccount(Account account)
{
if (account == null)
throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to UpdateAccount");
}
- AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.Handle, account.AccountId);
+ AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.SafeAccountHandle, account.AccountId);
if (err != AccountError.None)
{
throw AccountErrorFactory.CreateException(err, "Failed to UpdateAccount");
}
/// <summary>
- /// Deletes the account information from the Database.
+ /// Deletes the account information from the database.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="account">Account instance to be deleted from the database.</param>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <privilege>http://tizen.org/privilege/account.write </privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error </exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <privilege>http://tizen.org/privilege/account.write</privilege>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static void DeleteAccount(Account account)
{
if (account == null)
}
/// <summary>
- /// Deletes an account from the account database by user name.
+ /// Deletes the account from the account database by user name.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="userName">The user name of the account to delete.</param>
/// <param name="packageName">The package name of the account to delete.</param>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <privilege>http://tizen.org/privilege/account.write </privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <privilege>http://tizen.org/privilege/account.write</privilege>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static void DeleteAccount(string userName, string packageName)
{
AccountError err = (AccountError)Interop.AccountService.DeleteAccountByUser(userName, packageName);
}
/// <summary>
- /// Deletes an account from the account database by package name.
+ /// Deletes the account from the account database by package name.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <param name="packageName">The package name of the account to delete.</param>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <privilege>http://tizen.org/privilege/account.write </privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <privilege>http://tizen.org/privilege/account.write</privilege>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static void DeleteAccount(string packageName)
{
AccountError err = (AccountError)Interop.AccountService.DeleteAccountByPackage(packageName);
}
/// <summary>
- /// Retrieves all accounts with the given user name.
+ /// Retrieves all the accounts with the given user name.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="userName">The user name to search .</param>
- /// <returns>Accounts list matched with the user name</returns>
+ /// <param name="userName">The user name to search.</param>
+ /// <returns>Accounts list matched with the user name.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given username</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given username.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static IEnumerable<Account> GetAccountsByUserName(string userName)
{
List<Account> accounts = new List<Account>();
List<int> values = new List<int>();
Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) =>
{
- Account account = new Account(handle);
+ Account account = new Account(new SafeAccountHandle(handle, false));
values.Add(account.AccountId);
account.Dispose();
return true;
}
/// <summary>
- /// Retrieves all accounts with the given package name.
+ /// Retrieves all the accounts with the given package name.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="packageName"> The package name to Search</param>
- /// <returns>Accounts list matched with the package name</returns>
+ /// <param name="packageName"> The package name to search.</param>
+ /// <returns>Accounts list matched with the package name.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given package name</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given package name.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static IEnumerable<Account> GetAccountsByPackageName(string packageName)
{
List<Account> accounts = new List<Account>();
List<int> values = new List<int>();
Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) =>
{
- Account account = new Account(handle);
+ Account account = new Account(new SafeAccountHandle(handle, false));
values.Add(account.AccountId);
account.Dispose();
return true;
}
/// <summary>
- /// Retrieves all accounts with the given cpability type.
+ /// Retrieves all accounts with the given capability type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="type"> Capability type</param>
- /// <returns>Accounts list matched with the capability type</returns>
+ /// <param name="type"> Capability type.</param>
+ /// <returns>Accounts list matched with the capability type.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given capability type</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for the given capability type.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static IEnumerable<Account> GetAccountsByCapabilityType(string type)
{
List<Account> accounts = new List<Account>();
List<int> values = new List<int>();
Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) =>
{
- Account account = new Account(handle);
+ Account account = new Account(new SafeAccountHandle(handle, false));
values.Add(account.AccountId);
account.Dispose();
return true;
}
/// <summary>
- /// Retrieves all capabilities with the given account
+ /// Retrieves all the capabilities with the given account.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="accountId">account instance</param>
- /// <returns>Capabilities list as Dictionary of Capability type and State.</returns>
+ /// <param name="accountId">Account instance.</param>
+ /// <returns>Capabilities list as dictionary of the capability type and state.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account id</exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error or record not found for given account ID.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static Dictionary<string, CapabilityState> GetCapabilitiesById(int accountId)
{
Dictionary<string, CapabilityState> capabilities = new Dictionary<string, CapabilityState>();
/// Gets the count of accounts in the account database.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <returns>The number of accounts in the database</returns>
+ /// <returns>The number of accounts in the database.</returns>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error </exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static int GetAccountsCount()
{
int count = 0;
/// Updates the sync status of the given account.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- /// <param name="account"> Account for which sync status needs to be updated</param>
+ /// <param name="account"> Account for which the sync status needs to be updated.</param>
/// <param name="status">Sync State</param>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
/// <privilege>http://tizen.org/privilege/account.write</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error </exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static void UpdateSyncStatusById(Account account, AccountSyncState status)
{
AccountError err = (AccountError)Interop.AccountService.UpdateAccountSyncStatusById(account.AccountId, (int)status);
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <remarks>
- /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new Inforamtion is Inserted.
+ /// ContentUpdate event is triggered if the MediaInformation updated/deleted or new information is inserted.
/// </remarks>
- /// <param name="sender"></param>
- /// <param name="e">A ContentUpdatedEventArgs object that contains information about the update operation.</param>
/// <privilege>http://tizen.org/privilege/account.read</privilege>
- /// <exception cref="InvalidOperationException">In case of any DB error </exception>
- /// <exception cref="ArgumentException"> In case of invalid parameter</exception>
+ /// <feature>http://tizen.org/feature/account</feature>
+ /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
+ /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
/// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
+ /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
public static event EventHandler<AccountSubscriberEventArgs> AccountUpdated
{
add