Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/1.9.x/client-graphql/examples/presences/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mutation {
status
source
expiresAt
data
metadata
}
}
```
2 changes: 1 addition & 1 deletion examples/1.9.x/client-graphql/examples/presences/upsert.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mutation {
status
source
expiresAt
data
metadata
}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```bash
appwrite compute create-database-backup-policy \
--database-id <DATABASE_ID> \
--policy-id <POLICY_ID> \
--name <NAME> \
--schedule '' \
--retention 1
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite compute list-database-backup-policies \
--database-id <DATABASE_ID> \
--limit 25
```
4 changes: 4 additions & 0 deletions examples/1.9.x/console-cli/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite presences update \
--presence-id <PRESENCE_ID>
```
1 change: 0 additions & 1 deletion examples/1.9.x/console-cli/examples/presences/upsert.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
```bash
appwrite presences upsert \
--presence-id <PRESENCE_ID> \
--user-id <USER_ID> \
--status <STATUS>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```javascript
import { Client, Compute } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const compute = new Compute(client);

const result = await compute.createDatabaseBackupPolicy({
databaseId: '<DATABASE_ID>',
policyId: '<POLICY_ID>',
name: '<NAME>',
schedule: '',
retention: 1,
type: 'full', // optional
enabled: false // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const compute = new Compute(client);
const result = await compute.createDatabase({
databaseId: '<DATABASE_ID>',
name: '<NAME>',
database: '<DATABASE>', // optional
engine: 'postgres', // optional
version: '17', // optional
region: 'fra', // optional
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Compute } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const compute = new Compute(client);

const result = await compute.listDatabaseBackupPolicies({
databaseId: '<DATABASE_ID>',
queries: [] // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const result = await compute.updateDatabase({
storageClass: 'ssd', // optional
highAvailability: false, // optional
highAvailabilityReplicaCount: 0, // optional
highAvailabilitySyncMode: 'async', // optional
networkMaxConnections: 10, // optional
networkIdleTimeoutSeconds: 60, // optional
networkIPAllowlist: [], // optional
Expand Down
20 changes: 20 additions & 0 deletions examples/1.9.x/console-web/examples/manager/delete-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```javascript
import { Client, Manager, Region, CacheTarget, CacheDatabase } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint

const manager = new Manager(client);

const result = await manager.deleteCache({
region: Region.Fra, // optional
cache: CacheTarget.Cache, // optional
all: false, // optional
database: CacheDatabase.Console, // optional
projectId: '<PROJECT_ID>', // optional
collectionId: '<COLLECTION_ID>', // optional
documentId: '<DOCUMENT_ID>' // optional
});

console.log(result);
```
20 changes: 20 additions & 0 deletions examples/1.9.x/console-web/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```javascript
import { Client, Presences, Permission, Role } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const presences = new Presences(client);

const result = await presences.update({
presenceId: '<PRESENCE_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
permissions: [Permission.read(Role.any())], // optional
purge: false // optional
});

console.log(result);
```
1 change: 0 additions & 1 deletion examples/1.9.x/console-web/examples/presences/upsert.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const presences = new Presences(client);

const result = await presences.upsert({
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>',
permissions: [Permission.read(Role.any())], // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
Expand Down
22 changes: 22 additions & 0 deletions examples/1.9.x/server-dart/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```dart
import 'package:dart_appwrite/dart_appwrite.dart';
import 'package:dart_appwrite/permission.dart';
import 'package:dart_appwrite/role.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

Presences presences = Presences(client);

Presence result = await presences.update(
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>', // (optional)
expiresAt: '2020-10-15T06:38:00.000+00:00', // (optional)
metadata: {}, // (optional)
permissions: [Permission.read(Role.any())], // (optional)
purge: false, // (optional)
);
```
21 changes: 21 additions & 0 deletions examples/1.9.x/server-dotnet/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```csharp
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;

Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetKey("<YOUR_API_KEY>"); // Your secret API key

Presences presences = new Presences(client);

Presence result = await presences.Update(
presenceId: "<PRESENCE_ID>",
userId: "<USER_ID>",
status: "<STATUS>", // optional
expiresAt: "2020-10-15T06:38:00.000+00:00", // optional
metadata: [object], // optional
permissions: new List<string> { Permission.Read(Role.Any()) }, // optional
purge: false // optional
);```
27 changes: 27 additions & 0 deletions examples/1.9.x/server-go/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```go
package main

import (
"fmt"
"github.com/appwrite/sdk-for-go/v4/client"
"github.com/appwrite/sdk-for-go/v4/presences"
)

client := client.New(
client.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1")
client.WithProject("<YOUR_PROJECT_ID>")
client.WithKey("<YOUR_API_KEY>")
)

service := presences.New(client)

response, error := service.Update(
"<PRESENCE_ID>",
"<USER_ID>",
presences.WithUpdateStatus("<STATUS>"),
presences.WithUpdateExpiresAt("2020-10-15T06:38:00.000+00:00"),
presences.WithUpdateMetadata(map[string]interface{}{}),
presences.WithUpdatePermissions(interface{}{"read("any")"}),
presences.WithUpdatePurge(false),
)
```
23 changes: 23 additions & 0 deletions examples/1.9.x/server-graphql/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```graphql
mutation {
presencesUpdate(
presenceId: "<PRESENCE_ID>",
userId: "<USER_ID>",
status: "<STATUS>",
expiresAt: "2020-10-15T06:38:00.000+00:00",
metadata: "{}",
permissions: ["read("any")"],
purge: false
) {
_id
_createdAt
_updatedAt
_permissions
userId
status
source
expiresAt
metadata
}
}
```
2 changes: 1 addition & 1 deletion examples/1.9.x/server-graphql/examples/presences/upsert.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mutation {
status
source
expiresAt
data
metadata
}
}
```
33 changes: 33 additions & 0 deletions examples/1.9.x/server-kotlin/java/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
```java
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.Permission;
import io.appwrite.Role;
import io.appwrite.services.Presences;

Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your secret API key

Presences presences = new Presences(client);

presences.update(
"<PRESENCE_ID>", // presenceId
"<USER_ID>", // userId
"<STATUS>", // status (optional)
"2020-10-15T06:38:00.000+00:00", // expiresAt (optional)
Map.of("a", "b"), // metadata (optional)
List.of(Permission.read(Role.any())), // permissions (optional)
false, // purge (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}

System.out.println(result);
})
);

```
24 changes: 24 additions & 0 deletions examples/1.9.x/server-kotlin/kotlin/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```kotlin
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Presences
import io.appwrite.Permission
import io.appwrite.Role

val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your secret API key

val presences = Presences(client)

val response = presences.update(
presenceId = "<PRESENCE_ID>",
userId = "<USER_ID>",
status = "<STATUS>", // optional
expiresAt = "2020-10-15T06:38:00.000+00:00", // optional
metadata = mapOf( "a" to "b" ), // optional
permissions = listOf(Permission.read(Role.any())), // optional
purge = false // optional
)
```
20 changes: 20 additions & 0 deletions examples/1.9.x/server-nodejs/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const presences = new sdk.Presences(client);

const result = await presences.update({
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: {}, // optional
permissions: [sdk.Permission.read(sdk.Role.any())], // optional
purge: false // optional
});
```
24 changes: 24 additions & 0 deletions examples/1.9.x/server-php/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Presences;
use Appwrite\Permission;
use Appwrite\Role;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$presences = new Presences($client);

$result = $presences->update(
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: [], // optional
permissions: [Permission::read(Role::any())], // optional
purge: false // optional
);```
26 changes: 26 additions & 0 deletions examples/1.9.x/server-python/examples/presences/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```python
from appwrite.client import Client
from appwrite.services.presences import Presences
from appwrite.models import Presence
from appwrite.permission import Permission
from appwrite.role import Role

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

presences = Presences(client)

result: Presence = presences.update(
presence_id = '<PRESENCE_ID>',
user_id = '<USER_ID>',
status = '<STATUS>', # optional
expires_at = '2020-10-15T06:38:00.000+00:00', # optional
metadata = {}, # optional
permissions = [Permission.read(Role.any())], # optional
purge = False # optional
)

print(result.model_dump())
```
Loading