tp_appwrite version: 10.0.10

Published 2024-03-27

n/a

sdk | dart flutter
repository | svn
platform | n/a
status | deprecated
  • Readme
  • Changelog
  • Versions

tp_appwrite

Fork of merged appwrite and dart_appwrite projects.

Done

  • project appwrite merged into dart_appwrite, resulting in project tp_appwrite.
  • just added missing files and methods, nothing special.
  • Client now has setKey (optional api key):
  • without you must login as a user and you cannot use some calls,
  • when given, you cannot login on that Client but you have capability to call admin stuff.
  • added isAdminClient that returns true when an api key was given.
  • when in admin mode, no cookies are handled otherwise session cookies will interfere resultin in privilege exceptions.

Why?

Now we have a single source for our models: tp_appwrite::User and not appwrite::User and dart_appwrite::User.

What was tried before?

  • used both appwrite and dart_appwrite in a single project: data models are from different sources, causing confusion and constant prefixing them.
  • used swagger service definition to generate classes: succeeded in generating an api, but did not have a proper client that was capable of websockets (rest only), and no difference between browser and desktop http-client.

Limitations

  • When adding admin pages, you still have to have two Client instances.
    • one without api key (logged in user)
    • one with api key (admin stuff)
  • If your app does not have admin pages, just do not provide a Client with an api key (setKey) (for security reasons). And if you do, check if there is an active user session with proper privileges.

Best practices?

  • Use a get_it scope to hide the admin Client instance from userland?
  • admin stuff in separate app from public app?
  • maybe create a customer application and a separate admin app (per-customer application)?
  • maybe create an admin app just like the appwrite home-page, but with our specialized customizations?
  • maybe check in the admin app if the user has proper rights/groups attached to access the app?

Notes

  • Storage::listBuckets is an admin function, while Storage::listFiles is not.
  • How do you get the storageId as a non-admin user from a Bucket without know id?

Appwrite Dart SDK

pub package License Version Build Status Twitter Account Discord

This SDK is compatible with Appwrite server version 0.15.x. For older versions, please check previous releases.

This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check appwrite/sdk-for-flutter

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. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Dart SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs

Appwrite

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  dart_appwrite: ^6.0.0

You can install packages from the command line:

pub get dart_appwrite

Getting Started

Initialize & Make API Request

Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example:

import 'package:dart_appwrite/dart_appwrite.dart';

void main() async {
  Client client = Client()
    .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible
    .setProject('5ff3379a01d25') // Your project ID
    .setKey('cd868c7af8bdc893b4...93b7535db89')
    .setSelfSigned(); // Use only on dev mode with a self-signed SSL cert

  Users users = Users(client);

  try {
    final response = await users.create(userId: '[USER_ID]', email: ‘email@example.com’,password: ‘password’, name: ‘name’);
    print(response.data);
  } on AppwriteException catch(e) {
    print(e.message);
  }
}

Error handling

The Appwrite Dart SDK raises AppwriteException object with message, code and response properties. You can handle any errors by catching AppwriteException and present the message to the user or handle it yourself based on the provided error information. Below is an example.

Users users = Users(client);

try {
  final response = await users.create(userId: '[USER_ID]', email: ‘email@example.com’,password: ‘password’, name: ‘name’);
  print(response.data);
} on AppwriteException catch(e) {
  //show message to user or do other operation based on error as required
  print(e.message);
}

Learn more

You can use the following resources to learn more and get help

Contribution

This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.

License

Please see the BSD-3-Clause license file for more information.

Changelog

10.0.10 - 2024-03-27

Changed

  • Version bump from 10.0.9 to 10.0.10 (Deprecated this package).

10.0.9 - 2023-02-09

Changed

  • Version bump from 10.0.8 to 10.0.9 (Version confusion after compiler bug chaos).

10.0.8 - 2023-01-31

Changed

  • Version bump from 10.0.7 to 10.0.8.

10.0.7 - 2023-01-31

Changed

  • Version bump from 10.0.6 to 10.0.7.

10.0.6 - 2022-12-22

Changed

  • Version bump from 10.0.5 to 10.0.6.

10.0.5 - 2022-12-22

Changed

  • Version bump from 10.0.4 to 10.0.5 (Recompile due to installer optimizations).

10.0.4 - 2022-10-11

Changed

  • Version bump from 10.0.3 to 10.0.4 (Recompile due to wrong GetIt.instance syntax.).

10.0.3 - 2022-10-05

Changed

  • Version bump from 10.0.2 to 10.0.3 (fixed pdflib searchpath macos crash).

10.0.2 - 2022-10-01

Changed

  • Version bump from 10.0.1 to 10.0.2 (pkg_pdflib bundle macos dylib).

10.0.1 - 2022-09-29

Changed

  • Version bump from 10.0.0 to 10.0.1 (dependencies upgraded).

10.0.0 - 2022-08-15

0.1.0

  • First release

0.2.0

  • Upgraded to work with Appwrite 0.7

0.3.0

  • Improved code quality
  • Added a custom Appwrite exception
  • Enabled access to private storage file

0.3.1

  • Minor fixes for custom exceptions

0.5.0-dev.1

  • Upgraded to Null-safety, minimum Dart SDK required 2.12.0
  • Upgraded all underlying dependencies to null safe version

0.6.0

  • Upgraded to Null-safety, minimum Dart SDK required 2.12.0
  • Upgraded all underlying dependencies to null safe version
  • BREAKING Renamed users.deleteUser to users.delete
  • BREAKING Renamed parameter inviteId to membershipId on teams.updateMembershipStatus, teams.deleteMembership
  • JWT Support client.setJWT('JWT_GENERATED_IN_CLIENT')
  • Update membership roles
  • New awesome image preview features, supports borderRadius, borderColor, borderWidth

0.6.1

  • Fix for image preview param types

0.6.2

  • Removed default values, nothing should change in usage as default values are already allocated in server

0.7.0

  • Support for Appwrite 0.9
  • Breaking - removed order type enum, now you should pass string 'ASC' or 'DESC'
  • Breaking - changed param name from env to runtime in the Functions API
  • Image Crop Gravity support in image preview service
  • New endpoint in Account getSession to get session by ID
  • New endpoint in the Users API to update user verification status
  • Fix - issues with User-Agent when app name consisted of non-ASCII characters

1.0.0

  • Support for Appwrite 0.10
  • Refactored for better cross platform support
  • Exception implements toString() to get proper error message for unhandled exceptions
  • Breaking - Signature for MultipartFile has changed as we have dropped Dio in favor of http package. Here is the new signature for MultipartFile
  • Breaking - Signature for Response has changed, now it only exposes the data.

1.0.1

  • Export, separate IO and Browser clients for Flutter (Client and Realtime as well) and Dart (Client)

1.0.2

  • Support for Appwrite 0.11

2.0.0

  • BREAKING All services and methods now return structured response objects instead of Response object

3.0.0

  • Support for Appwrite 0.12
  • BREAKING Updated database service to adapt 0.12 API
  • BREAKING Custom ID support while creating resources
  • View all the changes

3.0.1

  • Export Query Builder

3.0.2

  • String Attribute Type got fixed

4.0.0

  • Support for Appwrite 0.13
  • BREAKING Tags have been renamed to Deployments
  • BREAKING createFile function expects Bucket ID as the first parameter
  • BREAKING createDeployment and createFile functions expect an instance InputFile rather than the instance of MultipartFile
  • BREAKING list<Entity> endpoints now contain a total attribute instead of sum
  • onProgress() callback function for endpoints supporting file uploads
  • Support for synchronous function executions
  • Bug fixes and Improvements

4.0.1

  • Fix InputFile filename param
  • Fix examples

4.0.2

5.0.0

  • Support for Appwrite 0.14
  • BREAKING account.delete() -> account.updateStatus()
  • BREAKING Execution model stdout renamed to response
  • BREAKING Membership model name renamed to userName and email renamed to userEmail
  • Added teamName to Membership model
  • New users.getMemberships function

5.0.1

  • Code formatting fix

6.0.0

  • Support for Appwrite 0.15
  • BREAKING Database -> Databases
  • BREAKING account.createSession() -> account.createEmailSession()
  • BREAKING dateCreated attribute removed from Team, Execution, File models
  • BREAKING dateCreated and dateUpdated attribute removed from Func, Deployment, Bucket models
  • BREAKING Realtime channels
    • collections.[COLLECTION_ID] is now databases.[DATABASE_ID].ollections.[COLLECTION_ID]
    • collections.[COLLECTION_ID].documents is now databases.[DATABASE_ID].ollections.[COLLECTION_ID].documents

Changed

  • @ruud merged from appwrite to dart_appwrite.

10.0.10

2024-03-27 download

10.0.9

2023-02-09 download

10.0.8

2023-01-31 download

10.0.6

2022-12-22 download

10.0.5

2022-12-22 download

10.0.4

2022-10-11 download

10.0.3

2022-10-05 download

10.0.2

2022-10-01 download

10.0.1

2022-09-29 download

10.0.0

2022-08-15 download

6.0.0

-- download