blob: b59b6980bf32553c948ca4812b292857ba1b279d [file] [log] [blame]
John Asmuth614db982014-04-24 15:46:26 -04001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="drive_v2.html">Drive API</a> . <a href="drive_v2.permissions.html">permissions</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#delete">delete(fileId, permissionId)</a></code></p>
79<p class="firstline">Deletes a permission from a file.</p>
80<p class="toc_element">
81 <code><a href="#get">get(fileId, permissionId)</a></code></p>
82<p class="firstline">Gets a permission by ID.</p>
83<p class="toc_element">
84 <code><a href="#getIdForEmail">getIdForEmail(email)</a></code></p>
85<p class="firstline">Returns the permission ID for an email address.</p>
86<p class="toc_element">
87 <code><a href="#insert">insert(fileId, body, sendNotificationEmails=None, emailMessage=None)</a></code></p>
88<p class="firstline">Inserts a permission for a file.</p>
89<p class="toc_element">
90 <code><a href="#list">list(fileId)</a></code></p>
91<p class="firstline">Lists a file's permissions.</p>
92<p class="toc_element">
93 <code><a href="#patch">patch(fileId, permissionId, body, transferOwnership=None)</a></code></p>
Takashi Matsuo06694102015-09-11 13:55:40 -070094<p class="firstline">Updates a permission using patch semantics.</p>
John Asmuth614db982014-04-24 15:46:26 -040095<p class="toc_element">
96 <code><a href="#update">update(fileId, permissionId, body, transferOwnership=None)</a></code></p>
97<p class="firstline">Updates a permission.</p>
98<h3>Method Details</h3>
99<div class="method">
100 <code class="details" id="delete">delete(fileId, permissionId)</code>
101 <pre>Deletes a permission from a file.
102
103Args:
104 fileId: string, The ID for the file. (required)
105 permissionId: string, The ID for the permission. (required)
106</pre>
107</div>
108
109<div class="method">
110 <code class="details" id="get">get(fileId, permissionId)</code>
111 <pre>Gets a permission by ID.
112
113Args:
114 fileId: string, The ID for the file. (required)
115 permissionId: string, The ID for the permission. (required)
116
117Returns:
118 An object of the form:
119
120 { # A permission for a file.
121 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700122 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400123 "name": "A String", # The name for this permission.
124 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700125 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
126 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400127 "authKey": "A String", # The authkey parameter required for this permission.
128 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800129 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400130 "photoLink": "A String", # A link to the profile photo, if available.
131 "role": "A String", # The primary role for this user. Allowed values are:
132 # - owner
133 # - reader
134 # - writer
135 "type": "A String", # The account type. Allowed values are:
136 # - user
137 # - group
138 # - domain
139 # - anyone
140 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
141 "A String",
142 ],
143 "selfLink": "A String", # A link back to this permission.
144 }</pre>
145</div>
146
147<div class="method">
148 <code class="details" id="getIdForEmail">getIdForEmail(email)</code>
149 <pre>Returns the permission ID for an email address.
150
151Args:
152 email: string, The email address for which to return a permission ID (required)
153
154Returns:
155 An object of the form:
156
157 { # An ID for a user or group as seen in Permission items.
158 "kind": "drive#permissionId", # This is always drive#permissionId.
159 "id": "A String", # The permission ID.
160 }</pre>
161</div>
162
163<div class="method">
164 <code class="details" id="insert">insert(fileId, body, sendNotificationEmails=None, emailMessage=None)</code>
165 <pre>Inserts a permission for a file.
166
167Args:
168 fileId: string, The ID for the file. (required)
169 body: object, The request body. (required)
170 The object takes the form of:
171
172{ # A permission for a file.
173 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700174 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400175 "name": "A String", # The name for this permission.
176 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700177 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
178 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400179 "authKey": "A String", # The authkey parameter required for this permission.
180 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800181 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400182 "photoLink": "A String", # A link to the profile photo, if available.
183 "role": "A String", # The primary role for this user. Allowed values are:
184 # - owner
185 # - reader
186 # - writer
187 "type": "A String", # The account type. Allowed values are:
188 # - user
189 # - group
190 # - domain
191 # - anyone
192 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
193 "A String",
194 ],
195 "selfLink": "A String", # A link back to this permission.
196}
197
Craig Citro065b5302014-08-14 00:47:23 -0700198 sendNotificationEmails: boolean, Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the role is owner.
John Asmuth614db982014-04-24 15:46:26 -0400199 emailMessage: string, A custom message to include in notification emails.
200
201Returns:
202 An object of the form:
203
204 { # A permission for a file.
205 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700206 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400207 "name": "A String", # The name for this permission.
208 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700209 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
210 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400211 "authKey": "A String", # The authkey parameter required for this permission.
212 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800213 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400214 "photoLink": "A String", # A link to the profile photo, if available.
215 "role": "A String", # The primary role for this user. Allowed values are:
216 # - owner
217 # - reader
218 # - writer
219 "type": "A String", # The account type. Allowed values are:
220 # - user
221 # - group
222 # - domain
223 # - anyone
224 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
225 "A String",
226 ],
227 "selfLink": "A String", # A link back to this permission.
228 }</pre>
229</div>
230
231<div class="method">
232 <code class="details" id="list">list(fileId)</code>
233 <pre>Lists a file's permissions.
234
235Args:
236 fileId: string, The ID for the file. (required)
237
238Returns:
239 An object of the form:
240
241 { # A list of permissions associated with a file.
242 "items": [ # The actual list of permissions.
243 { # A permission for a file.
244 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700245 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400246 "name": "A String", # The name for this permission.
247 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700248 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
249 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400250 "authKey": "A String", # The authkey parameter required for this permission.
251 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800252 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400253 "photoLink": "A String", # A link to the profile photo, if available.
254 "role": "A String", # The primary role for this user. Allowed values are:
255 # - owner
256 # - reader
257 # - writer
258 "type": "A String", # The account type. Allowed values are:
259 # - user
260 # - group
261 # - domain
262 # - anyone
263 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
264 "A String",
265 ],
266 "selfLink": "A String", # A link back to this permission.
267 },
268 ],
269 "kind": "drive#permissionList", # This is always drive#permissionList.
270 "etag": "A String", # The ETag of the list.
271 "selfLink": "A String", # A link back to this list.
272 }</pre>
273</div>
274
275<div class="method">
276 <code class="details" id="patch">patch(fileId, permissionId, body, transferOwnership=None)</code>
Takashi Matsuo06694102015-09-11 13:55:40 -0700277 <pre>Updates a permission using patch semantics.
John Asmuth614db982014-04-24 15:46:26 -0400278
279Args:
280 fileId: string, The ID for the file. (required)
281 permissionId: string, The ID for the permission. (required)
282 body: object, The request body. (required)
283 The object takes the form of:
284
285{ # A permission for a file.
286 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700287 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400288 "name": "A String", # The name for this permission.
289 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700290 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
291 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400292 "authKey": "A String", # The authkey parameter required for this permission.
293 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800294 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400295 "photoLink": "A String", # A link to the profile photo, if available.
296 "role": "A String", # The primary role for this user. Allowed values are:
297 # - owner
298 # - reader
299 # - writer
300 "type": "A String", # The account type. Allowed values are:
301 # - user
302 # - group
303 # - domain
304 # - anyone
305 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
306 "A String",
307 ],
308 "selfLink": "A String", # A link back to this permission.
309}
310
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000311 transferOwnership: boolean, Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.
John Asmuth614db982014-04-24 15:46:26 -0400312
313Returns:
314 An object of the form:
315
316 { # A permission for a file.
317 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700318 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400319 "name": "A String", # The name for this permission.
320 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700321 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
322 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400323 "authKey": "A String", # The authkey parameter required for this permission.
324 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800325 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400326 "photoLink": "A String", # A link to the profile photo, if available.
327 "role": "A String", # The primary role for this user. Allowed values are:
328 # - owner
329 # - reader
330 # - writer
331 "type": "A String", # The account type. Allowed values are:
332 # - user
333 # - group
334 # - domain
335 # - anyone
336 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
337 "A String",
338 ],
339 "selfLink": "A String", # A link back to this permission.
340 }</pre>
341</div>
342
343<div class="method">
344 <code class="details" id="update">update(fileId, permissionId, body, transferOwnership=None)</code>
345 <pre>Updates a permission.
346
347Args:
348 fileId: string, The ID for the file. (required)
349 permissionId: string, The ID for the permission. (required)
350 body: object, The request body. (required)
351 The object takes the form of:
352
353{ # A permission for a file.
354 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700355 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400356 "name": "A String", # The name for this permission.
357 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700358 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
359 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400360 "authKey": "A String", # The authkey parameter required for this permission.
361 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800362 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400363 "photoLink": "A String", # A link to the profile photo, if available.
364 "role": "A String", # The primary role for this user. Allowed values are:
365 # - owner
366 # - reader
367 # - writer
368 "type": "A String", # The account type. Allowed values are:
369 # - user
370 # - group
371 # - domain
372 # - anyone
373 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
374 "A String",
375 ],
376 "selfLink": "A String", # A link back to this permission.
377}
378
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000379 transferOwnership: boolean, Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.
John Asmuth614db982014-04-24 15:46:26 -0400380
381Returns:
382 An object of the form:
383
384 { # A permission for a file.
385 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700386 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400387 "name": "A String", # The name for this permission.
388 "kind": "drive#permission", # This is always drive#permission.
Craig Citro065b5302014-08-14 00:47:23 -0700389 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
390 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified.
John Asmuth614db982014-04-24 15:46:26 -0400391 "authKey": "A String", # The authkey parameter required for this permission.
392 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800393 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
John Asmuth614db982014-04-24 15:46:26 -0400394 "photoLink": "A String", # A link to the profile photo, if available.
395 "role": "A String", # The primary role for this user. Allowed values are:
396 # - owner
397 # - reader
398 # - writer
399 "type": "A String", # The account type. Allowed values are:
400 # - user
401 # - group
402 # - domain
403 # - anyone
404 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
405 "A String",
406 ],
407 "selfLink": "A String", # A link back to this permission.
408 }</pre>
409</div>
410
411</body></html>