@@ -136,25 +136,25 @@ If no specific bucket name is provided, the "default" bucket is used.
136
136
auth = credentials)
137
137
138
138
# To create a bucket.
139
- client.create_bucket(' payments' )
139
+ client.create_bucket(id = ' payments' )
140
140
141
141
# To get an existing bucket
142
- bucket = client.get_bucket(' payments' )
142
+ bucket = client.get_bucket(id = ' payments' )
143
143
144
144
# Or retrieve all readable buckets.
145
145
buckets = client.get_buckets()
146
146
147
147
# To create or replace an existing bucket.
148
- client.update_bucket(' payments' , data = {' description' : ' My payments data.' })
148
+ client.update_bucket(id = ' payments' , data = {' description' : ' My payments data.' })
149
149
150
150
# Or modify some fields in an existing bucket.
151
- client.patch_bucket(' payments' , data = {' status' : ' updated' })
151
+ client.patch_bucket(id = ' payments' , data = {' status' : ' updated' })
152
152
153
153
# It is also possible to manipulate bucket permissions (see later)
154
- client.patch_bucket(' payments' , permissions = {})
154
+ client.patch_bucket(id = ' payments' , permissions = {})
155
155
156
156
# Or delete a bucket and everything under.
157
- client.delete_bucket(' payment' )
157
+ client.delete_bucket(id = ' payment' )
158
158
159
159
# Or even every writable buckets.
160
160
client.delete_buckets()
@@ -168,22 +168,22 @@ A group associates a name to a list of principals. It is useful in order to hand
168
168
.. code-block :: python
169
169
170
170
# To create a group.
171
- client.create_group(' receipts' , bucket = ' payments' , data = {' members' : [' blah' , ' foo' ]})
171
+ client.create_group(id = ' receipts' , bucket = ' payments' , data = {' members' : [' blah' , ' foo' ]})
172
172
173
173
# Or get an existing one.
174
- group = client.get_group(' receipts' , bucket = ' payments' )
174
+ group = client.get_group(id = ' receipts' , bucket = ' payments' )
175
175
176
176
# Or retrieve all groups in the bucket.
177
177
groups = client.get_groups(bucket = ' payments' )
178
178
179
179
# To create or replace an existing bucket.
180
- client.update_group(' receipts' , bucket = ' payments' , data = {' members' : [' foo' ]})
180
+ client.update_group(id = ' receipts' , bucket = ' payments' , data = {' members' : [' foo' ]})
181
181
182
182
# Or modify some fields in an existing group.
183
- client.patch_group(' receipts' , bucket = ' payments' , data = {' description' : ' my group' })
183
+ client.patch_group(id = ' receipts' , bucket = ' payments' , data = {' description' : ' my group' })
184
184
185
185
# To delete an existing group.
186
- client.delete_group(' receipts' , bucket = ' payments' )
186
+ client.delete_group(id = ' receipts' , bucket = ' payments' )
187
187
188
188
# Or all groups in a bucket.
189
189
client.delete_groups(bucket = ' payments' )
@@ -197,22 +197,22 @@ A collection is where records are stored.
197
197
.. code-block :: python
198
198
199
199
# To create a collection.
200
- client.create_collection(' receipts' , bucket = ' payments' )
200
+ client.create_collection(id = ' receipts' , bucket = ' payments' )
201
201
202
202
# Or get an existing one.
203
- collection = client.get_collection(' receipts' , bucket = ' payments' )
203
+ collection = client.get_collection(id = ' receipts' , bucket = ' payments' )
204
204
205
205
# Or retrieve all of them inside a bucket.
206
206
collections = client.get_collections(bucket = ' payments' )
207
207
208
208
# To create or replace an exiting collection.
209
- client.update_collection(bucket = ' payments' , data = {' description' :' bleeh' })
209
+ client.update_collection(id = ' receipts ' , bucket = ' payments' , data = {' description' :' bleeh' })
210
210
211
211
# Or modify some fields of an existing collection.
212
- client.patch_collection(bucket = ' payments' , data = {' status' :' updated' })
212
+ client.patch_collection(id = ' receipts ' , bucket = ' payments' , data = {' status' :' updated' })
213
213
214
214
# To delete an existing collection.
215
- client.delete_collection(' receipts' , bucket = ' payments' )
215
+ client.delete_collection(id = ' receipts' , bucket = ' payments' )
216
216
217
217
# Or every collections in a bucket.
218
218
client.delete_collections(bucket = ' payments' )
@@ -236,7 +236,7 @@ A record is a dict with the "permissions" and "data" keys.
236
236
collection = ' todos' , bucket = ' default' )
237
237
238
238
# Or get an existing one by its id.
239
- record = client.get_record(' todo2' , collection = ' todos' , bucket = ' default' )
239
+ record = client.get_record(id = ' todo2' , collection = ' todos' , bucket = ' default' )
240
240
241
241
# Or retrieve all records.
242
242
records = client.get_records(collection = ' todos' , bucket = ' default' )
@@ -245,16 +245,13 @@ A record is a dict with the "permissions" and "data" keys.
245
245
records_timestamp = client.get_records_timestamp(collection = ' todos' , bucket = ' default' )
246
246
247
247
# To replace a record using a previously fetched record
248
- client.update_record(record, collection = ' todos' , bucket = ' default' )
248
+ client.update_record(data = record, collection = ' todos' , bucket = ' default' )
249
249
250
250
# Or create or replace it by its id.
251
- client.update_record({' status' : ' unknown' }, id = ' todo2' , collection = ' todos' , bucket = ' default' )
251
+ client.update_record(data = {' status' : ' unknown' }, id = ' todo2' , collection = ' todos' , bucket = ' default' )
252
252
253
253
# Or modify some fields in an existing record.
254
- client.patch_record({' assignee' : ' bob' }, id = ' todo2' , collection = ' todos' , bucket = ' default' )
255
-
256
- # Or update multiple records at once.
257
- client.update_records(records, collection = ' todos' )
254
+ client.patch_record(data = {' assignee' : ' bob' }, id = ' todo2' , collection = ' todos' , bucket = ' default' )
258
255
259
256
# To delete an existing record.
260
257
client.delete_record(id = ' 89881454-e4e9-4ef0-99a9-404d95900352' ,
@@ -302,7 +299,7 @@ In some cases, you might want to create a bucket, collection, group or record on
302
299
it doesn't exist already. To do so, you can pass the ``if_not_exists=True ``
303
300
to the ``create_* `` methods::
304
301
305
- client.create_bucket('bucket', if_not_exists=True)
302
+ client.create_bucket(id= 'bucket', if_not_exists=True)
306
303
307
304
Delete
308
305
------
@@ -311,7 +308,7 @@ In some cases, you might want to delete a bucket, collection, group or record on
311
308
it exists already. To do so, you can pass the ``if_exists=True ``
312
309
to the ``delete_* `` methods::
313
310
314
- client.delete_bucket('bucket', if_exists=True)
311
+ client.delete_bucket(id= 'bucket', if_exists=True)
315
312
316
313
Overwriting existing objects
317
314
----------------------------
0 commit comments