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

Upgrade dependencies #58

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Format and push

# Github action will require permission to write to repo
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
format:
runs-on: ubuntu-latest
container:
image: dart:stable

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: true
ref: ${{ github.event.pull_request.head.ref }}

- name: Format Dart code
run: dart format .

- name: git config
run: git config --global --add safe.directory /__w/sdk-for-dart/sdk-for-dart # required to fix dubious ownership

- name: Add & Commit
uses: EndBug/add-and-commit@v9.1.4
with:
add: lib

14 changes: 14 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Publish to pub.dev

on:
push:
tags:
- '[0-9]+\.[0-9]+\.[0-9]+.*'

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
environment: pub.dev
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 11.0.3

* Minor bugfixes

## 11.0.2

* Fixed MSG91 missing template ID
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: ^11.0.2
dart_appwrite: ^11.0.3
```

You can install packages from the command line:
Expand Down
1 change: 1 addition & 0 deletions docs/examples/messaging/update-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Message result = await messaging.updateEmail(
cc: [], // (optional)
bcc: [], // (optional)
scheduledAt: '', // (optional)
attachments: [], // (optional)
);
2 changes: 1 addition & 1 deletion lib/client_browser.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'src/client_browser.dart';
export 'src/client_browser.dart';
2 changes: 1 addition & 1 deletion lib/client_io.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'src/client_io.dart';
export 'src/client_io.dart';
2 changes: 1 addition & 1 deletion lib/dart_appwrite.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Appwrite Dart SDK
///
/// This SDK is compatible with Appwrite server version 1.5.x.
/// This SDK is compatible with Appwrite server version 1.5.x.
/// For older versions, please check
/// [previous releases](https://github.com/appwrite/sdk-for-dart/releases).
library dart_appwrite;
Expand Down
5 changes: 2 additions & 3 deletions lib/id.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of dart_appwrite;
part of 'dart_appwrite.dart';

/// Helper class to generate ID strings for resources.
class ID {
Expand All @@ -10,8 +10,7 @@ class ID {
final now = DateTime.now();
final sec = (now.millisecondsSinceEpoch / 1000).floor();
final usec = now.microsecondsSinceEpoch - (sec * 1000000);
return sec.toRadixString(16) +
usec.toRadixString(16).padLeft(5, '0');
return sec.toRadixString(16) + usec.toRadixString(16).padLeft(5, '0');
}

// Generate a unique ID with padding to have a longer ID
Expand Down
2 changes: 1 addition & 1 deletion lib/permission.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of dart_appwrite;
part of 'dart_appwrite.dart';

/// Helper class to generate permission strings for resources.
class Permission {
Expand Down
47 changes: 27 additions & 20 deletions lib/query.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
part of dart_appwrite;

part of 'dart_appwrite.dart';

/// Helper class to generate query strings.
class Query {
Expand All @@ -14,11 +13,11 @@ class Query {
'method': method,
};

if(attribute != null) {
if (attribute != null) {
map['attribute'] = attribute;
}
if(values != null) {

if (values != null) {
map['values'] = values is List ? values : [values];
}

Expand All @@ -29,7 +28,7 @@ class Query {
String toString() => jsonEncode(toJson());

/// Filter resources where [attribute] is equal to [value].
///
///
/// [value] can be a single value or a list. If a list is used
/// the query will return resources where [attribute] is equal
/// to any of the values in the list.
Expand Down Expand Up @@ -61,10 +60,12 @@ class Query {
Query._('search', attribute, value).toString();

/// Filter resources where [attribute] is null.
static String isNull(String attribute) => Query._('isNull', attribute).toString();
static String isNull(String attribute) =>
Query._('isNull', attribute).toString();

/// Filter resources where [attribute] is not null.
static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString();
static String isNotNull(String attribute) =>
Query._('isNotNull', attribute).toString();

/// Filter resources where [attribute] is between [start] and [end] (inclusive).
static String between(String attribute, dynamic start, dynamic end) =>
Expand All @@ -84,40 +85,46 @@ class Query {
Query._('contains', attribute, value).toString();

static String or(List<String> queries) =>
Query._('or', null, queries.map((query) => jsonDecode(query)).toList()).toString();
Query._('or', null, queries.map((query) => jsonDecode(query)).toList())
.toString();

static String and(List<String> queries) =>
Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString();
Query._('and', null, queries.map((query) => jsonDecode(query)).toList())
.toString();

/// Specify which attributes should be returned by the API call.
static String select(List<String> attributes) =>
Query._('select', null, attributes).toString();

/// Sort results by [attribute] ascending.
static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString();
static String orderAsc(String attribute) =>
Query._('orderAsc', attribute).toString();

/// Sort results by [attribute] descending.
static String orderDesc(String attribute) => Query._('orderDesc', attribute).toString();
static String orderDesc(String attribute) =>
Query._('orderDesc', attribute).toString();

/// Return results before [id].
///
///
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
/// docs for more information.
static String cursorBefore(String id) => Query._('cursorBefore', null, id).toString();
static String cursorBefore(String id) =>
Query._('cursorBefore', null, id).toString();

/// Return results after [id].
///
///
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
/// docs for more information.
static String cursorAfter(String id) => Query._('cursorAfter', null, id).toString();
static String cursorAfter(String id) =>
Query._('cursorAfter', null, id).toString();

/// Return only [limit] results.
static String limit(int limit) => Query._('limit', null, limit).toString();

/// Return results from [offset].
///
///
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
/// docs for more information.
static String offset(int offset) => Query._('offset', null, offset).toString();

}
static String offset(int offset) =>
Query._('offset', null, offset).toString();
}
108 changes: 54 additions & 54 deletions lib/role.dart
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
part of dart_appwrite;
part of 'dart_appwrite.dart';

/// Helper class to generate role strings for [Permission].
class Role {
Role._();

/// Grants access to anyone.
///
/// This includes authenticated and unauthenticated users.
static String any() {
return 'any';
}
Role._();

/// Grants access to a specific user by user ID.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String user(String id, [String status = '']) {
if(status.isEmpty) {
return 'user:$id';
}
return 'user:$id/$status';
}
/// Grants access to anyone.
///
/// This includes authenticated and unauthenticated users.
static String any() {
return 'any';
}

/// Grants access to any authenticated or anonymous user.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String users([String status = '']) {
if(status.isEmpty) {
return 'users';
}
return 'users/$status';
/// Grants access to a specific user by user ID.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String user(String id, [String status = '']) {
if (status.isEmpty) {
return 'user:$id';
}
return 'user:$id/$status';
}

/// Grants access to any guest user without a session.
///
/// Authenticated users don't have access to this role.
static String guests() {
return 'guests';
/// Grants access to any authenticated or anonymous user.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String users([String status = '']) {
if (status.isEmpty) {
return 'users';
}
return 'users/$status';
}

/// Grants access to a team by team ID.
///
/// You can optionally pass a role for [role] to target
/// team members with the specified role.
static String team(String id, [String role = '']) {
if(role.isEmpty) {
return 'team:$id';
}
return 'team:$id/$role';
}
/// Grants access to any guest user without a session.
///
/// Authenticated users don't have access to this role.
static String guests() {
return 'guests';
}

/// Grants access to a specific member of a team.
///
/// When the member is removed from the team, they will
/// no longer have access.
static String member(String id) {
return 'member:$id';
/// Grants access to a team by team ID.
///
/// You can optionally pass a role for [role] to target
/// team members with the specified role.
static String team(String id, [String role = '']) {
if (role.isEmpty) {
return 'team:$id';
}
return 'team:$id/$role';
}

/// Grants access to a user with the specified label.
static String label(String name) {
return 'label:$name';
}
}
/// Grants access to a specific member of a team.
///
/// When the member is removed from the team, they will
/// no longer have access.
static String member(String id) {
return 'member:$id';
}

/// Grants access to a user with the specified label.
static String label(String name) {
return 'label:$name';
}
}