mirror of
https://github.com/appwrite/sdk-for-flutter.git
synced 2026-04-07 19:27:41 +00:00
Fix oauth
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
|
||||
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
|
||||
|
||||
```yml
|
||||
dependencies:
|
||||
appwrite: ^8.2.0
|
||||
appwrite: ^8.2.1
|
||||
```
|
||||
|
||||
You can install packages from the command line:
|
||||
@@ -91,7 +91,7 @@ For web in order to capture the OAuth2 callback URL and send it to the applicati
|
||||
close the window.
|
||||
<script>
|
||||
window.opener.postMessage({
|
||||
'flutter-web-auth-2': window.location.href
|
||||
flutter-web-auth-2: window.location.href
|
||||
}, window.location.origin);
|
||||
window.close();
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Functions functions = Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = functions.retryBuild(
|
||||
functionId: '[FUNCTION_ID]',
|
||||
deploymentId: '[DEPLOYMENT_ID]',
|
||||
buildId: '[BUILD_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Graphql graphql = Graphql(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = graphql.63a0228e7e93a(
|
||||
query: '[QUERY]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Graphql graphql = Graphql(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = graphql.63a025ceb6ac4(
|
||||
query: '[QUERY]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Graphql graphql = Graphql(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
Future result = graphql.get(
|
||||
query: '[QUERY]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
part of appwrite;
|
||||
|
||||
class ID {
|
||||
ID._();
|
||||
|
||||
static String unique() {
|
||||
return 'unique()';
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
part of appwrite;
|
||||
|
||||
class Permission {
|
||||
Permission._();
|
||||
|
||||
static String read(String role) {
|
||||
return 'read("$role")';
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
part of appwrite;
|
||||
|
||||
class Query {
|
||||
Query._();
|
||||
|
||||
static equal(String attribute, dynamic value) =>
|
||||
_addQuery(attribute, 'equal', value);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
part of appwrite;
|
||||
|
||||
class Role {
|
||||
Role._();
|
||||
|
||||
static String any() {
|
||||
return 'any';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
part of appwrite;
|
||||
|
||||
class GraphQL extends Service {
|
||||
GraphQL(super.client);
|
||||
|
||||
/// GraphQL Endpoint
|
||||
///
|
||||
/// Execute a GraphQL mutation.
|
||||
///
|
||||
Future query({required Map query}) async {
|
||||
const String path = '/graphql';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'query': query,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'x-sdk-graphql': 'true', 'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
/// GraphQL Endpoint
|
||||
///
|
||||
/// Execute a GraphQL mutation.
|
||||
///
|
||||
Future mutation({required Map query}) async {
|
||||
const String path = '/graphql/mutation';
|
||||
|
||||
final Map<String, dynamic> params = {
|
||||
'query': query,
|
||||
};
|
||||
|
||||
final Map<String, String> headers = {
|
||||
'x-sdk-graphql': 'true', 'content-type': 'application/json',
|
||||
};
|
||||
|
||||
final res = await client.call(HttpMethod.post, path: path, params: params, headers: headers);
|
||||
|
||||
return res.data;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
|
||||
'x-sdk-name': 'Flutter',
|
||||
'x-sdk-platform': 'client',
|
||||
'x-sdk-language': 'flutter',
|
||||
'x-sdk-version': '8.2.0',
|
||||
'x-sdk-version': '8.2.1',
|
||||
'X-Appwrite-Response-Format' : '1.0.0',
|
||||
};
|
||||
|
||||
@@ -221,7 +221,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
|
||||
Future webAuth(Uri url, {String? callbackUrlScheme}) {
|
||||
return FlutterWebAuth2.authenticate(
|
||||
url: url.toString(),
|
||||
callbackUrlScheme: callbackUrlScheme ?? "appwrite-callback-" + config['project']!,
|
||||
callbackUrlScheme: "appwrite-callback-" + config['project']!,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class ClientIO extends ClientBase with ClientMixin {
|
||||
'x-sdk-name': 'Flutter',
|
||||
'x-sdk-platform': 'client',
|
||||
'x-sdk-language': 'flutter',
|
||||
'x-sdk-version': '8.2.0',
|
||||
'x-sdk-version': '8.2.1',
|
||||
'X-Appwrite-Response-Format' : '1.0.0',
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: appwrite
|
||||
version: 8.2.0
|
||||
version: 8.2.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-flutter
|
||||
|
||||
Reference in New Issue
Block a user