Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Docs updates #32

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/components/MainFooter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
icon: 'aw-icon-x',
link: 'https://twitter.com/appwrite'
link: 'https://twitter.com/intent/follow?screen_name=appwrite'
},
{
icon: 'aw-icon-linkedin',
Expand Down
32 changes: 32 additions & 0 deletions src/partials/auth-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Authentication events {% #authentication-events %}

| Name | Payload | Description |
|----------------------------------------|------------------------------------|-----------------------------------------------------|
| `teams.*` | [Team Object](/docs/models/team) | This event triggers on any teams event. |
| `teams.*.create` | [Team Object](/docs/models/team) | This event triggers when a team is created. |
| `teams.*.delete` | [Team Object](/docs/models/team) | This event triggers when a team is deleted. |
| `teams.*.memberships.*` | [Membership Object](/docs/models/membership) | This event triggers on any team memberships event. |
| `teams.*.memberships.*.create` | [Membership Object](/docs/models/membership) | This event triggers when a membership is created. |
| `teams.*.memberships.*.delete` | [Membership Object](/docs/models/membership) | This event triggers when a membership is deleted. |
| `teams.*.memberships.*.update` | [Membership Object](/docs/models/membership) | This event triggers when a membership is updated. |
| `teams.*.memberships.*.update.status` | [Membership Object](/docs/models/membership) | This event triggers when a team memberships status is updated. |
| `teams.*.update` | [Team Object](/docs/models/team) | This event triggers when a team is updated. |
| `teams.*.update.prefs` | [Team Object](/docs/models/team) | This event triggers when a team's preferences are updated. |
| `users.*` | [User Object](/docs/models/user) | This event triggers on any user's event. |
| `users.*.create` | [User Object](/docs/models/user) | This event triggers when a user is created. |
| `users.*.delete` | [User Object](/docs/models/user) | This event triggers when a user is deleted. |
| `users.*.recovery.*` | [Token Object](/docs/models/token) | This event triggers on any user's recovery token event. |
| `users.*.recovery.*.create` | [Token Object](/docs/models/token) | This event triggers when a recovery token for a user is created. |
| `users.*.recovery.*.update` | [Token Object](/docs/models/token) | This event triggers when a recovery token for a user is validated. |
| `users.*.sessions.*` | [Session Object](/docs/models/session) | This event triggers on any user's sessions event. |
| `users.*.sessions.*.create` | [Session Object](/docs/models/session) | This event triggers when a session for a user is created. |
| `users.*.sessions.*.delete` | [Session Object](/docs/models/session) | This event triggers when a session for a user is deleted. |
| `users.*.update` | [User Object](/docs/models/user) | This event triggers when a user is updated. |
| `users.*.update.email` | [User Object](/docs/models/user) | This event triggers when a user's email address is updated. |
| `users.*.update.name` | [User Object](/docs/models/user) | This event triggers when a user's name is updated. |
| `users.*.update.password` | [User Object](/docs/models/user) | This event triggers when a user's password is updated. |
| `users.*.update.prefs` | [User Object](/docs/models/user) | This event triggers when a user's preferences is updated. |
| `users.*.update.status` | [User Object](/docs/models/user) | This event triggers when a user's status is updated. |
| `users.*.verification.*` | [Token Object](/docs/models/token) | This event triggers on any user's verification token event. |
| `users.*.verification.*.create` | [Token Object](/docs/models/token) | This event triggers when a verification token for a user is created. |
| `users.*.verification.*.update` | [Token Object](/docs/models/token) | This event triggers when a verification token for a user is validated. |
22 changes: 22 additions & 0 deletions src/partials/databases-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Databases events {% #databases-events %}

| Name | Payload | Description |
| ----------------------------------------- | ------------------------------ | --------------------------------------- |
| `databases.*` | [Database Object](/docs/models/database) | This event triggers on any database event. |
| `databases.*.collections.*` | [Collection Object](/docs/models/collection) | This event triggers on any collection event. |
| `databases.*.collections.*.attributes.*` | [Attribute Object](/docs/models/attribute) | This event triggers on any attributes event. |
| `databases.*.collections.*.attributes.*.create` | [Attribute Object](/docs/models/attribute) | This event triggers when an attribute is created. |
| `databases.*.collections.*.attributes.*.delete` | [Attribute Object](/docs/models/attribute) | This event triggers when an attribute is deleted. |
| `databases.*.collections.*.create` | [Collection Object](/docs/models/collection) | This event triggers when a collection is created. |
| `databases.*.collections.*.delete` | [Collection Object](/docs/models/collection) | This event triggers when a collection is deleted. |
| `databases.*.collections.*.documents.*` | [Document Object](/docs/models/document) | This event triggers on any documents event. |
| `databases.*.collections.*.documents.*.create` | [Document Object](/docs/models/document) | This event triggers when a document is created. |
| `databases.*.collections.*.documents.*.delete` | [Document Object](/docs/models/document) | This event triggers when a document is deleted. |
| `databases.*.collections.*.documents.*.update` | [Document Object](/docs/models/document) | This event triggers when a document is updated. |
| `databases.*.collections.*.indexes.*` | [Index Object](/docs/models/index) | This event triggers on any indexes event. |
| `databases.*.collections.*.indexes.*.create` | [Index Object](/docs/models/index) | This event triggers when an index is created. |
| `databases.*.collections.*.indexes.*.delete` | [Index Object](/docs/models/index) | This event triggers when an index is deleted. |
| `databases.*.collections.*.update` | [Collection Object](/docs/models/collection) | This event triggers when a collection is updated. |
| `databases.*.create` | [Database Object](/docs/models/database) | This event triggers when a database is created. |
| `databases.*.delete` | [Database Object](/docs/models/database) | This event triggers when a database is deleted. |
| `databases.*.update` | [Database Object](/docs/models/database) | This event triggers when a database is updated. |
16 changes: 16 additions & 0 deletions src/partials/functions-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Functions events {% #functions-events %}

| Name | Payload | Description |
| ------------------------------------------- | --------------------------------- | ----------------------------------------- |
| `functions.*` | [Function Object](/docs/models/function) | This event triggers on any functions event. |
| `functions.*.create` | [Function Object](/docs/models/function) | This event triggers when a function is created. |
| `functions.*.delete` | [Function Object](/docs/models/function) | This event triggers when a function is deleted. |
| `functions.*.deployments.*` | [Deployment Object](/docs/models/deployment) | This event triggers on any deployments event. |
| `functions.*.deployments.*.create` | [Deployment Object](/docs/models/deployment) | This event triggers when a deployment is created. |
| `functions.*.deployments.*.delete` | [Deployment Object](/docs/models/deployment) | This event triggers when a deployment is deleted. |
| `functions.*.deployments.*.update` | [Deployment Object](/docs/models/deployment) | This event triggers when a deployment is updated. |
| `functions.*.executions.*` | [Execution Object](/docs/models/execution) | This event triggers on any executions event. |
| `functions.*.executions.*.create` | [Execution Object](/docs/models/execution) | This event triggers when an execution is created. |
| `functions.*.executions.*.delete` | [Execution Object](/docs/models/execution) | This event triggers when an execution is deleted. |
| `functions.*.executions.*.update` | [Execution Object](/docs/models/execution) | This event triggers when an execution is updated. |
| `functions.*.update` | [Function Object](/docs/models/function) | This event triggers when a function is updated. |
12 changes: 12 additions & 0 deletions src/partials/storage-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Storage events {% ##storage-events %}

| Name | Payload | Description |
|---------------------------------|-------------------------------------------------|----------------------------------------------|
| `buckets.*` | [Bucket Object](/docs/models/bucket) | This event triggers on any buckets event. |
| `buckets.*.create` | [Bucket Object](/docs/models/bucket) | This event triggers when a bucket is created.|
| `buckets.*.delete` | [Bucket Object](/docs/models/bucket) | This event triggers when a bucket is deleted.|
| `buckets.*.files.*` | [File Object](/docs/models/file) | This event triggers on any files event. |
| `buckets.*.files.*.create` | [File Object](/docs/models/file) | This event triggers when a file is created. |
| `buckets.*.files.*.delete` | [File Object](/docs/models/file) | This event triggers when a file is deleted. |
| `buckets.*.files.*.update` | [File Object](/docs/models/file) | This event triggers when a file is updated. |
| `buckets.*.update` | [Bucket Object](/docs/models/bucket) | This event triggers when a bucket is updated.|
4 changes: 2 additions & 2 deletions src/routes/docs/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
items: [
{
label: 'Command Line',
href: '/docs/tooling/command-line',
href: '/docs/tooling/command-line/installation',
icon: 'icon-terminal'
},
{
Expand Down Expand Up @@ -106,7 +106,7 @@
},
{
label: 'Self-hosting',
href: '/docs/advanced/self-hosting',
href: '/docs/advanced/self-hosting/installation',
icon: 'icon-server'
}
]
Expand Down
11 changes: 9 additions & 2 deletions src/routes/docs/advanced/platform/events/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ You can subscribe to events for specific resources using their ID or subscribe t
You can also filter for events of specific actions like create, update, or delete.
You can find a list of events for Storage, Databases, Functions, and Authentication services below.

[TODO: Need to add events here.]

{% partial file="auth-events.md" /%}

## Known limitations
{% partial file="databases-events.md" /%}

{% partial file="storage-events.md" /%}

{% partial file="functions-events.md" /%}


## Known limitations {% known-limitations %}

When events fire, only existing subscriptions for that event will receive the update. If your client or server side integrations lose network connection temporarily, delivery of the event is not guaranteed.

Expand Down
60 changes: 59 additions & 1 deletion src/routes/docs/advanced/platform/webhooks/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,62 @@ title: Webhooks
description: Placeholder SEO.
---

temp
Certainly! Below is the content converted to Markdown format:

```markdown
```php
<?php

$events = $this->getParam('events', []);

?>
```

Webhooks allow you to build or set up integrations which subscribe to certain events on Appwrite. When one of those events is triggered, we'll send an HTTP POST payload to the webhook's configured URL. Webhooks can be used to purge cache from CDN, calculate data or send a Slack notification. You're only limited by your imagination.

## Add your webhook {% #addWebhook %}

You can set your webhook by adding it from your Appwrite project dashboard. You can access your webhooks settings from your project dashboard or on the left navigation panel. Click the 'Add Webhook' button and choose your webhook name and the events that should trigger it. You can also set an optional basic HTTP authentication username and password to protect your endpoint from unauthorized access.

## Payload {% #payload %}

Each event type has a specific payload format with the relevant event information. All event payloads mirror the payloads for the API payload which parallel to the [event types](/docs/events).

## Headers {% #headers %}

HTTP requests made to your webhook's configured URL endpoint will contain several special headers.

| Header | Description |
|--------|-------------|
| X-Appwrite-Webhook-Id | The ID of the Webhook who triggered the event. |
| X-Appwrite-Webhook-Events | Names of the events that triggered this delivery. |
| X-Appwrite-Webhook-Name | Name of the webhook as specified in your app settings and [events list](/docs/events). |
| X-Appwrite-Webhook-User-Id | The user ID of the user who triggered the event. Returns an empty string if an API key triggered the event. Note that events like `account.create` or `account.sessions.create` are performed by guest users and will not return any user ID. If you still need the user ID for these events, you can find it in the event payload. |
| X-Appwrite-Webhook-Project-Id | The ID of the project who owns the Webhook and API call. |
| X-Appwrite-Webhook-Signature | The HMAC-SHA1 signature of the payload. This is used to verify the authenticity of the payload. |
| User-Agent | Each request made by Appwrite will be 'Appwrite-Server'. |

## Verification {% #verification %}

Webhooks can be verified by using the [X-Appwrite-Webhook-Signature](/docs/webhooks#headers) header.
This is the HMAC-SHA1 signature of the payload. You can find the signature key in your webhooks properties in the dashboard.
To generate this hash you append the payload to the end of webhook URL (make sure there are no spaces in between) and then use the HMAC-SHA1 algorithm to generate the signature.
After you've generated the signature, compare it to the `X-Appwrite-Webhook-Signature` header value.
If they match, the payload is valid and you can trust it came from your Appwrite instance.


## Events {% events %}

Appwrite has events that fire when a resource changes.
These events cover all Appwrite resources and can reflect create, update, and delete actions.
You can specify one or many events to subscribe to with webhooks.

{% partial file="auth-events.md" /%}

{% partial file="databases-events.md" /%}

{% partial file="storage-events.md" /%}

{% partial file="functions-events.md" /%}

[Learn more about events](/docs/platform/api-keys)
6 changes: 3 additions & 3 deletions src/routes/docs/advanced/self-hosting/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
href: '/docs/advanced/self-hosting/update'
},
{
label: 'Debug',
label: 'Debugging',
href: '/docs/advanced/self-hosting/debug'
},
{
label: 'E-Mail',
label: 'Email delivery',
href: '/docs/advanced/self-hosting/email'
},
{
Expand All @@ -45,7 +45,7 @@
href: '/docs/advanced/self-hosting/production'
},
{
label: 'SMS',
label: 'SMS delivery',
href: '/docs/advanced/self-hosting/sms'
},
{
Expand Down
8 changes: 3 additions & 5 deletions src/routes/docs/products/databases/documents/+page.markdoc
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
layout: article
title: Document
title: Documents
description: This is the description used for SEO.
difficulty: beginner
readtime: 10
---
Each piece of data or information in Appwrite Databases is a document.
Documents have a structure defined by the parent collection.

## Create documents {% #create %}
## Create documents {% #create-documents %}
{% info title="Permissions required" %}
You must grant **create** permissions to users at the **collection level** before users can create documents.
[Learn more about permissions](#permissions)
Expand Down Expand Up @@ -130,7 +128,7 @@ mutation {
During testing, you might prefer to create documents in the Appwrite Console.
To do so, navigate to the **Documents** tab of your collection and click the **Add document** button.

## Retrieving documents {% #retrieve %}
## List documents {% #list-documents %}

{% info title="Permissions required" %}
You must grant **read** permissions to users at the **collection level** before users can read documents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ The response should look similar to this.

{% /section %}

{% section #query-documents step=4 title="Retrieve documents" %}
{% section #list-documents step=4 title="List documents" %}
To read and query data from your collection, use the `listDocuments` endpoint.

Like the previous step, replace `<PROJECT_ID>`, `<DATABASE_ID>`, and`<COLLECTION_ID>` with their respective IDs.
Expand Down
Loading