Merge pull request #7776 from appwrite/feat-react-native-sdk
React Native SDK
This commit is contained in:
commit
61af107c82
99 changed files with 1422 additions and 0 deletions
|
@ -135,6 +135,24 @@ return [
|
||||||
'Java' => 'java',
|
'Java' => 'java',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'key' => 'react-native',
|
||||||
|
'name' => 'React Native',
|
||||||
|
'version' => '0.3.0',
|
||||||
|
'url' => 'https://github.com/appwrite/sdk-for-react-native',
|
||||||
|
'package' => 'https://npmjs.com/package/react-native-appwrite',
|
||||||
|
'enabled' => true,
|
||||||
|
'beta' => true,
|
||||||
|
'dev' => false,
|
||||||
|
'hidden' => false,
|
||||||
|
'family' => APP_PLATFORM_CLIENT,
|
||||||
|
'prism' => 'javascript',
|
||||||
|
'source' => \realpath(__DIR__ . '/../sdks/client-react-native'),
|
||||||
|
'gitUrl' => 'git@github.com:appwrite/sdk-for-react-native.git',
|
||||||
|
'gitRepoName' => 'sdk-for-react-native',
|
||||||
|
'gitUserName' => 'appwrite',
|
||||||
|
'gitBranch' => 'dev',
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'key' => 'graphql',
|
'key' => 'graphql',
|
||||||
'name' => 'GraphQL',
|
'name' => 'GraphQL',
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createAnonymousSession();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createEmailPasswordSession(
|
||||||
|
'email@example.com', // email
|
||||||
|
'password' // password
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createJWT();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createMfaAuthenticator(
|
||||||
|
AuthenticatorType.Totp // type
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account, AuthenticationFactor } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createMfaChallenge(
|
||||||
|
AuthenticationFactor.Email // factor
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createMfaRecoveryCodes();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Account, OAuthProvider } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createPhoneToken(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'+12065550100' // phone
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createPhoneVerification();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createPushTarget(
|
||||||
|
'<TARGET_ID>', // targetId
|
||||||
|
'<IDENTIFIER>', // identifier
|
||||||
|
'<PROVIDER_ID>' // providerId (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createRecovery(
|
||||||
|
'email@example.com', // email
|
||||||
|
'https://example.com' // url
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createSession(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>' // secret
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.createVerification(
|
||||||
|
'https://example.com' // url
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.deleteIdentity(
|
||||||
|
'<IDENTITY_ID>' // identityId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.deleteMfaAuthenticator(
|
||||||
|
AuthenticatorType.Totp, // type
|
||||||
|
'<OTP>' // otp
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.deletePushTarget(
|
||||||
|
'<TARGET_ID>' // targetId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.deleteSession(
|
||||||
|
'<SESSION_ID>' // sessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.deleteSessions();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.getMfaRecoveryCodes();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.getPrefs();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.getSession(
|
||||||
|
'<SESSION_ID>' // sessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.get();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.listIdentities(
|
||||||
|
[] // queries (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.listLogs(
|
||||||
|
[] // queries (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.listMfaFactors();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.listSessions();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateEmail(
|
||||||
|
'email@example.com', // email
|
||||||
|
'password' // password
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateMFA(
|
||||||
|
false // mfa
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateMagicURLSession(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>' // secret
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account, AuthenticatorType } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateMfaAuthenticator(
|
||||||
|
AuthenticatorType.Totp, // type
|
||||||
|
'<OTP>' // otp
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateMfaChallenge(
|
||||||
|
'<CHALLENGE_ID>', // challengeId
|
||||||
|
'<OTP>' // otp
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateMfaRecoveryCodes();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateName(
|
||||||
|
'<NAME>' // name
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updatePassword(
|
||||||
|
'', // password
|
||||||
|
'password' // oldPassword (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updatePhoneSession(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>' // secret
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updatePhoneVerification(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>' // secret
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updatePhone(
|
||||||
|
'+12065550100', // phone
|
||||||
|
'password' // password
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updatePrefs(
|
||||||
|
{} // prefs
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updatePushTarget(
|
||||||
|
'<TARGET_ID>', // targetId
|
||||||
|
'<IDENTIFIER>' // identifier
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateRecovery(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>', // secret
|
||||||
|
'' // password
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateSession(
|
||||||
|
'<SESSION_ID>' // sessionId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateStatus();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Account } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
const result = await account.updateVerification(
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>' // secret
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Avatars, Browser } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const avatars = new Avatars(client);
|
||||||
|
|
||||||
|
const result = avatars.getBrowser(
|
||||||
|
Browser.AvantBrowser, // code
|
||||||
|
0, // width (optional)
|
||||||
|
0, // height (optional)
|
||||||
|
0 // quality (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(result);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Avatars, CreditCard } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const avatars = new Avatars(client);
|
||||||
|
|
||||||
|
const result = avatars.getCreditCard(
|
||||||
|
CreditCard.AmericanExpress, // code
|
||||||
|
0, // width (optional)
|
||||||
|
0, // height (optional)
|
||||||
|
0 // quality (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(result);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Avatars } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const avatars = new Avatars(client);
|
||||||
|
|
||||||
|
const result = avatars.getFlag(
|
||||||
|
Flag.Afghanistan, // code
|
||||||
|
0, // width (optional)
|
||||||
|
0, // height (optional)
|
||||||
|
0 // quality (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(result);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Avatars } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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,17 @@
|
||||||
|
import { Client, Databases } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
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(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Databases } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const databases = new Databases(client);
|
||||||
|
|
||||||
|
const result = await databases.deleteDocument(
|
||||||
|
'<DATABASE_ID>', // databaseId
|
||||||
|
'<COLLECTION_ID>', // collectionId
|
||||||
|
'<DOCUMENT_ID>' // documentId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Databases } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Databases } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const databases = new Databases(client);
|
||||||
|
|
||||||
|
const result = await databases.listDocuments(
|
||||||
|
'<DATABASE_ID>', // databaseId
|
||||||
|
'<COLLECTION_ID>', // collectionId
|
||||||
|
[] // queries (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Client, Databases } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { Client, Functions, ExecutionMethod } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Functions } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const functions = new Functions(client);
|
||||||
|
|
||||||
|
const result = await functions.getExecution(
|
||||||
|
'<FUNCTION_ID>', // functionId
|
||||||
|
'<EXECUTION_ID>' // executionId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Functions } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const functions = new Functions(client);
|
||||||
|
|
||||||
|
const result = await functions.listExecutions(
|
||||||
|
'<FUNCTION_ID>', // functionId
|
||||||
|
[], // queries (optional)
|
||||||
|
'<SEARCH>' // search (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Graphql } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const graphql = new Graphql(client);
|
||||||
|
|
||||||
|
const result = await graphql.mutation(
|
||||||
|
{} // query
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Graphql } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const graphql = new Graphql(client);
|
||||||
|
|
||||||
|
const result = await graphql.query(
|
||||||
|
{} // query
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.get();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listCodes();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listContinents();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listCountriesEU();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listCountriesPhones();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listCountries();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listCurrencies();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Client, Locale } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const locale = new Locale(client);
|
||||||
|
|
||||||
|
const result = await locale.listLanguages();
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Messaging } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const messaging = new Messaging(client);
|
||||||
|
|
||||||
|
const result = await messaging.createSubscriber(
|
||||||
|
'<TOPIC_ID>', // topicId
|
||||||
|
'<SUBSCRIBER_ID>', // subscriberId
|
||||||
|
'<TARGET_ID>' // targetId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Messaging } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const messaging = new Messaging(client);
|
||||||
|
|
||||||
|
const result = await messaging.deleteSubscriber(
|
||||||
|
'<TOPIC_ID>', // topicId
|
||||||
|
'<SUBSCRIBER_ID>' // subscriberId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
const result = await storage.deleteFile(
|
||||||
|
'<BUCKET_ID>', // bucketId
|
||||||
|
'<FILE_ID>' // fileId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
const result = storage.getFileDownload(
|
||||||
|
'<BUCKET_ID>', // bucketId
|
||||||
|
'<FILE_ID>' // fileId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(result);
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { Client, Storage, ImageGravity, ImageFormat } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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)
|
||||||
|
0, // quality (optional)
|
||||||
|
0, // borderWidth (optional)
|
||||||
|
'', // borderColor (optional)
|
||||||
|
0, // borderRadius (optional)
|
||||||
|
0, // opacity (optional)
|
||||||
|
-360, // rotation (optional)
|
||||||
|
'', // background (optional)
|
||||||
|
ImageFormat.Jpg // output (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(result);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
const result = storage.getFileView(
|
||||||
|
'<BUCKET_ID>', // bucketId
|
||||||
|
'<FILE_ID>' // fileId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(result);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
const result = await storage.getFile(
|
||||||
|
'<BUCKET_ID>', // bucketId
|
||||||
|
'<FILE_ID>' // fileId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const storage = new Storage(client);
|
||||||
|
|
||||||
|
const result = await storage.listFiles(
|
||||||
|
'<BUCKET_ID>', // bucketId
|
||||||
|
[], // queries (optional)
|
||||||
|
'<SEARCH>' // search (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Storage } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // 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(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.create(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
'<NAME>', // name
|
||||||
|
[] // roles (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.deleteMembership(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
'<MEMBERSHIP_ID>' // membershipId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.delete(
|
||||||
|
'<TEAM_ID>' // teamId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.getMembership(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
'<MEMBERSHIP_ID>' // membershipId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.getPrefs(
|
||||||
|
'<TEAM_ID>' // teamId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.get(
|
||||||
|
'<TEAM_ID>' // teamId
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.listMemberships(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
[], // queries (optional)
|
||||||
|
'<SEARCH>' // search (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.list(
|
||||||
|
[], // queries (optional)
|
||||||
|
'<SEARCH>' // search (optional)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.updateMembershipStatus(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
'<MEMBERSHIP_ID>', // membershipId
|
||||||
|
'<USER_ID>', // userId
|
||||||
|
'<SECRET>' // secret
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.updateMembership(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
'<MEMBERSHIP_ID>', // membershipId
|
||||||
|
[] // roles
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.updateName(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
'<NAME>' // name
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Client, Teams } from "react-native-appwrite";
|
||||||
|
|
||||||
|
const client = new Client()
|
||||||
|
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2'); // Your project ID
|
||||||
|
|
||||||
|
const teams = new Teams(client);
|
||||||
|
|
||||||
|
const result = await teams.updatePrefs(
|
||||||
|
'<TEAM_ID>', // teamId
|
||||||
|
{} // prefs
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(response);
|
1
docs/sdks/react-native/CHANGELOG.md
Normal file
1
docs/sdks/react-native/CHANGELOG.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Change log
|
85
docs/sdks/react-native/GETTING_STARTED.md
Normal file
85
docs/sdks/react-native/GETTING_STARTED.md
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Add your Platform
|
||||||
|
If this is your first time using Appwrite, create an account and create your first project.
|
||||||
|
|
||||||
|
Then, under **Add a platform**, add a **Android app** or a **Apple app**. You can skip optional steps.
|
||||||
|
|
||||||
|
#### iOS steps
|
||||||
|
Add your app **name** and **Bundle ID**. You can find your **Bundle Identifier** in the **General** tab for your app's primary target in XCode. For Expo projects you can set or find it on **app.json** file at your project's root directory.
|
||||||
|
|
||||||
|
#### Android steps
|
||||||
|
Add your app's **name** and **package name**, Your package name is generally the **applicationId** in your app-level **build.gradle** file. For Expo projects you can set or find it on **app.json** file at your project's root directory.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
On `index.js` add import for `react-native-url-polyfill`
|
||||||
|
|
||||||
|
```
|
||||||
|
import 'react-native-url-polyfill/auto'
|
||||||
|
```
|
||||||
|
|
||||||
|
> If you are building for iOS, don't forget to install pods
|
||||||
|
> `cd ios && pod install && cd ..`
|
||||||
|
|
||||||
|
### Init your SDK
|
||||||
|
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page.
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { Client } from 'react-native-appwrite';
|
||||||
|
// Init your React Native SDK
|
||||||
|
const client = new Client();
|
||||||
|
|
||||||
|
client
|
||||||
|
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
|
||||||
|
.setProject('455x34dfkj') // Your project ID
|
||||||
|
.setPlatform('com.example.myappwriteapp') // Your application ID or bundle ID.
|
||||||
|
;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Make Your First Request
|
||||||
|
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
// Register User
|
||||||
|
account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response);
|
||||||
|
}, function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Full Example
|
||||||
|
```js
|
||||||
|
import { Client, Account } from 'react-native-appwrite';
|
||||||
|
// Init your React Native SDK
|
||||||
|
const client = new Client();
|
||||||
|
|
||||||
|
client
|
||||||
|
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
|
||||||
|
.setProject('455x34dfkj')
|
||||||
|
.setPlatform('com.example.myappwriteapp') // YOUR application ID
|
||||||
|
;
|
||||||
|
|
||||||
|
const account = new Account(client);
|
||||||
|
|
||||||
|
// Register User
|
||||||
|
account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response);
|
||||||
|
}, function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Learn more
|
||||||
|
You can use the following resources to learn more and get help
|
||||||
|
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/quick-starts/react-native)
|
||||||
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||||
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||||
|
- 🚂 [Appwrite React Native Playground](https://github.com/appwrite/playground-for-react-native)
|
|
@ -15,6 +15,7 @@ use Appwrite\SDK\Language\Kotlin;
|
||||||
use Appwrite\SDK\Language\Node;
|
use Appwrite\SDK\Language\Node;
|
||||||
use Appwrite\SDK\Language\PHP;
|
use Appwrite\SDK\Language\PHP;
|
||||||
use Appwrite\SDK\Language\Python;
|
use Appwrite\SDK\Language\Python;
|
||||||
|
use Appwrite\SDK\Language\ReactNative;
|
||||||
use Appwrite\SDK\Language\REST;
|
use Appwrite\SDK\Language\REST;
|
||||||
use Appwrite\SDK\Language\Ruby;
|
use Appwrite\SDK\Language\Ruby;
|
||||||
use Appwrite\SDK\Language\Swift;
|
use Appwrite\SDK\Language\Swift;
|
||||||
|
@ -159,6 +160,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
$config = new Flutter();
|
$config = new Flutter();
|
||||||
$config->setPackageName('appwrite');
|
$config->setPackageName('appwrite');
|
||||||
break;
|
break;
|
||||||
|
case 'react-native':
|
||||||
|
$config = new ReactNative();
|
||||||
|
$config->setNPMPackage('react-native-appwrite');
|
||||||
|
break;
|
||||||
case 'flutter-dev':
|
case 'flutter-dev':
|
||||||
$config = new Flutter();
|
$config = new Flutter();
|
||||||
$config->setPackageName('appwrite_dev');
|
$config->setPackageName('appwrite_dev');
|
||||||
|
|
Loading…
Reference in a new issue