diff --git a/Documentation~/README.md b/Documentation~/README.md index 89d5243..14c762e 100644 --- a/Documentation~/README.md +++ b/Documentation~/README.md @@ -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) @@ -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 diff --git a/package.json b/package.json index 59f507a..89b9c3a 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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",