Updated SDK docs

This commit is contained in:
Eldad Fux
2020-04-12 09:15:33 +03:00
parent a4068e4771
commit ea5e080809
13 changed files with 119 additions and 11 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ return [
[
'key' => 'dart',
'name' => 'Dart',
'version' => '0.0.14',
'version' => '0.1.0',
'url' => 'https://github.com/appwrite/sdk-for-dart',
'enabled' => true,
'beta' => true,
+1 -1
View File
@@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file:
```yml
dependencies:
appwrite: ^0.0.14
appwrite: ^0.1.0
```
You can install packages from the command line:
+55
View File
@@ -0,0 +1,55 @@
# Examples
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned()
;
```
Create a new user and session:
```dart
Account account = Account(client);
Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name');
Response session = await account.createSession(email: 'me@appwrite.io', password: 'password');
```
Fetch user profile:
```dart
Account account = Account(client);
Response profile = await account.get();
```
Upload File:
```dart
Storage storage = Storage(client);
MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg');
storage.createFile(
file: file,
read: ['*'],
write: []
)
.then((response) {
print(response); // File uploaded!
})
.catchError((error) {
print(error.response);
});
```
All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs)
+1 -1
View File
@@ -30,7 +30,7 @@ class Client {
this.headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:dart:0.0.14',
'x-sdk-version': 'appwrite:dart:0.1.0',
};
this.config = {};
@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
@@ -1,5 +1,4 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
+1 -1
View File
@@ -1,5 +1,5 @@
name: appwrite
version: 0.0.14
version: 0.1.0
description: Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-dart
+3
View File
@@ -61,6 +61,8 @@ $cli
$target = realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/';
$readme = realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/README.md');
$readme = ($readme) ? file_get_contents($readme) : '';
$examples = realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/EXAMPLES.md');
$examples = ($examples) ? file_get_contents($examples) : '';
$changelog = realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/CHANGELOG.md');
$changelog = ($changelog) ? file_get_contents($changelog) : '# Change Log';
$warning = ($language['beta']) ? '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check previous releases.**' : '';
@@ -156,6 +158,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
->setWarning($warning)
->setReadme($readme)
->setChangelog($changelog)
->setExamples($examples)
;
try {
Generated
+2 -2
View File
@@ -1622,7 +1622,7 @@
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator",
"reference": "f402438390464b371595fdc2372d6fde1ccf855a"
"reference": "9bccab4d66c3f90b759ed5fe3e346be33de70245"
},
"require": {
"ext-curl": "*",
@@ -1652,7 +1652,7 @@
}
],
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"time": "2020-04-11T16:34:07+00:00"
"time": "2020-04-12T06:12:36+00:00"
},
{
"name": "doctrine/instantiator",
+55
View File
@@ -0,0 +1,55 @@
# Examples
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user and session:
```dart
Account account = Account(client);
Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name');
Response session = await account.createSession(email: 'me@appwrite.io', password: 'password');
```
Fetch user profile:
```dart
Account account = Account(client);
Response profile = await account.get();
```
Upload File:
```dart
Storage storage = Storage(client);
MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg');
storage.createFile(
file: file,
read: ['*'],
write: []
)
.then((response) {
print(response); // File uploaded!
})
.catchError((error) {
print(error.response);
});
```
All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs)