
Erhalten Sie kostenlose 100 -Dollar -Credits für Digitalocean:
Schließen Sie sich unserer Zwietracht bei:
Metawrite ist Appwrite SDK mit Ready to Go -Komponenten für Svelte / SvelteKit
Dieses Paket wird durch Erhöhung gepflegt.
HINWEIS: Versionen
xxnbedeutet einige geringfügige Änderungen an der Paketdokumentation oder der Typierungen.Versionen
xnxkönnen einige geringfügige Bruchänderungen enthalten. Siehe Versionshinweise.Versionen
nxxkönnten einige wichtige Bruchänderungen enthalten. Siehe Versionshinweise.
Das Paket funktioniert vollständig und kompatibel mit AppWrite Server 0.12, Web SDK 6 und SufleKit. Derzeit haben die Menschen mit npm install metawrite jedoch Schwierigkeiten. Wir haben eine vorbereitende und konfigurierte Sveltekit -Vorlage , die Metawrite verwendet und auch als Docker -Bild verwendet werden kann, wie hier beschrieben.
Bitte erwägen Sie die Verwendung von Vorlage, dies ist vorübergehend
Verwenden von NPM:
npm install metawriteMit Garn:
yarn add metawrite<User /><Create /><Preferences /><RecoverPassword /><Update /><Verification /><AuthEmail /><AuthOAuth2 /><CreateAnonymousSession /><CreateJWT /><MagicURL /><Browser /><CreditCard /><Favicon /><Flag /><Image /><QR /><Collection /><Document /><Storage /><FileList /><File /><Function /><Continents /><Countries /><Currencies /><Languages /><Locale /><PhoneCodes />Sie benötigen eine laufende Instanz von AppWrite, um diese Bibliothek zu verwenden. Weitere Anweisungen finden Sie unter https://appwrite.io/docs/installation.
PSUDO -Beispiel
Behandeln Sie mehrere Ebenen von asynchronen relationalen Daten (und deren Laden- und Fallback -Zuständen) vollständig aus dem Sufle -Markup.
<!-- 1. ? Appwrite App -->
< Appwrite {... config }>
<!-- 2. ? Get the current user if logged in -->
< User let:user >
< h1 >Hello { user . name }!</ h1 >
<!-- 3. Get all the documents from a collection -->
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
{ #each documents as document }
<!-- 4. Get a document -->
< Document collectionId = "5f56a3035a01f" documentId ={ document . $id } { document }>
Title: { document . title }
Text: { document . text }
... Muss initialisiert werden und jede metawrite -Komponente einwickeln.
< script >
import { Appwrite } from ' metawrite ' ;
const config = {
endpoint : ' http://localhost/v1 ' ,
project : ' demo ' ,
locale : ' fr '
};
</ script >
< Appwrite {... config }>...</ Appwrite >| Name | Beschreibung |
|---|---|
endpoint | Ihr Appwrite -Endpunkt. @type - {string} |
project | Ihre Projekt -ID. @type - {string} |
locale | Optional Das Benutzergebiet. @type - {string} |
realtime | Optional Set benutzerdefinierter Echtzeitendpunkt. Standardmäßig genauso wie endpoint . @type - {string} |
Registriert ein neues Konto.
< script >
import { Create } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
let name = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< Create let:actions on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "password" bind:value ={ password } />
< input type = "text" bind:value ={ name } />
< button on:click ={ actions . create ( email , password , name )}>Register</ button >
</ Create > Lassen Sie: Aktionen object
Objekt mit Funktion.
| Name | Beschreibung |
|---|---|
create(email, password, name) | Registriert einen neuen Benutzer. @type - {string} |
on: Erfolg
Auslöser für ein erfolgreiches Register.
| Name | Beschreibung |
|---|---|
response | Antwort |
ON: Misserfolg
Auslöser auf fehlgeschlagenem Register.
| Name | Beschreibung |
|---|---|
response | Antwort |
Melden Sie sich per E -Mail und Passwort an.
< script >
import { AuthEmail } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< AuthEmail let:authorize on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "text" bind:value ={ password } />
< button on:click ={ authorize ( email , password )}>Login</ button >
</ AuthEmail > Lassen Sie: function autorisieren
Initiiert Login.
| Name | Beschreibung |
|---|---|
email | E-Mail. @type - {string} |
password | Passwort. @type - {string} |
on: Erfolg
Auslösern für erfolgreiche Anmeldung.
| Name | Beschreibung |
|---|---|
email | E-Mail. @type - {string} |
ON: Misserfolg
Auslöser bei fehlgeschlagenem Login.
| Name | Beschreibung |
|---|---|
error | Fehlerobjekt. |
Melden Sie sich über einen OAuth2 -Anbieter an.
< script >
import { AuthOAuth2 } from ' metawrite ' ;
</ script >
< AuthOAuth2
authProvider = " google "
success = " http://localhost:3000?success "
failure = " http://localhost:3000?failure "
let:authorize
>
< button on:click ={ authorize }>Login Google</ button >
</ AuthOAuth2 >| Name | Beschreibung |
|---|---|
authProvider | OAuth2 -Anbieter. @type - {string} |
success | Erfolgs -URL. @type - {string} |
failure | Fehler -URL. @type - {string} |
Lassen Sie: function autorisieren
Fordert den aktuellen Benutzer an, zu überprüfen, ob angemeldet wird.
< script >
import { User } from ' metawrite ' ;
</ script >
< User let:user >
< h1 >Hello { user . name }!</ h1 >
< div >{ user . email }</ div >
< div slot = " error " >You are not logged in!</ div >
</ User > Lassen Sie: object
Melden Sie sich derzeit in Benutzerdaten an.
Erhalten Sie eine Liste aller Dokumente aus einer Sammlung.
< script >
import { Collection } from ' metawrite ' ;
</ script >
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
</ Collection >| Name | Beschreibung |
|---|---|
collectionId | Sammlung eindeutige ID. @type - {string} |
| zusätzlich | Gleich wie hier |
Lassen Sie: Dokumente array
Auswahl von Dokumenten.
Lassen Sie: Aktionen object
Objekt mit Funktion.
| Name | Beschreibung |
|---|---|
reload() | Neufestkollektion. |
create(data, read, write) | Erstellen Sie ein neues Dokument in der Sammlung. read / write ist standardmäßig optional und der aktuelle Benutzer standardmäßig @type - {string[]} . data sind @type - {string} |
Holen Sie sich ein Dokument. Wenn Sie die document mit Daten ausgeben, werden keine Daten angefordert.
< script >
import { Document } from ' metawrite ' ;
</ script >
< Document documentId = " 5f56a3asda01f " let:document >
Title: { document . title }
Text: { document . text }
</ Document >| Name | Beschreibung |
|---|---|
documentId | Dokument eindeutige ID. @type - {string} |
collectionId | Sammlung eindeutige ID. @type - {string} |
| oder | |
document | Dokument aus <Collection /> bestanden |
Lassen Sie: object
Ein JSON -Objekt mit den Dokumentdaten.
Lassen Sie: Aktionen object
Objekt mit Funktion.
| Name | Beschreibung |
|---|---|
update(data) | Aktualisieren Sie das Dokument. data sind @type - {string} |
remove() | Löscht das Dokument. |
reload() | Dokument neu abrufen. |
ON: Veränderung
Auslöser beim Aktualisieren oder Entfernen von Anmeldungen.
Mit den Kontokomponenten können Sie ein Benutzerkonto verwalten.
<User /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
logout() | Aktuelle Sitzung abmelden. |
logoutAll() | Melden Sie sich von der gesamten Sitzung ab. |
logoutFrom(session) | Abmelden von einer bestimmten Sitzung. session ist @type - {string} |
objectlogout .logout .logoutFrom Erfolg.logoutFrom METTER.logoutAll .logoutAll -Fehler. < script >
import { User } from ' metawrite ' ;
</ script >
< User let:actions let:user >
< button on:click ={ actions . reload ()}>Reload user data</ button >
< button on:click ={ actions . get ()}>Get logged in user data</ button >
< button on:click ={ actions . logout ()}>Log out from current session</ button >
< button on:click ={ actions . logoutFrom ( ' sessionId ' )}>Log out from specific session</ button >
< button on:click ={ actions . logoutAll ()}>Log out from all sessions</ button >
<!-- If logged in -->
< p >Hi, { user . name }</ p >
</ User ><Create /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
create(email, password, name) | Erstellt einen Benutzer. email und password sind erforderlich - @type - {string} . name ist optional - @type - {string} |
create Erfolg.create von Scheitern. < script >
import { Create } from ' metawrite ' ;
let name,
email,
password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< Create let:actions on:success on:failure >
< input type = "text" name = "name" placeholder = "name" bind:value ={ name } />
< input type = "text" name = "email" placeholder = "email" bind:value ={ email } />
< input type = "password" name = "password" placeholder = "password" bind:value ={ password } />
< button on:click ={ actions . create ( name , email , password )}>Create Account</ button >
</ Create ><Preferences /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Laden Sie Einstellungen neu. |
update(prefs) | Aktualisieren Sie Einstellungen. prefs - @type - {object} |
reload Success.reload Failure.update .update MEHRER. < script >
import { Preferences } from ' metawrite ' ;
let prefs = {
// You can pass only the specific settings you wish to update.
};
</ script >
< Preferences let:actions >
< button
on:click ={() => {
actions . update ( prefs );
actions . reload ();
}}>Update Preferences</ button
>
</ Preferences ><RecoverPassword /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
recover(email, url) | Passwort wiederherstellen. email und url sind erforderlich und @type - {string} . url ist Ihre Seite, auf der Sie mit complete Funktion secret verarbeiten. |
complete(user, secret, password, passwordAgain) | Vollständige Passwortwiederherstellung. user und secret werden automatisch von metawrite festgelegt, sodass Sie sie nicht festlegen müssen. password und passwordAgain sind erforderlich - @type - {string} . |
reload Success.reload Failure.update .update -Fehler. < script >
import { RecoverPassword } from " metawrite " ;
const url = " http://localhost:3000/reset-password " ; // URL that will point to the next step.
let email = ' ' ;
const successRecover = e => {
// success callback
// `e` contains the user object
};
const failureRecover = e => {
// failure callback
}
</ script >
<!-- localhost/forgot-password -->
< RecoverPassword let:actions on:successRecover on:failureRecover >
< input name = "email" type = "text" bind:value ={ email , url } placeholder = " Email " />
< button on:click { actions . recover ( email )}>Recover Password</ button >
</ RecoverPassword >
<!-- Then on localhost/reset-password -->
< script >
import { RecoverPassword } from " metawrite " ;
let password, passwordAgain = ' ' ;
const successComplete = e => {
// success callback
// `e` contains the user object
};
const failureComplete = e => {
// failure callback
}
</ script >
< RecoverPassword let:actions on:successComplete on:failureComplete >
< input type = "password" name = "password" bind:value { password } placeholder = " Password " />
< input type = "password" name = "password" bind:value { passwordAgain } placeholder = " Confirm Password " />
< button on:click { actions . complete ( password , passwordAgain )}>Set New Password</ button >
</ RecoverPassword ><Update /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
name(name) | Name aktualisieren. Alle Felder sind erforderlich. @type - {string} |
email(email, password) | E -Mail aktualisieren. Alle Felder sind erforderlich. @type - {string} |
password(password, oldPassword) | Passwort aktualisieren. Alle Felder sind erforderlich. @type - {string} |
name Success.name MISTERUNG.email -Erfolg.email -Fehler.password Erfolg.password . < script >
import { Update } from ' metawrite ' ;
let name,
email,
password,
newPassword,
oldPassword = ' ' ;
</ script >
< Update let:actions >
< button on:click ={ actions . name ( name )}>This updates name</ button >
< button on:click ={ actions . email ( email , password )}>This updates email</ button >
< button on:click ={ actions . password ( newPassword , oldPassword )}>This updates password</ button >
</ Update ><Verification />Erstellt und validiert automatisch Benutzer -E -Mail -Überprüfung.
url of Type String for Action create sollte dort sein, wo Ihre App gehostet wird oder localhost .update , die Sie nicht übergeben müssen, ist der Vorgang automatisiert. Lass: Handlungen
| Name | Beschreibung |
|---|---|
create(url) | Überprüfung erstellen. url ist das, was URL verwendet hat, um einen an Ihren E -Mail -Posteingang gesendeten Überprüfungs -Link zu erstellen. @type - {string} |
update(user, secret) | Vollständige Überprüfung. user und secret werden automatisch von metawrite festgelegt. |
create ON CAREMENT ERFOLGEN.create -Misserfolg.complete Erfolg.complete Ausfälle. < script >
import { Verification } from ' metawrite ' ;
const url = window . location . href ;
</ script >
< Verification let:actions >
< button on:click ={ actions . create ( url )} />
< button on:click ={ actions . update ()}>Update email verification status</ button >
</ Verification >Mit den Auth -Komponenten können Sie ein Benutzerkonto authentifizieren.
<AuthEmail /> authorize des Erfolgs.authorize des Scheiterns. < script >
import { AuthEmail } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< AuthEmail let:authorize on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "text" bind:value ={ password } />
< button on:click ={ authorize ( email , password )}>Login</ button >
</ AuthEmail ><AuthOAuth2 /> | Name | Beschreibung |
|---|---|
authProvider | OAuth2 -Anbieter. @type - {string} |
success | Erfolgs -URL. @type - {string} |
failure | Fehler -URL. @type - {string} |
| #### Richtlinien |
lass: autorize ()
< script >
import { AuthOAuth2 } from ' metawrite ' ;
</ script >
< AuthOAuth2
authProvider = " google "
success = " http://localhost:3000?success "
failure = " http://localhost:3000?failure "
let:authorize
>
< button on:click ={ authorize }>Login Google</ button >
</ AuthOAuth2 ><CreateAnonymousSession /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
create() | Erstellt eine anonyme Sitzung. |
< script >
import { CreateAnonymousSession } from ' metawrite ' ;
</ script >
< CreateAnonymousSession let:actions >
< button on:click ={ actions . create }>Create Anonymous Session</ button >
</ CreateAnonymousSession ><CreateJWT />Erstellt JWT -Token.
Lass: Handlungen
| Name | Beschreibung |
|---|---|
create() | Erstellt JWT -Token. |
< script >
import { CreateJWT } from ' metawrite ' ;
</ script >
< CreateJWT let:actions >
< button on:click ={ actions . create }>Create JWT token</ button >
</ CreateJWT ><MagicURL /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
create(sessionId, email, url) | Erstellt magische URL -Sitzung. E -Mail ist erforderlich, URL soll auf die vollständige string hinweisen, sessionId ist nicht erforderlich |
complete() | Validiert und vervollständigt magische URL -Sitzung. |
< script >
import { MagicURL } from " metawrite " ;
let email = " "
const url = " http://localhost:3000/page-to-complete "
const successCreate = ( e ) => {
console . log (e)
}
const failureCreate = ( e ) => {
console . log (e)
}
const successComplete = ( e ) => {
console . log (e)
}
const failureComplete = ( e ) => {
console . log (e)
}
</ script >
< MagicURL let:actions on:successCreate on:successComplete on:failureCreate on:failureComplete >
< input type = "email" name = "email" placeholder = "Email" bind:value ={ email } />
< button on:click ={ actions . create ( email , url )}>Send login link</ button >
< button on:click ={ actions . complete ()}>Confirm Login</ button >
</ MagicURL >Die Avatar -Komponenten sollen Ihnen helfen, alltägliche Aufgaben im Zusammenhang mit Ihrem App -Bild, Ihren Symbolen und Avataren zu erledigen.
<Browser /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { Browser } from ' metawrite ' ;
</ script >
< Browser code = " firefox " let:src >
< img src ={ String ( src )} alt = " Browser " />
</ Browser ><CreditCard /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { CreditCard } from ' metawrite ' ;
</ script >
< CreditCard code = " amex " let:src >
< img src ={ String ( src )} alt = " card " />
</ CreditCard ><Favicon /> @type - {string} @type - {URL} < script >
import { Favicon } from ' metawrite ' ;
const url = window . location . href ;
</ script >
< Favicon { url } let:src >
< img src ={ String ( src )} alt = " favicon " />
</ Favicon ><Flag /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { Flag } from ' metawrite ' ;
</ script >
< Flag code = " canada " let:src >
< img src ={ String ( src )} alt = " flag " />
</ Flag ><Image /> @type - {string}@type - {number}@type - {number} @type - {URL} < script >
import { Image } from ' metawrite ' ;
let url = ' https://increas.io/ ' ;
let width,
height = 100 ;
</ script >
< Image { url } { width } { height } let:src >
< img src ={ String ( src )} alt = " someImage " />
</ Image ><QR /> @type - {string}@type - {optional}@type - {number}@type - {boolean} @type - {URL} < script >
import { QR } from ' metawrite ' ;
let text = ' https://increas.io/ ' ; // could be any text
let size = 500 ;
let margin = 1 ;
let download = false ;
</ script >
< QR { text } { size } { margin } { download } let:src >
< img src ={ String ( src )} alt = " QR Code " />
</ QR >Mit den Datenbankkomponenten können Sie strukturierte Sammlungen von Dokumenten-, Abfragungs- und Filterlisten von Dokumenten erstellen und einen erweiterten Satz von Lese- und Schreibzugriffsberechtigungen verwalten.
<Collection /> CollectionID - erforderlich @type - {string}
Cache - Optional , standardmäßig auf false @type - {boolean} festgelegt
Abfrage: @type - {object}
Abfragen - optional @type - {string[]}
Limit - Optional @type - {number}
Offset - optional @type - {number}
Cursor - optional @type - {string}
CurSortRection - Optional @type - {string}
ordentattributes - optional @type - {string[]}
ordertypes - optional @type - {string[]}
Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
create(documentId, data, read, write) | Erstellt ein Dokument. data - @type - {string} .read / write ist optional @type - {string[]} .documentId ist optional, standardmäßig generiert eindeutig @type - {string} . |
< script >
import { Collection } from " metawrite " ;
</ script >
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
</ Collection ><Document /> @type - {string}@type - {string} Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
update(data) | Aktualisiert ein Dokument. data - @type - {object} |
remove() | Entfernt ein Dokument. |
< script >
import { Collection , Document } from ' metawrite ' ;
const collectionId = ' 5f56a3035a01f ' ;
</ script >
< Collection { collectionId } let:documents >
You have { documents . length } documents:
{ #each documents as document }
< Document { collectionId } documentId ={ document . $id } let:document let:actions >
Title: { document . title }
Text: { document . text }
< button on:click ={() => { actions . remove ()}}>Delete</ button >
</ Document >
{ /each }
</ Collection >Weitere Informationen zur Verwendung von Echtzeit in AppWrite finden Sie in der Echtzeitdokumentation.
Mit Echtzeit können Sie in Echtzeit alle Ereignisse auf der serverseitigen Seite mit der Abonnement-Methode anhören.
Anstatt neue Daten über HTTP anzufordern, erhält das Abonnement jedes Mal neue Daten, wenn es sich ändert. Jeder angeschlossene Client erhält diese Aktualisierung in Millisekunden über eine WebSocket -Verbindung.
Auf diese Weise können Sie eine interaktive und reaktionsschnelle Benutzererfahrung erstellen, indem Sie in Echtzeit Informationen aus allen Diensten von AppWrite bereitstellen.
string | string[] Lassen Sie: Nutzlast - Die Nutzlast aus dem Abonnement enthält folgende Eigenschaften.
Lass: Handlungen
| Name | Beschreibung |
|---|---|
subscribe() | Abonnieren aller Aktualisierungen im Zusammenhang mit einem oder mehreren Kanälen. |
unsubscribe() | Wenn Sie keine Updates mehr von einem Abonnement erhalten möchten, können Sie sich abmelden, damit Ihre Rückrufe nicht mehr aufgerufen werden. |
< script >
import { Realtime } from ' metawrite ' ;
</ script >
< Realtime channels = " account " let:actions let:payload >
< h1 >{ payload . timestamp }</ h1 >
< button on:click ={ actions . subscribe ()}>Subscribe to Account channel</ button >
< button on:click ={ actions . unsubscribe ()}>Unsubscribe from Account channel</ button >
</ Realtime >Mit den Speicherkomponenten können Sie Ihre Projektdateien verwalten. Sie können alle Ihre Projektdateien hochladen, anzeigen, herunterladen und abfragen.
<Storage /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
create(bucketId, fileId, file, read, write) | Laden Sie eine Datei hoch.fileId ist erforderlich @type - {string} , "unique()" wird zufällige eindeutige ID generieren, aber Sie können benutzerdefinierte verwenden.file ist @type - {File} und erforderlich.read / write ist @type - {string[]} und optional |
< script lang = " ts " >
import { Storage } from " metawrite "
// Required
let bucketId = " default "
let file : File ;
let fileId = " unique() " ; // this will generate random unique id, but you can use custom
// Optional
let read : string [];
let write : string [];
</ script >
< Storage { file } let:actions >
< button on:click ={ actions . create ( bucketId , fileId , file , read , write )}>Upload File</ button >
</ Storage ><FileList /> @type - {string}@type - {string}@type - {number}@type - {number}@type - {string}@type - {string}@type - {string} => Schreiben Sie "ASC" oder "DESC" Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
< script >
import { FileList } from " metawrite "
// Optional
let bucketId = ' default ' ;
let search = ' ' ;
let limit = 10 ;
let offset = 0 ;
let orderType = ' ASC ' ;
</ script >
< FileList { bucketId } { search } { limit } { offset } { orderType } let:actions let:files >
{ #each files as file }
< p >File: { file . name }</ p >
{ /each }
< button on:click ={ actions . reload ()}>Reload</ button >
</ FileList ><File /> @type - {string}@type - {string} Lass: Handlungen
| Name | Beschreibung |
|---|---|
download() | Downloads Datei. |
view() | Holen Sie sich Datei für die Ansicht. |
preview(width, height, quality, background, output) | Datei für die Vorschau abrufen. |
update(read, write) | Aktualisiert eine Datei. |
delete() | Löscht eine Datei. |
< script lang = " ts " >
import { File } from ' metawrite ' ;
// Required
let bucketId : string ;
let fileId : string ;
// OPTIONAL
/** @type {number} */ let width;
/** @type {number} */ let height;
/** @type {string} */ let gravity;
/** @type {number} */ let quality;
/** @type {number} */ let borderWidth;
/** @type {string} */ let borderColor;
/** @type {number} */ let borderRadius;
/** @type {number} */ let opacity;
/** @type {number} */ let rotation;
/** @type {string} */ let background;
/** @type {string} */ let output;
/** @type {string[]} */ let read;
/** @type {string[]} */ let write;
</ script >
< File { bucketId } { fileId } let:actions >
< button on:click ={ actions . download ()}>Download File</ button >
< button on:click ={ actions . view ()}>File View</ button >
< button on:click ={ actions . preview ()}>Preview File</ button >
< button on:click ={ actions . update ( read , write )}>Update File</ button >
< button on:click ={ actions . delete ()}>Delete File</ button >
</ File >Mit dem Funktionsdienst können Sie benutzerdefiniertes Verhalten erstellen, das von unterstützten Appwrite -Systemereignissen oder durch einen vordefinierten Zeitplan ausgelöst werden kann.
Mit AppWrite -Cloud -Funktionen können Sie den Backend -Code automatisch als Antwort auf Ereignisse ausführen, die von AppWrite ausgelöst werden, oder indem Sie ihn in einem vordefinierten Zeitplan einstellen. Ihr Code wird in Ihrer Appwrite -Instanz sicher gespeichert und in einer isolierten Umgebung ausgeführt.
Sie können mehr erfahren, indem Sie das Cloud -Funktions -Tutorial von AppWrite verfolgen.
<Function /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
create(functionId, data) | Erstellt Ausführung. functionId ist erforderlich , data könnten leer sein, weil sie optional sind . @type {string} |
create(functionId, executionId) | Ausführung erhalten. Beide Parameter sind erforderlich. @type {string} |
< script >
import { Function } from ' metawrite ' ;
let functionId = ' someExecution ' ; // required
let newFunctionId = ' ' ;
let data = ' String of custom data to send to function. ' ; // could be empty string because optional
</ script >
< Function { functionId } { data } let:actions let:executions >
{ #each executions as execution }
< p >
Execution ID: { execution . $id }, Function ID: { execution . functionId }, Date Created: { execution . dateCreated }
</ p >
{ /each }
< input type = "text" name = "functionId" placeholder = "Function ID" bind:value ={ newFunctionId } />
< button on:click ={ actions . create ( newFunctionId , data )}>Create Execution</ button >
</ Function >Mit den Gebietskomponenten können Sie Ihre App basierend auf dem Standort Ihrer Benutzer anpassen.
<Continents /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
< script >
import { Continents } from ' metawrite ' ;
</ script >
< Continents let:actions let:continents >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { continents . sum } continents:</ p >
{ #each continents . continents as continent }
< p >{ continent . name }, { continent . code }</ p >
{ /each }
</ Continents ><Countries /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
< script >
import { Countries } from ' metawrite ' ;
let eu = true ; // if you want to list only EU countries
</ script >
< Countries let:actions let:countries >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { countries . sum } countries in the world:</ p >
{ #each countries . countries as country }
< p >{ country . name }, { country . code }</ p >
{ /each }
</ Countries >
< Countries { eu } let:actions let:countries >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { countries . sum } countries in EU:</ p >
{ #each countries . countries as country }
< p >{ country . name }, { country . code }</ p >
{ /each }
</ Countries ><Currencies /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
< script >
import { Currencies } from ' metawrite ' ;
</ script >
< Currencies let:actions let:currencies >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { currencies . sum } currencies:</ p >
{ #each currencies . currencies as currency }
< p >{ currency . symbol } - { currency . name } ({ currency . code })</ p >
{ /each }
</ Currencies ><Languages /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
< script >
import { Languages } from ' metawrite ' ;
</ script >
< Languages let:actions let:languages >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { languages . sum } languages:</ p >
{ #each languages . languages as language }
< p >{ language . name }, { language . code }></ p >
{ /each }
</ Languages ><Locale /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
object < script >
import { Locale } from ' metawrite ' ;
</ script >
< Locale let:actions let:code >
< h1 >Active Session</ h1 >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >Location: { code . country }, { code . continentCode }</ p >
< p >IP: { code . ip }</ p >
</ Locale ><PhoneCodes /> Lass: Handlungen
| Name | Beschreibung |
|---|---|
reload() | Neu laden. |
< script >
import { PhoneCodes } from ' metawrite ' ;
</ script >
< PhoneCodes let:actions let:codes >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { codes . sum } phone codes:</ p >
{ #each codes . phones as phone }
< p >{ phone . code } - { phone . countyName }></ p >
{ /each }
</ PhoneCodes >