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

Update attributes #64

Merged
merged 4 commits into from
Sep 10, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ^12.0.0
dart_appwrite: ^12.1.0
```

You can install packages from the command line:
Expand Down
1 change: 1 addition & 0 deletions docs/examples/databases/update-boolean-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ AttributeBoolean result = await databases.updateBooleanAttribute(
key: '',
xrequired: false,
xdefault: false,
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-datetime-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ AttributeDatetime result = await databases.updateDatetimeAttribute(
key: '',
xrequired: false,
xdefault: '',
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-email-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ AttributeEmail result = await databases.updateEmailAttribute(
key: '',
xrequired: false,
xdefault: '[email protected]',
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-enum-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ AttributeEnum result = await databases.updateEnumAttribute(
elements: [],
xrequired: false,
xdefault: '<DEFAULT>',
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-float-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ AttributeFloat result = await databases.updateFloatAttribute(
min: 0,
max: 0,
xdefault: 0,
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-integer-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ AttributeInteger result = await databases.updateIntegerAttribute(
min: 0,
max: 0,
xdefault: 0,
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-ip-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ AttributeIp result = await databases.updateIpAttribute(
key: '',
xrequired: false,
xdefault: '',
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-relationship-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ AttributeRelationship result = await databases.updateRelationshipAttribute(
collectionId: '<COLLECTION_ID>',
key: '',
onDelete: RelationMutate.cascade, // (optional)
newKey: '', // (optional)
);
2 changes: 2 additions & 0 deletions docs/examples/databases/update-string-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ AttributeString result = await databases.updateStringAttribute(
key: '',
xrequired: false,
xdefault: '<DEFAULT>',
size: 0, // (optional)
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-url-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ AttributeUrl result = await databases.updateUrlAttribute(
key: '',
xrequired: false,
xdefault: 'https://example.com',
newKey: '', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/functions/create-deployment.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:io';
import 'package:dart_appwrite/dart_appwrite.dart';

Client client = Client()
Expand Down
42 changes: 32 additions & 10 deletions lib/services/databases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ class Databases extends Service {
required String collectionId,
required String key,
required bool xrequired,
required bool? xdefault}) async {
required bool? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -328,6 +329,7 @@ class Databases extends Service {
final Map<String, dynamic> apiParams = {
'required': xrequired,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -381,7 +383,8 @@ class Databases extends Service {
required String collectionId,
required String key,
required bool xrequired,
required String? xdefault}) async {
required String? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -391,6 +394,7 @@ class Databases extends Service {
final Map<String, dynamic> apiParams = {
'required': xrequired,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -446,7 +450,8 @@ class Databases extends Service {
required String collectionId,
required String key,
required bool xrequired,
required String? xdefault}) async {
required String? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -456,6 +461,7 @@ class Databases extends Service {
final Map<String, dynamic> apiParams = {
'required': xrequired,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -515,7 +521,8 @@ class Databases extends Service {
required String key,
required List<String> elements,
required bool xrequired,
required String? xdefault}) async {
required String? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -526,6 +533,7 @@ class Databases extends Service {
'elements': elements,
'required': xrequired,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -588,7 +596,8 @@ class Databases extends Service {
required bool xrequired,
required double min,
required double max,
required double? xdefault}) async {
required double? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -600,6 +609,7 @@ class Databases extends Service {
'min': min,
'max': max,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -662,7 +672,8 @@ class Databases extends Service {
required bool xrequired,
required int min,
required int max,
required int? xdefault}) async {
required int? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -674,6 +685,7 @@ class Databases extends Service {
'min': min,
'max': max,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -729,7 +741,8 @@ class Databases extends Service {
required String collectionId,
required String key,
required bool xrequired,
required String? xdefault}) async {
required String? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -739,6 +752,7 @@ class Databases extends Service {
final Map<String, dynamic> apiParams = {
'required': xrequired,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -836,7 +850,9 @@ class Databases extends Service {
required String collectionId,
required String key,
required bool xrequired,
required String? xdefault}) async {
required String? xdefault,
int? size,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -846,6 +862,8 @@ class Databases extends Service {
final Map<String, dynamic> apiParams = {
'required': xrequired,
'default': xdefault,
'size': size,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -901,7 +919,8 @@ class Databases extends Service {
required String collectionId,
required String key,
required bool xrequired,
required String? xdefault}) async {
required String? xdefault,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -911,6 +930,7 @@ class Databases extends Service {
final Map<String, dynamic> apiParams = {
'required': xrequired,
'default': xdefault,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
Expand Down Expand Up @@ -982,7 +1002,8 @@ class Databases extends Service {
{required String databaseId,
required String collectionId,
required String key,
enums.RelationMutate? onDelete}) async {
enums.RelationMutate? onDelete,
String? newKey}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'
.replaceAll('{databaseId}', databaseId)
Expand All @@ -991,6 +1012,7 @@ class Databases extends Service {

final Map<String, dynamic> apiParams = {
'onDelete': onDelete?.value,
'newKey': newKey,
};

final Map<String, String> apiHeaders = {
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 @@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
'x-sdk-name': 'Dart',
'x-sdk-platform': 'server',
'x-sdk-language': 'dart',
'x-sdk-version': '12.0.0',
'x-sdk-version': '12.1.0',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand Down
4 changes: 2 additions & 2 deletions lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class ClientIO extends ClientBase with ClientMixin {
'x-sdk-name': 'Dart',
'x-sdk-platform': 'server',
'x-sdk-language': 'dart',
'x-sdk-version': '12.0.0',
'x-sdk-version': '12.1.0',
'user-agent':
'AppwriteDartSDK/12.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
'AppwriteDartSDK/12.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
'X-Appwrite-Response-Format': '1.6.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: 12.0.0
version: 12.1.0
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