// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "instanceID",
"description": "Use <code>chrome.instanceID</code> to access the Instance ID service.",
"functions": [
{
"name": "getID",
"type": "function",
"description": "Retrieves an identifier for the app instance. The instance ID will be returned by the <code>callback</code>. The same ID will be returned as long as the application identity has not been revoked or expired.",
"parameters": [],
"returns_async": {
"name": "callback",
"description": "Function called when the retrieval completes. It should check $(ref:runtime.lastError) for error when instanceID is empty.",
"parameters": [
{
"name": "instanceID",
"type": "string",
"description": "An Instance ID assigned to the app instance."
}
]
}
},
{
"name": "getCreationTime",
"type": "function",
"description": "Retrieves the time when the InstanceID has been generated. The creation time will be returned by the <code>callback</code>.",
"parameters": [],
"returns_async": {
"name": "callback",
"description": "Function called when the retrieval completes. It should check $(ref:runtime.lastError) for error when creationTime is zero.",
"parameters": [
{
"name": "creationTime",
"type": "number",
"description": "The time when the Instance ID has been generated, represented in milliseconds since the epoch."
}
]
}
},
{
"name": "getToken",
"type": "function",
"description": "Return a token that allows the authorized entity to access the service defined by scope.",
"parameters": [
{
"name": "getTokenParams",
"type": "object",
"description": "Parameters for getToken.",
"properties": {
"authorizedEntity": {
"type": "string",
"minLength": 1,
"description": "Identifies the entity that is authorized to access resources associated with this Instance ID. It can be a project ID from <a href='https://code.google.com/apis/console'>Google developer console</a>."
},
"scope": {
"type": "string",
"minLength": 1,
"description": "Identifies authorized actions that the authorized entity can take. E.g. for sending GCM messages, <code>GCM</code> scope should be used."
},
"options": {
"deprecated": "options are deprecated and will be ignored.",
"type": "object",
"properties": {},
"additionalProperties": {
"type": "string",
"minLength": 1
},
"optional": true,
"description": "Allows including a small number of string key/value pairs that will be associated with the token and may be used in processing the request."
}
}
}
],
"returns_async": {
"name": "callback",
"description": "Function called when the retrieval completes. It should check $(ref:runtime.lastError) for error when token is empty.",
"parameters": [
{
"name": "token",
"type": "string",
"description": "A token assigned by the requested service."
}
]
}
},
{
"name": "deleteToken",
"type": "function",
"description": "Revokes a granted token.",
"parameters": [
{
"name": "deleteTokenParams",
"type": "object",
"description": "Parameters for deleteToken.",
"properties": {
"authorizedEntity": {
"type": "string",
"minLength": 1,
"description": "The authorized entity that is used to obtain the token."
},
"scope": {
"type": "string",
"minLength": 1,
"description": "The scope that is used to obtain the token."
}
}
}
],
"returns_async": {
"name": "callback",
"description": "Function called when the token deletion completes. The token was revoked successfully if $(ref:runtime.lastError) is not set.",
"parameters": []
}
},
{
"name": "deleteID",
"type": "function",
"description": "Resets the app instance identifier and revokes all tokens associated with it.",
"parameters": [],
"returns_async": {
"name": "callback",
"description": "Function called when the deletion completes. The instance identifier was revoked successfully if $(ref:runtime.lastError) is not set.",
"parameters": []
}
}
],
"events": [
{
"name": "onTokenRefresh",
"type": "function",
"description": "Fired when all the granted tokens need to be refreshed."
}
]
}
]