# account_template.json

## Overview

Each Synergy service that wants to interact with the Account Manager service stores a file containing this object in `/usr/palm/public/accounts`. Contains callbacks and metadata. At Account service start-up, this file is scanned and registered.

Third-party apps creating services that interact with the Account Manager are required to be packaged with an `account-template.json` file containing this object along with accompanying metadata such as account icons and localized text.

## Schema

>     {
>       "templateId"            : string,
>       "loc_name"              : string,
>       "loc_usernameLabel"     : string,
>       "icon"                  : IconObj,
>       "hidden"                : boolean,
>       "config"                : any,
>       "validator"             : string | CustomValidatorObj object,
>       "readPermissions"       : array of string,
>       "writePermissions"      : array of string,
>       "onCapabilitiesChanged" : string,
>       "onCredentialsChanged"  : string,
>       "disableRemove"         : boolean,
>       "capabilityProviders"   : capability array
>       ... other user-defined fields ...
>     }

## Elements

Element | Required | Type | Description
--- | --- | --- | ---
templateId | Yes | string | Template ID.
loc_name | Yes | string | Localizable name, i.e., "Google".
loc_usernameLabel | No | string | Localizable username field label. For example: "Email Address". Default is "Username".
icon | No | IconObj | Location of app's icons.
hidden | No | boolean | Default is `false`.
config | No | any | Opaque configuration objects sent to validator. Typically, this is populated with server configuration data.
validator | No | string | Callback or CustomValidatorObj
readPermissions | No | string array | Array of IDs of apps who can read credentials. Not currently implemented.
writePermissions | No | string array | Array of IDs of apps who can write credentials. Not currently implemented.
onCapabilitiesChanged | No | string | Method to call when account capabilities change.
onCredentialsChanged | No | string | Method to call when account credentials change.
disableRemove | No | boolean | Should users be allowed to remove this account flag. Default is `true`.
capabilityProviders | Yes | capability array | Account capabilities

## Example

>     {
>       "templateId": "com.palm.google",
>       "loc_name": "Google",
>       "icon": {
>           "loc_32x32": "images/google-32x32.png",
>           "loc_48x48": "images/google-48x48.png"
>       },
>       "validator": "palm://com.palm.service.contacts.google/checkCredentials",
>       "capabilityProviders": [
>           {
>               "capability": "CONTACTS",
>               "id": "com.palm.google.contacts",
>               "loc_name": "Google Contacts",
>               "implementation": "palm://com.palm.service.contacts.google/",
>               "onCreate": "palm://com.palm.service.contacts.google/onCreate",
>               "onEnabled": "palm://com.palm.service.contacts.google/onEnabled",
>               "onDelete": "palm://com.palm.service.contacts.google/onDelete"
>           },
>           {
>               "capability": "MESSAGING",
>               "capabilitySubtype": "IM",
>               "id": "com.palm.google.talk",
>               "loc_name": "Google Talk",
>               "icon": {
>                   "loc_32x32": "images/gtalk32x32.png",
>                   "loc_48x48": "images/gtalk48x48.png",
>                   "splitter": "images/gtalk_transport_splitter.png"
>               },
>               "implementation": "palm://com.palm.imlibpurple/",
>               "onEnabled": "palm://com.palm.imlibpurple/onEnabled",
>               "serviceName":"service_gtalk",
>               "dbkinds": {
>                   "immessage":"com.palm.immessage.libpurple",
>                   "imcommand":"com.palm.imcommand.libpurple"
>               }
>           }
>       ]
>     }