bump: sdk examples.

This commit is contained in:
Darshan
2025-06-25 12:43:51 +05:30
parent 6a5ffb2e82
commit 8632f3360f
29 changed files with 54 additions and 45 deletions
@@ -0,0 +1,3 @@
appwrite databases getDatabaseUsage \
--databaseId <DATABASE_ID> \
@@ -0,0 +1,2 @@
appwrite databases listUsage \
@@ -0,0 +1,4 @@
appwrite tables getUsage \
--databaseId <DATABASE_ID> \
--tableId <TABLE_ID> \
@@ -11,7 +11,7 @@ ColumnIndex result = await tables.createIndex(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
type: .key,
type: IndexType.key,
columns: [],
orders: [], // (optional)
lengths: [], // (optional)
@@ -11,9 +11,9 @@ ColumnRelationship result = await tables.createRelationshipColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
relatedTableId: '<RELATED_TABLE_ID>',
type: .oneToOne,
type: RelationshipType.oneToOne,
twoWay: false, // (optional)
key: '', // (optional)
twoWayKey: '', // (optional)
onDelete: .cascade, // (optional)
onDelete: RelationMutate.cascade, // (optional)
);
@@ -11,6 +11,6 @@ ColumnRelationship result = await tables.updateRelationshipColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
onDelete: .cascade, // (optional)
onDelete: RelationMutate.cascade, // (optional)
newKey: '', // (optional)
);
@@ -1,4 +1,4 @@
import { Client, Tables, } from "https://deno.land/x/appwrite/mod.ts";
import { Client, Tables, IndexType } from "https://deno.land/x/appwrite/mod.ts";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,7 +11,7 @@ const response = await tables.createIndex(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
.Key, // type
IndexType.Key, // type
[], // columns
[], // orders (optional)
[] // lengths (optional)
@@ -1,4 +1,4 @@
import { Client, Tables, , } from "https://deno.land/x/appwrite/mod.ts";
import { Client, Tables, RelationshipType, RelationMutate } from "https://deno.land/x/appwrite/mod.ts";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,9 +11,9 @@ const response = await tables.createRelationshipColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<RELATED_TABLE_ID>', // relatedTableId
.OneToOne, // type
RelationshipType.OneToOne, // type
false, // twoWay (optional)
'', // key (optional)
'', // twoWayKey (optional)
.Cascade // onDelete (optional)
RelationMutate.Cascade // onDelete (optional)
);
@@ -1,4 +1,4 @@
import { Client, Tables, } from "https://deno.land/x/appwrite/mod.ts";
import { Client, Tables, RelationMutate } from "https://deno.land/x/appwrite/mod.ts";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,6 +11,6 @@ const response = await tables.updateRelationshipColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
.Cascade, // onDelete (optional)
RelationMutate.Cascade, // onDelete (optional)
'' // newKey (optional)
);
@@ -14,7 +14,7 @@ ColumnIndex result = await tables.CreateIndex(
databaseId: "<DATABASE_ID>",
tableId: "<TABLE_ID>",
key: "",
type: .Key,
type: IndexType.Key,
columns: new List<string>(),
orders: new List<string>(), // optional
lengths: new List<long>() // optional
@@ -14,9 +14,9 @@ ColumnRelationship result = await tables.CreateRelationshipColumn(
databaseId: "<DATABASE_ID>",
tableId: "<TABLE_ID>",
relatedTableId: "<RELATED_TABLE_ID>",
type: .OneToOne,
type: RelationshipType.OneToOne,
twoWay: false, // optional
key: "", // optional
twoWayKey: "", // optional
onDelete: .Cascade // optional
onDelete: RelationMutate.Cascade // optional
);
@@ -14,6 +14,6 @@ ColumnRelationship result = await tables.UpdateRelationshipColumn(
databaseId: "<DATABASE_ID>",
tableId: "<TABLE_ID>",
key: "",
onDelete: .Cascade, // optional
onDelete: RelationMutate.Cascade, // optional
newKey: "" // optional
);
@@ -1,7 +1,7 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Tables;
import io.appwrite.enums.Type;
import io.appwrite.enums.IndexType;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -14,7 +14,7 @@ tables.createIndex(
"<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId
"", // key
.KEY, // type
IndexType.KEY, // type
listOf(), // columns
listOf(), // orders (optional)
listOf(), // lengths (optional)
@@ -1,7 +1,7 @@
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Tables;
import io.appwrite.enums.Type;
import io.appwrite.enums.RelationshipType;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -14,11 +14,11 @@ tables.createRelationshipColumn(
"<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId
"<RELATED_TABLE_ID>", // relatedTableId
.ONETOONE, // type
RelationshipType.ONETOONE, // type
false, // twoWay (optional)
"", // key (optional)
"", // twoWayKey (optional)
.CASCADE, // onDelete (optional)
RelationMutate.CASCADE, // onDelete (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
@@ -13,7 +13,7 @@ tables.updateRelationshipColumn(
"<DATABASE_ID>", // databaseId
"<TABLE_ID>", // tableId
"", // key
.CASCADE, // onDelete (optional)
RelationMutate.CASCADE, // onDelete (optional)
"", // newKey (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
@@ -1,7 +1,7 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Tables
import io.appwrite.enums.Type
import io.appwrite.enums.IndexType
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -14,7 +14,7 @@ val response = tables.createIndex(
databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>",
key = "",
type = .KEY,
type = IndexType.KEY,
columns = listOf(),
orders = listOf(), // optional
lengths = listOf() // optional
@@ -1,7 +1,7 @@
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Tables
import io.appwrite.enums.Type
import io.appwrite.enums.RelationshipType
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
@@ -14,7 +14,7 @@ val response = tables.createRelationshipColumn(
databaseId = "<DATABASE_ID>",
tableId = "<TABLE_ID>",
relatedTableId = "<RELATED_TABLE_ID>",
type = .ONETOONE,
type = RelationshipType.ONETOONE,
twoWay = false, // optional
key = "", // optional
twoWayKey = "", // optional
@@ -11,7 +11,7 @@ const result = await tables.createIndex(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
sdk..Key, // type
sdk.IndexType.Key, // type
[], // columns
[], // orders (optional)
[] // lengths (optional)
@@ -11,9 +11,9 @@ const result = await tables.createRelationshipColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<RELATED_TABLE_ID>', // relatedTableId
sdk..OneToOne, // type
sdk.RelationshipType.OneToOne, // type
false, // twoWay (optional)
'', // key (optional)
'', // twoWayKey (optional)
sdk..Cascade // onDelete (optional)
sdk.RelationMutate.Cascade // onDelete (optional)
);
@@ -11,6 +11,6 @@ const result = await tables.updateRelationshipColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
sdk..Cascade, // onDelete (optional)
sdk.RelationMutate.Cascade, // onDelete (optional)
'' // newKey (optional)
);
@@ -2,7 +2,7 @@
use Appwrite\Client;
use Appwrite\Services\Tables;
use Appwrite\Enums\;
use Appwrite\Enums\IndexType;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -15,7 +15,7 @@ $result = $tables->createIndex(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
type: ::KEY(),
type: IndexType::KEY(),
columns: [],
orders: [], // optional
lengths: [] // optional
@@ -2,7 +2,7 @@
use Appwrite\Client;
use Appwrite\Services\Tables;
use Appwrite\Enums\;
use Appwrite\Enums\RelationshipType;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -15,9 +15,9 @@ $result = $tables->createRelationshipColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
relatedTableId: '<RELATED_TABLE_ID>',
type: ::ONETOONE(),
type: RelationshipType::ONETOONE(),
twoWay: false, // optional
key: '', // optional
twoWayKey: '', // optional
onDelete: ::CASCADE() // optional
onDelete: RelationMutate::CASCADE() // optional
);
@@ -14,6 +14,6 @@ $result = $tables->updateRelationshipColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
onDelete: ::CASCADE(), // optional
onDelete: RelationMutate::CASCADE(), // optional
newKey: '' // optional
);
@@ -1,6 +1,6 @@
from appwrite.client import Client
from appwrite.services.tables import Tables
from appwrite.enums import
from appwrite.enums import IndexType
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
@@ -13,7 +13,7 @@ result = tables.create_index(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
key = '',
type = .KEY,
type = IndexType.KEY,
columns = [],
orders = [], # optional
lengths = [] # optional
@@ -1,6 +1,6 @@
from appwrite.client import Client
from appwrite.services.tables import Tables
from appwrite.enums import
from appwrite.enums import RelationshipType
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
@@ -13,9 +13,9 @@ result = tables.create_relationship_column(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
related_table_id = '<RELATED_TABLE_ID>',
type = .ONETOONE,
type = RelationshipType.ONETOONE,
two_way = False, # optional
key = '', # optional
two_way_key = '', # optional
on_delete = .CASCADE # optional
on_delete = RelationMutate.CASCADE # optional
)
@@ -12,6 +12,6 @@ result = tables.update_relationship_column(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
key = '',
on_delete = .CASCADE, # optional
on_delete = RelationMutate.CASCADE, # optional
new_key = '' # optional
)
@@ -14,7 +14,7 @@ result = tables.create_index(
database_id: '<DATABASE_ID>',
table_id: '<TABLE_ID>',
key: '',
type: ::KEY,
type: IndexType::KEY,
columns: [],
orders: [], # optional
lengths: [] # optional
@@ -14,9 +14,9 @@ result = tables.create_relationship_column(
database_id: '<DATABASE_ID>',
table_id: '<TABLE_ID>',
related_table_id: '<RELATED_TABLE_ID>',
type: ::ONETOONE,
type: RelationshipType::ONETOONE,
two_way: false, # optional
key: '', # optional
two_way_key: '', # optional
on_delete: ::CASCADE # optional
on_delete: RelationMutate::CASCADE # optional
)
@@ -13,6 +13,6 @@ result = tables.update_relationship_column(
database_id: '<DATABASE_ID>',
table_id: '<TABLE_ID>',
key: '',
on_delete: ::CASCADE, # optional
on_delete: RelationMutate::CASCADE, # optional
new_key: '' # optional
)