Skip to content

Commit 81115fc

Browse files
authored
docs: update readme
1 parent fb1524b commit 81115fc

1 file changed

Lines changed: 45 additions & 18 deletions

File tree

README.md

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,71 @@ use OpenLRW\OpenLRW;
2727
$client = new OpenLRW(URL, KEY, PASSWORD);
2828
```
2929

30-
### Generate a JSON Web Token
30+
#### Check if the server is up
3131
```php
32-
OpenLRW::generateJwt();
32+
$isServerUp = OpenLRW::isUp();
3333
```
3434

35-
### Get data
35+
36+
### Generate a JSON Web Token
3637
```php
37-
$user = OneRoster::get('users/test2u'); // return the data for the user 'test2u'
38+
OpenLRW::generateJwt();
3839
```
3940

40-
### Using OneRoster Model
41-
> Example with the User collection
41+
### OneRoster objects
42+
> All the OneRoster models are not yet implemented, send an issue to let us know if you need a new collection
43+
44+
#### Example of the basic functions with the User Collection
45+
> All the OneRoster models have those functions
4246
43-
#### Get an entity
4447
```php
45-
$user = User::find('foo-bar'); // return a User object
46-
echo $user->sourcedId; // return 'foo-bar'
48+
// Get and edit a user
49+
$user = User::find('foobar');
50+
$user->status = 'active';
51+
$user->save();
52+
53+
54+
// Create a new user
55+
$user = new User();
56+
$user->sourcedId = 'foo';
57+
$user->name = 'bar';
58+
$user->status 'inactive';
59+
$user->save();
4760

61+
// Delete a user
62+
$user->delete(); /** or */ User::destroy('foo-bar');
63+
64+
// Get all the users
65+
$users = Users::all();
4866
```
4967

50-
#### Delete
51-
```php
52-
$user = User::find('foo-bar');
53-
$user->delete(); // User deleted
68+
### Some examples of the specific functions per class
69+
> Check the classes to know all those specific functions
5470
55-
// Or
71+
```php
72+
/** Klass model */
73+
$enrollments = Klass::enrollments($classId); // array
74+
$events = Klass::events($classId); // array
75+
// ...
5676

57-
User::destroy('foo-bar);
77+
/** Risk */
78+
$latestRisk = Risk::latestByClassAndUser($classId, $userId); // Risk::class
79+
// ...
5880

5981
```
6082

83+
### Generic usage
84+
6185

62-
### Helpers
63-
#### Check if the server is up
6486
```php
65-
$isServerUp = OpenLRW::isUp();
87+
### Get data
88+
$user = OneRoster::httpGet('users/test2u'); // return an array
89+
90+
$dataToSend = ['...'];
91+
$response = OneRoster::httpPost('users', $dataToSend
6692
```
6793

94+
### Helpers
6895

6996
## Execute tests
7097

0 commit comments

Comments
 (0)