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
@@ -97,9 +97,9 @@
let request;
if (collection.isNew) {
request = ApiClient.Collections.create(data);
request = ApiClient.collections.create(data);
} else {
request = ApiClient.Collections.update(collection.id, data);
request = ApiClient.collections.update(collection.id, data);
}
request
@@ -146,7 +146,7 @@
}
confirm(`Do you really want to delete collection "${original?.name}" and all its records?`, () => {
return ApiClient.Collections.delete(original?.id)
return ApiClient.collections.delete(original?.id)
.then(() => {
hide();
addSuccessToast(`Successfully deleted collection "${original?.name}".`);
@@ -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';
@@ -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';
@@ -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',
});
`}
@@ -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';
@@ -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';
@@ -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'
});
`}
@@ -29,7 +29,7 @@
function loadCollections() {
isLoading = true;
ApiClient.Collections.getFullList(200, { sort: "-created" })
ApiClient.collections.getFullList(200, { sort: "-created" })
.then((items) => {
collections = items;
})