You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 25, 2022. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+141-29
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,13 @@ If you are not familiar with the S³I concepts, please read the
36
36
37
37
For further information see the [KWH Glossar](https://www.kwh40.de/glossar/) and the other [Standpunkte](https://www.kwh40.de/veroffentlichungen/).
38
38
39
+
## Contributing
40
+
41
+
PRs are always welcome, check [CONTRIBUTING.md](https://github.com/LukasPoque/s3i_flutter/blob/master/CONTRIBUTING.md) for more info.
42
+
39
43
## Installing
40
44
41
-
Please see [Pub.dev](https://pub.dev/packages/s3i_flutter/install) for instructions how to install this package to your flutter app.
45
+
Please see [pub.dev](https://pub.dev/packages/s3i_flutter/install) for instructions how to install this package to your flutter app.
42
46
43
47
If you like this package, consider supporting it by giving a star on [GitHub](https://github.com/LukasPoque/s3i_flutter) and
44
48
a like on [pub.dev](https://pub.dev/packages/s3i_flutter):heart:
@@ -47,15 +51,20 @@ a like on [pub.dev](https://pub.dev/packages/s3i_flutter) :heart:
47
51
48
52
For a basic example application see the [example](https://github.com/LukasPoque/s3i_flutter/tree/master/example).
49
53
54
+
Use the [documentation](https://pub.dev/documentation/s3i_flutter/latest/s3i_flutter/s3i_flutter-library.html) of this package for
55
+
explicit information about every public method or class.
56
+
50
57
### Setup authentication
51
58
52
-
First you need to create a `ClientIdentity` used by your app. Please contact the [KWH4.0](https://www.kwh40.de/kontakt/) to get an app specific client.
59
+
First you need to create a `ClientIdentity` used by your app. Please contact the [KWH4.0](https://www.kwh40.de/kontakt/) to get an app
60
+
specific client. If you need special client settings like redirect urls (e.g. for the use of the S3I-OAuthProxy) please include this in your
61
+
request.
53
62
```dart
54
63
final clientIdentity = ClientIdentity(<CLIENT-ID>, <CLIENT-SECRET>);
55
64
```
56
65
57
66
Now you can pass this to an `AuthenticationManager` of your choice.
58
-
See [here](https://github.com/LukasPoque/s3i_flutter#auth) for a list of some implementations.
67
+
See [here](https://github.com/LukasPoque/s3i_flutter#Auth) for a list of some implementations.
59
68
In this example we use the `OAuthProxyFlow`. You can specify some scopes to add specific claims in your token.
60
69
```dart
61
70
final authManager = OAuthProxyFlow(clientIdentity,
@@ -64,24 +73,27 @@ final authManager = OAuthProxyFlow(clientIdentity,
64
73
scopes: ["group", "offline_access"]);
65
74
```
66
75
67
-
Last but not least you should use this `AuthenticationManager`-Instance to create a `S3ICore`-Instance.
68
-
```dart
69
-
final s3i = S3ICore(authManager);
70
-
```
71
-
72
76
If you want to assure that the user is authenticated before going on with other requests
73
-
you could trigger the auth process explicit by calling the `login()` function:
77
+
you could trigger the auth process explicit by calling the `getAccessToken()` function:
74
78
````dart
75
79
try {
76
-
await s3i.login();
80
+
await authManager.getAccessToken();
77
81
} on S3IException catch (e) {
78
82
debugPrint("Auth failed: " + e.toString());
79
83
}
80
84
````
81
85
82
-
If the `S3ICore`-Instance is ready to use you can now receive and update information from the S3I-Services.
86
+
### Use the S3I-Directory
87
+
88
+
If you want to access the S3I-Directory, use the previous constructed `AuthenticationManager`-Instance to create a `S3ICore`-Instance.
89
+
```dart
90
+
final s3i = S3ICore(authManager);
91
+
```
83
92
84
-
### Get data from the directory
93
+
If the `S3ICore`-Instance is ready to use you can now receive and update information from the S3I-Directory (This is subject of
94
+
a change in the next releases pls. consider this in your structure).
95
+
96
+
#### Get data from the directory
85
97
86
98
To get data about a specific thing you can simply call `getThing()` on your `S3ICore`-Instance.
87
99
If you don't need the whole thing it's recommended to use a `FieldQuery` so you only receive a part of the entry
@@ -105,43 +117,137 @@ try {
105
117
106
118
TODO: add search example
107
119
108
-
### Update data in the directory
120
+
####Update data in the directory
109
121
110
122
To update data in the directory it's recommended to request the target before changing it.
111
123
This is not needed, because all data classes cloud be created without a version from the cloud but since this package doesn't support `PATCH` requests,
112
124
using only local data could lead much more likely to unintentionally overwriting of values.
113
125
114
126
To update an entry in the directory simply use the `putThing()` or `putPolicy()` method with the locally modified object:
0 commit comments