Skip to content

Commit 8132e50

Browse files
committed
Added new docs
1 parent 65be1ff commit 8132e50

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributing
2+
3+
We would ❤️ for you to contribute to Appwrite and help make it better! As a contributor, here are the guidelines we would like you to follow:
4+
5+
## Code of Conduct
6+
7+
Help us keep Appwrite open and inclusive. Please read and follow our [Code of Conduct](/CODE_OF_CONDUCT.md).
8+
9+
## Creating Language Class
10+
11+
First, create a new class for the new language in this directory:�https://github.com/appwrite/sdk-generator/tree/master/src/SDK/Language
12+
13+
You can use the interface to know which methods are required and needs to be implemented:
14+
https://github.com/appwrite/sdk-generator/blob/master/src/SDK/Language.php
15+
16+
**getName**
17+
SDK Language name (JS, PHP…)
18+
19+
**getKeywords**
20+
An array with language keywords to avoid using as param or function names, template engine will solve conflicts
21+
22+
**getFiles**
23+
An array with a list of language template files in [twig format](https://twig.symfony.com/).
24+
Each file scope determines what template parameters will be available.
25+
26+
* default scope - Basic SDK and language-specific params (package name, language name, etc…)
27+
* service scope - Generate x templates where x is the number of API services, adds service-specific params to the template (service name, methods, etc…)
28+
* method scope - Generate x*y templates where x is the number of API services and y is the number of methods, adds service and method-specific params to the template (service name, method name, method params, etc…), good for generating MD files with examples for using each method
29+
30+
**getTypeName**
31+
This method receives the API param type and should return the equivalent param in the implemented language.
32+
33+
**getParamDefault**
34+
This method receives the API param and should return the equivalent default value of param in the implemented language, for example, a default array param in PHP is represented as [].
35+
36+
**getParamExample**
37+
This method receives the API param and should return the equivalent example value of param in the implemented language, for example, if an example value is **some text** in PHP return value should be **'some text'** (with quotes).
38+
39+
Notice: The easiest way to get started is to copy an existing language class close to the new language about to be implemented and just edit it.
40+
41+
## Adding Templates
42+
43+
Add your new templates as listed in your language class **getFiles** method. Make sure to follow the [checklist](https://github.com/appwrite/sdk-generator#sdk-checklist) when building the language templates.
44+
45+
Make sure to follow the objects structure and service separation architecture. We aim to keep developer experience as consisted as possible across different SDKs to make the learning curve as small as possible.
46+
47+
When in need to test the API templates output, add your new language instance to the example.php file like this:
48+
49+
sdk-generator/blob/master/example.php:
50+
51+
```php
52+
use Appwrite\Spec\Swagger2;
53+
use Appwrite\SDK\SDK;
54+
use Appwrite\SDK\Language\NewLang;
55+
56+
// NewLang
57+
$sdk = new SDK(new NewLang(), new Swagger2($spec));
58+
$sdk
59+
->setLogo('https://appwrite.io/v1/images/console.png')
60+
->setLicenseContent('test test test')
61+
->setWarning('**WORK IN PROGRESS - NOT READY FOR USAGE**')
62+
;
63+
$sdk->generate(__DIR__ . '/examples/new-lang');
64+
```
65+
66+
Run the following command:
67+
68+
```bash
69+
php example.php
70+
```
71+
72+
>Note: Make sure to have PHP CLI installed on your host.
73+
74+
Check your output files at: /examples/new-lang and make sure the SDK works. When possible add some unit tests.

0 commit comments

Comments
 (0)