Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / api / instance_id.json
blob71d7011921ff3e4e4a7a63d8ba9eb790189fc8ec
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6   {
7     "namespace": "instanceID",
8     "description": "Use <code>chrome.instanceID</code> to access the Instance ID service.",
9     "functions": [
10       {
11         "name": "getID",
12         "type": "function",
13         "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.",
14         "parameters": [
15           {
16             "name": "callback",
17             "type": "function",
18             "description": "Function called when the retrieval completes. It should check $(ref:runtime.lastError) for error when instanceID is empty.",
19             "parameters": [
20               {
21                 "name": "instanceID",
22                 "type": "string",
23                 "description": "An Instance ID assigned to the app instance."
24               }
25             ]
26           }
27         ]
28       },
29       {
30         "name": "getCreationTime",
31         "type": "function",
32         "description": "Retrieves the time when the InstanceID has been generated. The creation time will be returned by the <code>callback</code>.",
33         "parameters": [
34           {
35             "name": "callback",
36             "type": "function",
37             "description": "Function called when the retrieval completes. It should check $(ref:runtime.lastError) for error when creationTime is zero.",
38             "parameters": [
39               {
40                 "name": "creationTime",
41                 "type": "number",
42                 "description": "The time when the Instance ID has been generated, represented in milliseconds since the epoch."
43               }
44             ]
45           }
46         ]
47       },
48       {
49         "name": "getToken",
50         "type": "function",
51         "description": "Return a token that allows the authorized entity to access the service defined by scope.",
52         "parameters": [
53           {
54             "name": "getTokenParams",
55             "type": "object",
56             "description": "Parameters for getToken.",
57             "properties": {
58               "authorizedEntity": {
59                 "type": "string",
60                 "minLength": 1,
61                 "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>."
62               },
63               "scope": {
64                 "type": "string",
65                 "minLength": 1,
66                 "description": "Identifies authorized actions that the authorized entity can take. E.g. for sending GCM messages, <code>GCM</code> scope should be used."
67               },
68               "options": {
69                 "type": "object",
70                 "properties": {},
71                 "additionalProperties": {
72                   "type": "string",
73                   "minLength": 1
74                 },
75                 "optional": true,
76                 "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."
77               }
78             }
79           },
80           {
81             "name": "callback",
82             "type": "function",
83             "description": "Function called when the retrieval completes. It should check $(ref:runtime.lastError) for error when token is empty.",
84             "parameters": [
85               {
86                 "name": "token",
87                 "type": "string",
88                 "description": "A token assigned by the requested service."
89               }
90             ]
91           }
92         ]
93       },
94       {
95         "name": "deleteToken",
96         "type": "function",
97         "description": "Revokes a granted token.",
98         "parameters": [
99           {
100             "name": "deleteTokenParams",
101             "type": "object",
102             "description": "Parameters for deleteToken.",
103             "properties": {
104               "authorizedEntity": {
105                 "type": "string",
106                 "minLength": 1,
107                 "description": "The authorized entity that is used to obtain the token."
108               },
109               "scope": {
110                 "type": "string",
111                 "minLength": 1,
112                 "description": "The scope that is used to obtain the token."
113               }
114             }
115           },
116           {
117             "name": "callback",
118             "type": "function",
119             "description": "Function called when the token deletion completes. The token was revoked successfully if $(ref:runtime.lastError) is not set.",
120             "parameters": []
121           }
122         ]
123       },
124       {
125         "name": "deleteID",
126         "type": "function",
127         "description": "Resets the app instance identifier and revokes all tokens associated with it.",
128         "parameters": [
129           {
130             "name": "callback",
131             "type": "function",
132             "description": "Function called when the deletion completes. The instance identifier was revoked successfully if $(ref:runtime.lastError) is not set.",
133             "parameters": []
134           }
135         ]
136       }
137     ],
138     "events": [
139       {
140         "name": "onTokenRefresh",
141         "type": "function",
142         "description": "Fired when all the granted tokens need to be refreshed."
143       }
144     ]
145   }