Skip to content

Commit

Permalink
fix file input and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Mar 4, 2022
1 parent 879dd29 commit 7733a1f
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.1
* Fix InputFile filename param
* Fix examples

## 4.0.0
* Support for Appwrite 0.13
* **BREAKING** **Tags** have been renamed to **Deployments**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
dart_appwrite: ^4.0.0
dart_appwrite: ^4.0.1
```
You can install packages from the command line:
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/functions/create-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void main() { // Init SDK
Future result = functions.createDeployment(
functionId: '[FUNCTION_ID]',
entrypoint: '[ENTRYPOINT]',
code: await MultipartFile.fromPath('code', './path-to-files/image.jpg', 'image.jpg'),
code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'),
activate: false,
);

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/storage/create-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() { // Init SDK
Future result = storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]',
file: await MultipartFile.fromPath('file', './path-to-files/image.jpg', 'image.jpg'),
file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'),
);

result
Expand Down
1 change: 1 addition & 0 deletions lib/services/account.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
part of dart_appwrite;

/// The Account service allows you to authenticate and manage a user account.
class Account extends Service {
Account(Client client): super(client);

Expand Down
2 changes: 2 additions & 0 deletions lib/services/avatars.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
part of dart_appwrite;

/// The Avatars service aims to help you complete everyday tasks related to
/// your app image, icons, and avatars.
class Avatars extends Service {
Avatars(Client client): super(client);

Expand Down
2 changes: 2 additions & 0 deletions lib/services/database.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
part of dart_appwrite;

/// The Database service allows you to create structured collections of
/// documents, query and filter lists of documents
class Database extends Service {
Database(Client client): super(client);

Expand Down
2 changes: 2 additions & 0 deletions lib/services/functions.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
part of dart_appwrite;

/// The Functions Service allows you view, create and manage your Cloud
/// Functions.
class Functions extends Service {
Functions(Client client): super(client);

Expand Down
2 changes: 2 additions & 0 deletions lib/services/health.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
part of dart_appwrite;

/// The Health service allows you to both validate and monitor your Appwrite
/// server's health.
class Health extends Service {
Health(Client client): super(client);

Expand Down
2 changes: 2 additions & 0 deletions lib/services/locale.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
part of dart_appwrite;

/// The Locale service allows you to customize your app based on your users'
/// location.
class Locale extends Service {
Locale(Client client): super(client);

Expand Down
1 change: 1 addition & 0 deletions lib/services/storage.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
part of dart_appwrite;

/// The Storage service allows you to manage your project files.
class Storage extends Service {
Storage(Client client): super(client);

Expand Down
2 changes: 2 additions & 0 deletions lib/services/teams.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
part of dart_appwrite;

/// The Teams service allows you to group users of your project and to enable
/// them to share read and write access to your project resources
class Teams extends Service {
Teams(Client client): super(client);

Expand Down
1 change: 1 addition & 0 deletions lib/services/users.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
part of dart_appwrite;

/// The Users service allows you to manage your project users.
class Users extends Service {
Users(Client client): super(client);

Expand Down
4 changes: 2 additions & 2 deletions lib/src/chunked_upload_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Future<Response> chunkedUpload({

late Response res;
if (size <= Client.CHUNK_SIZE) {
params[paramName] = await http.MultipartFile.fromPath(paramName, file.path!, filename: file.fileName);
params[paramName] = await http.MultipartFile.fromPath(paramName, file.path!, filename: file.filename);
return client.call(
HttpMethod.post,
path: path,
Expand Down Expand Up @@ -55,7 +55,7 @@ Future<Response> chunkedUpload({
raf.setPositionSync(offset);
final chunk = raf.readSync(Client.CHUNK_SIZE);
params[paramName] =
http.MultipartFile.fromBytes(paramName, chunk, filename: file.fileName);
http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename);
headers['content-range'] =
'bytes $offset-${min<int>(((offset + Client.CHUNK_SIZE) - 1), size)}/$size';
res = await client.call(HttpMethod.post,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
_httpClient = BrowserClient();
_headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:dart:4.0.0',
'x-sdk-version': 'appwrite:dart:4.0.1',
'X-Appwrite-Response-Format' : '0.13.0',
};

Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ClientIO extends ClientBase with ClientMixin {
_endPoint = endPoint;
_headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:dart:4.0.0',
'x-sdk-version': 'appwrite:dart:4.0.1',
'X-Appwrite-Response-Format' : '0.13.0',
};

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dart_appwrite
version: 4.0.0
version: 4.0.1
description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-dart
Expand Down

0 comments on commit 7733a1f

Please sign in to comment.