Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Refactor functions docs #433

Merged
merged 17 commits into from
Apr 4, 2024
Merged

Refactor functions docs #433

merged 17 commits into from
Apr 4, 2024

Conversation

gewenyu99
Copy link
Contributor

What does this PR do?

Refactor some of function docs, so they're easier to digest

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Copy link

render bot commented Dec 19, 2023

Copy link

vercel bot commented Dec 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
website ❌ Failed (Inspect) Dec 22, 2023 5:37am

Copy link

render bot commented Jan 24, 2024

@gewenyu99 gewenyu99 marked this pull request as ready for review January 29, 2024 03:15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logs background here looks like a bug. I'm pretty sure it should be dark.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it to an issue. It is

{% cards_item href="/docs/products/functions/execution" title="Execute" %}
Appwrite Functions can be executed in a variety of ways, like SDK, domains, schedules, events, and more. Learn about executions.
{% /cards_item %}
{% cards_item href="/docs/products/functions/execution#domains" title="Domains" %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2024-02-02 at 13 45 50@2x

I tried and most of the links don't work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I broke all these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

description: Learn what an Appwrite Function can do for you and how to create a new Appwrite Function
---

Each Appwrite Function is a piece of user defined code that can be executed on demand.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldnt call it user-defined. either deveoper-defined, or defined by you.
User-defined sounds like end user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Each Appwrite Function is a piece of user defined code that can be executed on demand.
When you create a new Appwrite Function, you select a name, ID, and [runtime language](/docs/products/functions/runtimes).

Each time a function changes, a [deployment](/docs/products/functions/deployments) is created, which is like a version of a function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each time a function changes, a [deployment](/docs/products/functions/deployments) is created, which is like a version of a function.
Each time a function's code changes, a [deployment](/docs/products/functions/deployments) is created, which is like a version of a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

{% /tabsitem %}

{% tabsitem #cli title="CLI" %}
You can create functions using the CLI, without needing to access the console.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can create functions using the CLI, without needing to access the console.
You can create functions using the CLI, without needing to access the Console.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

{% /tabsitem %}
{% /tabs %}

After creating your function, create a [deployment](/docs/products/functions/deployments) to add code to the function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all tabs it also explains how to make first deployment. I don't think we need this sentence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{% tabsitem #manual title="Manual" %}
You can also create Appwrite Functions manually by uploading your code in a zipped file.
In the **Create Function** modal, click **create a function manually** at the bottom to switch to manual create wizard.
You will asked to upload a zip file with your code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You will asked to upload a zip file with your code.
You will be asked to upload a zip file with your code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

└── index.js
```

Package your code files into the `.tar.gz` format. **Don't include your dependencies folder**, such as **node_modules**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Package your code files into the `.tar.gz` format. **Don't include your dependencies folder**, such as **node_modules**.
Package your code files into the `.tar.gz` format. **Don't include your dependencies folder**, such as node_modules.

Too much boldness, this makes it better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

1. In the Appwrite Console's sidebar, click **Functions**.
2. Click **Create function**.
3. Connect your project to a Git repository. Your functions will build and deploy when the repository receives a push.
4. If you already have a repository containing an Appwrite Function, connect to it under **Connect Git repository**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
4. If you already have a repository containing an Appwrite Function, connect to it under **Connect Git repository**.
4. If you already have a repository containing an Appwrite Function, select it under **Connect Git repository**.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

This lets you track your code using Git, which makes it easy to integrate Appwrite Functions into your existing code base.
1. In the Appwrite Console's sidebar, click **Functions**.
2. Click **Create function**.
3. Connect your project to a Git repository. Your functions will build and deploy when the repository receives a push.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Connect your project to a Git repository. Your functions will build and deploy when the repository receives a push.
3. Connect your project to your Git provider. You will be asked to authorize Appwrite and grant access to some resources necessary for the Git deployments to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 106 to 107
When you update a function's runtime, the code of your function may not be compatible with the new runtime.
Remember to update your code and redeploy your function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When you update a function's runtime, the code of your function may not be compatible with the new runtime.
Remember to update your code and redeploy your function.
When you update a function's runtime, you may need to update code of your function to make it compatible with the new runtime.

Above we already have big alert box teiing to redeploy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to add something to the Request section here noting that req.body will contain the object of the event that invoked it, like for buckets.*.files.*.create it'll contain the file that triggered that event

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -464,7 +464,7 @@ You'll be able to mock executions by configuring the path, method, headers, and
{% /only_light %}


## Events {% #events %}
# Events {% #events %}

Changes in Appwrite emit events. You can configure Functions to be executed in response to these events.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here for the events section, we should explain that the event trigger can be found in x-appwrite-event header and the body will contain the data of the resource that triggered it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@PineappleIOnic PineappleIOnic self-requested a review February 29, 2024 11:39
*
This event triggers when a verification token for a user is validated.
Returns [Token Object](/docs/references/cloud/models/token)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure we have the 1.5 events

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oi, review this: appwrite/appwrite#7744

2. Appwrite passes in request information like headers, body or path through the `context.req` object.
3. The runtime executes the code you defined, you can log through the `context.log()` or `context.error()` methods.
4. Function terminates when you return results using `return context.res.send()`, `return context.res.json()` or similar.
1. The active [deployment](/docs/products/functions/deploy)'s executor will handle the request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps are all 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes markdown renders them as 1.2.3.4 ;) This in fact works


# Generated domains {% #generated-domains %}

1. In the Appwrite Console's sidebar, click **Functions**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps are all 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes markdown renders them as 1.2.3.4 ;) This in fact works

1. In the Appwrite Console's sidebar, click **Functions**.
1. Under the **Domains** tab, you'll find the generated domain from Appwrite and your custom domains.
1. Under **Execute access**, set the access to `Any` so that anyone can execute the function. You will use [JWTs](/docs/products/auth/jwt) to authenticate users.
1. Under the **Domains** tab, you'll find the generated domain from Appwrite and your custom domains. [Learn about adding a custom domain](/docs/products/functions/domains).
Copy link
Contributor

@PineappleIOnic PineappleIOnic Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps all both 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes markdown renders them as 1.2.3.4 ;) This in fact works

---
layout: article
title: Templates
description: Learn about Appwrite Functions' templates that let you jump start function development to extend your Appwrite APIs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the ' in this description cause problems with the parser? I vaguely remember an issue like this, please check it doesn't result in a server error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check :)

Copy link
Contributor

@PineappleIOnic PineappleIOnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small issues here and there

@gewenyu99 gewenyu99 changed the title Refactor some of function docs, so they're easier to digest Refactor functions docs Mar 13, 2024
Vincent (Wen Yu) Ge and others added 2 commits April 1, 2024 21:42
@gewenyu99 gewenyu99 requested a review from loks0n April 2, 2024 14:24
@gewenyu99 gewenyu99 merged commit b0b2efa into main Apr 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants