updated sdk to ^0.3.0

This commit is contained in:
Gani Georgiev
2022-08-02 17:00:14 +03:00
parent 8268c26d8b
commit a049a37624
47 changed files with 246 additions and 245 deletions

View File

@@ -82,7 +82,7 @@
const data = { ... };
const record = await client.Records.create('${collection?.name}', data);
const record = await client.records.create('${collection?.name}', data);
`}
dart={`
import 'package:pocketbase/pocketbase.dart';

View File

@@ -84,7 +84,7 @@
...
await client.Records.delete('${collection?.name}', 'RECORD_ID');
await client.records.delete('${collection?.name}', 'RECORD_ID');
`}
dart={`
import 'package:pocketbase/pocketbase.dart';

View File

@@ -97,12 +97,12 @@
...
// fetch a paginated records list
const resultList = await client.Records.getList('${collection?.name}', 1, 50, {
const resultList = await client.records.getList('${collection?.name}', 1, 50, {
filter: 'created >= '2022-01-01 00:00:00'',
});
// alternatively you can also fetch all records at once via getFullList:
const records = await client.Records.getFullList('${collection?.name}', 200 /* batch size */, {
const records = await client.records.getFullList('${collection?.name}', 200 /* batch size */, {
sort: '-created',
});
`}

View File

@@ -56,22 +56,22 @@
...
// (Optionally) authenticate
client.Users.authViaEmail('test@example.com', '123456');
client.users.authViaEmail('test@example.com', '123456');
// Subscribe to changes in any record from the collection
client.Realtime.subscribe('${collection?.name}', function (e) {
client.realtime.subscribe('${collection?.name}', function (e) {
console.log(e.record);
});
// Subscribe to changes in a single record
client.Realtime.subscribe('${collection?.name}/RECORD_ID', function (e) {
client.realtime.subscribe('${collection?.name}/RECORD_ID', function (e) {
console.log(e.record);
});
// Unsubscribe
client.Realtime.unsubscribe() // remove all subscriptions
client.Realtime.unsubscribe('${collection?.name}') // remove only the collection subscription
client.Realtime.unsubscribe('${collection?.name}/RECORD_ID') // remove only the record subscription
client.realtime.unsubscribe() // remove all subscriptions
client.realtime.unsubscribe('${collection?.name}') // remove only the collection subscription
client.realtime.unsubscribe('${collection?.name}/RECORD_ID') // remove only the record subscription
`}
dart={`
import 'package:pocketbase/pocketbase.dart';

View File

@@ -92,7 +92,7 @@
const data = { ... };
const record = await client.Records.update('${collection?.name}', 'RECORD_ID', data);
const record = await client.records.update('${collection?.name}', 'RECORD_ID', data);
`}
dart={`
import 'package:pocketbase/pocketbase.dart';

View File

@@ -72,7 +72,7 @@
...
const record = await client.Records.getOne('${collection?.name}', 'RECORD_ID', {
const record = await client.records.getOne('${collection?.name}', 'RECORD_ID', {
expand: 'some_relation'
});
`}