update: generate docs examples as per latest 1.8.x source.

This commit is contained in:
Darshan
2025-06-19 18:13:27 +05:30
parent c7a3ffdb71
commit 974037ee38
6235 changed files with 96496 additions and 0 deletions
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createAnonymousSession();
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createEmailPasswordSession(
'email@example.com', // email
'password' // password
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createEmailToken(
'<USER_ID>', // userId
'email@example.com', // email
false // phrase (optional)
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createJWT();
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createMagicURLToken(
'<USER_ID>', // userId
'email@example.com', // email
'https://example.com', // url (optional)
false // phrase (optional)
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createMfaAuthenticator(
AuthenticatorType.Totp // type
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account, AuthenticationFactor } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createMfaChallenge(
AuthenticationFactor.Email // factor
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createMfaRecoveryCodes();
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Account, OAuthProvider } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
account.createOAuth2Session(
OAuthProvider.Amazon, // provider
'https://example.com', // success (optional)
'https://example.com', // failure (optional)
[] // scopes (optional)
);
@@ -0,0 +1,15 @@
import { Client, Account, OAuthProvider } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
account.createOAuth2Token(
OAuthProvider.Amazon, // provider
'https://example.com', // success (optional)
'https://example.com', // failure (optional)
[] // scopes (optional)
);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createPhoneToken(
'<USER_ID>', // userId
'+12065550100' // phone
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createPhoneVerification();
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createPushTarget(
'<TARGET_ID>', // targetId
'<IDENTIFIER>', // identifier
'<PROVIDER_ID>' // providerId (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createRecovery(
'email@example.com', // email
'https://example.com' // url
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.createVerification(
'https://example.com' // url
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.create(
'<USER_ID>', // userId
'email@example.com', // email
'', // password
'<NAME>' // name (optional)
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.deleteIdentity(
'<IDENTITY_ID>' // identityId
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.deleteMfaAuthenticator(
AuthenticatorType.Totp // type
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.deletePushTarget(
'<TARGET_ID>' // targetId
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.deleteSession(
'<SESSION_ID>' // sessionId
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.deleteSessions();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.getMfaRecoveryCodes();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.getPrefs();
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.getSession(
'<SESSION_ID>' // sessionId
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.get();
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.listIdentities(
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.listLogs(
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.listMfaFactors();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.listSessions();
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateEmail(
'email@example.com', // email
'password' // password
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateMFA(
false // mfa
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateMagicURLSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateMfaAuthenticator(
AuthenticatorType.Totp, // type
'<OTP>' // otp
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateMfaChallenge(
'<CHALLENGE_ID>', // challengeId
'<OTP>' // otp
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateMfaRecoveryCodes();
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateName(
'<NAME>' // name
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updatePassword(
'', // password
'password' // oldPassword (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updatePhoneSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updatePhoneVerification(
'<USER_ID>', // userId
'<SECRET>' // secret
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updatePhone(
'+12065550100', // phone
'password' // password
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updatePrefs(
{} // prefs
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updatePushTarget(
'<TARGET_ID>', // targetId
'<IDENTIFIER>' // identifier
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateRecovery(
'<USER_ID>', // userId
'<SECRET>', // secret
'' // password
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateSession(
'<SESSION_ID>' // sessionId
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateStatus();
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Account } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const account = new Account(client);
const result = await account.updateVerification(
'<USER_ID>', // userId
'<SECRET>' // secret
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Avatars, Browser } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getBrowser(
Browser.AvantBrowser, // code
0, // width (optional)
0, // height (optional)
-1 // quality (optional)
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Avatars, CreditCard } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getCreditCard(
CreditCard.AmericanExpress, // code
0, // width (optional)
0, // height (optional)
-1 // quality (optional)
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Avatars } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getFavicon(
'https://example.com' // url
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Avatars, Flag } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getFlag(
Flag.Afghanistan, // code
0, // width (optional)
0, // height (optional)
-1 // quality (optional)
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Avatars } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getImage(
'https://example.com', // url
0, // width (optional)
0 // height (optional)
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Avatars } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getInitials(
'<NAME>', // name (optional)
0, // width (optional)
0, // height (optional)
'' // background (optional)
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Avatars } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getQR(
'<TEXT>', // text
1, // size (optional)
0, // margin (optional)
false // download (optional)
);
console.log(result);
@@ -0,0 +1,19 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setSession('') // The user session to authenticate with
.setKey('') //
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
const databases = new Databases(client);
const result = await databases.createDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
{}, // data
["read("any")"] // permissions (optional)
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setAdmin('') //
.setKey(''); //
const databases = new Databases(client);
const result = await databases.createDocuments(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
[] // documents
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.deleteDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>' // documentId
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.getDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.listDocuments(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,17 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.updateDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
{}, // data (optional)
["read("any")"] // permissions (optional)
);
console.log(result);
@@ -0,0 +1,17 @@
import { Client, Databases } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setSession('') // The user session to authenticate with
.setKey('') //
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
const databases = new Databases(client);
const result = await databases.upsertDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>' // documentId
);
console.log(result);
@@ -0,0 +1,19 @@
import { Client, Functions, ExecutionMethod } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const functions = new Functions(client);
const result = await functions.createExecution(
'<FUNCTION_ID>', // functionId
'<BODY>', // body (optional)
false, // async (optional)
'<PATH>', // path (optional)
ExecutionMethod.GET, // method (optional)
{}, // headers (optional)
'' // scheduledAt (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Functions } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const functions = new Functions(client);
const result = await functions.getExecution(
'<FUNCTION_ID>', // functionId
'<EXECUTION_ID>' // executionId
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Functions } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const functions = new Functions(client);
const result = await functions.listExecutions(
'<FUNCTION_ID>', // functionId
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Graphql } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const graphql = new Graphql(client);
const result = await graphql.mutation(
{} // query
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Graphql } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const graphql = new Graphql(client);
const result = await graphql.query(
{} // query
);
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.get();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listCodes();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listContinents();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listCountriesEU();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listCountriesPhones();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listCountries();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listCurrencies();
console.log(result);
@@ -0,0 +1,11 @@
import { Client, Locale } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.listLanguages();
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Messaging } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const messaging = new Messaging(client);
const result = await messaging.createSubscriber(
'<TOPIC_ID>', // topicId
'<SUBSCRIBER_ID>', // subscriberId
'<TARGET_ID>' // targetId
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Messaging } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const messaging = new Messaging(client);
const result = await messaging.deleteSubscriber(
'<TOPIC_ID>', // topicId
'<SUBSCRIBER_ID>' // subscriberId
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.createFile(
'<BUCKET_ID>', // bucketId
'<FILE_ID>', // fileId
await pickSingle(), // file
["read("any")"] // permissions (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.deleteFile(
'<BUCKET_ID>', // bucketId
'<FILE_ID>' // fileId
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = storage.getFileDownload(
'<BUCKET_ID>', // bucketId
'<FILE_ID>', // fileId
'<TOKEN>' // token (optional)
);
console.log(result);
@@ -0,0 +1,26 @@
import { Client, Storage, ImageGravity, ImageFormat } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = storage.getFilePreview(
'<BUCKET_ID>', // bucketId
'<FILE_ID>', // fileId
0, // width (optional)
0, // height (optional)
ImageGravity.Center, // gravity (optional)
-1, // quality (optional)
0, // borderWidth (optional)
'', // borderColor (optional)
0, // borderRadius (optional)
0, // opacity (optional)
-360, // rotation (optional)
'', // background (optional)
ImageFormat.Jpg, // output (optional)
'<TOKEN>' // token (optional)
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = storage.getFileView(
'<BUCKET_ID>', // bucketId
'<FILE_ID>', // fileId
'<TOKEN>' // token (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.getFile(
'<BUCKET_ID>', // bucketId
'<FILE_ID>' // fileId
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.listFiles(
'<BUCKET_ID>', // bucketId
[], // queries (optional)
'<SEARCH>' // search (optional)
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Storage } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.updateFile(
'<BUCKET_ID>', // bucketId
'<FILE_ID>', // fileId
'<NAME>', // name (optional)
["read("any")"] // permissions (optional)
);
console.log(result);
@@ -0,0 +1,19 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setSession('') // The user session to authenticate with
.setKey('') //
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
const tables = new Tables(client);
const result = await tables.createRow(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<ROW_ID>', // rowId
{}, // data
["read("any")"] // permissions (optional)
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setAdmin('') //
.setKey(''); //
const tables = new Tables(client);
const result = await tables.createRows(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
[] // rows
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const tables = new Tables(client);
const result = await tables.deleteRow(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<ROW_ID>' // rowId
);
console.log(result);
@@ -0,0 +1,16 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const tables = new Tables(client);
const result = await tables.getRow(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<ROW_ID>', // rowId
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const tables = new Tables(client);
const result = await tables.listRows(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
[] // queries (optional)
);
console.log(result);
@@ -0,0 +1,17 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const tables = new Tables(client);
const result = await tables.updateRow(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<ROW_ID>', // rowId
{}, // data (optional)
["read("any")"] // permissions (optional)
);
console.log(result);
@@ -0,0 +1,17 @@
import { Client, Tables } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setSession('') // The user session to authenticate with
.setKey('') //
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
const tables = new Tables(client);
const result = await tables.upsertRow(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<ROW_ID>' // rowId
);
console.log(result);
@@ -0,0 +1,19 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.createMembership(
'<TEAM_ID>', // teamId
[], // roles
'email@example.com', // email (optional)
'<USER_ID>', // userId (optional)
'+12065550100', // phone (optional)
'https://example.com', // url (optional)
'<NAME>' // name (optional)
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.create(
'<TEAM_ID>', // teamId
'<NAME>', // name
[] // roles (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.deleteMembership(
'<TEAM_ID>', // teamId
'<MEMBERSHIP_ID>' // membershipId
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.delete(
'<TEAM_ID>' // teamId
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.getMembership(
'<TEAM_ID>', // teamId
'<MEMBERSHIP_ID>' // membershipId
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.getPrefs(
'<TEAM_ID>' // teamId
);
console.log(result);
@@ -0,0 +1,13 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.get(
'<TEAM_ID>' // teamId
);
console.log(result);
@@ -0,0 +1,15 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.listMemberships(
'<TEAM_ID>', // teamId
[], // queries (optional)
'<SEARCH>' // search (optional)
);
console.log(result);
@@ -0,0 +1,14 @@
import { Client, Teams } from "react-native-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const teams = new Teams(client);
const result = await teams.list(
[], // queries (optional)
'<SEARCH>' // search (optional)
);
console.log(result);

Some files were not shown because too many files have changed in this diff Show More