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

com.utilities.rest 2.4.5 #61

Merged
merged 1 commit into from
Dec 31, 2023
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
3 changes: 2 additions & 1 deletion .github/workflows/upm-subtree-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: upm-subtree-split
on:
push:
branches:
- main
- main

jobs:
upm-subtree-split:
Expand All @@ -12,4 +12,5 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: RageAgainstThePixel/upm-subtree-split@v1
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ A Utilities.Rest package for the [Unity](https://unity.com/) Game Engine.

## Installing

Requires Unity 2021.3 LTS or higher.

The recommended installation method is though the unity package manager and [OpenUPM](https://openupm.com/packages/com.utilities.rest).

### Via Unity Package Manager and OpenUPM

- Open your Unity project settings
Expand Down Expand Up @@ -43,6 +47,7 @@ Advanced features includes progress notifications, authentication and native mul
- [Get](#get)
- [Post](#post)
- [Server Sent Events](#server-sent-events)
- [Data Received Callbacks](#data-received-callbacks)
- [Put](#put)
- [Patch](#patch)
- [Delete](#delete)
Expand Down Expand Up @@ -109,6 +114,18 @@ var response = await Rest.PostAsync("www.your.api/endpoint", jsonData, eventData
response.Validate(debug: true);
```

#### Data Received Callbacks

```csharp
var jsonData = "{\"data\":\"content\"}";
var response = await Rest.PostAsync("www.your.api/endpoint", jsonData, dataReceivedEventCallback => {
// eventCallback type is Rest.Response
Debug.Log(dataReceivedEventCallback.Body);
});
// Validates the response for you and will throw a RestException if the response is unsuccessful.
response.Validate(debug: true);
```

### Put

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Advanced features includes progress notifications, authentication and native mul
- [Get](#get)
- [Post](#post)
- [Server Sent Events](#server-sent-events)
- [Data Received Callbacks](#data-received-callbacks)
- [Put](#put)
- [Patch](#patch)
- [Delete](#delete)
Expand Down Expand Up @@ -109,6 +110,18 @@ var response = await Rest.PostAsync("www.your.api/endpoint", jsonData, eventData
response.Validate(debug: true);
```

#### Data Received Callbacks

```csharp
var jsonData = "{\"data\":\"content\"}";
var response = await Rest.PostAsync("www.your.api/endpoint", jsonData, dataReceivedEventCallback => {
// eventCallback type is Rest.Response
Debug.Log(dataReceivedEventCallback.Body);
});
// Validates the response for you and will throw a RestException if the response is unsuccessful.
response.Validate(debug: true);
```

### Put

```csharp
Expand Down
6 changes: 3 additions & 3 deletions Utilities.Rest/Packages/com.utilities.rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Utilities.Rest",
"description": "This package contains useful RESTful utilities for the Unity Game Engine.",
"keywords": [],
"version": "2.4.4",
"version": "2.4.5",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.rest#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.rest/releases",
Expand All @@ -15,8 +15,8 @@
"author": "Stephen Hodgson",
"url": "https://github.com/StephenHodgson",
"dependencies": {
"com.utilities.async": "2.1.1",
"com.utilities.extensions": "1.1.14",
"com.utilities.async": "2.1.2",
"com.utilities.extensions": "1.1.15",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
Expand Down