From fe07b3f9af617fab8b9d68c04f333c27eba9046a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 31 Dec 2023 00:01:52 -0500 Subject: [PATCH] com.utilities.rest 2.4.5 - com.utilities.async -> 2.1.2 - com.utilities.extensions - 1.1.15 - updated docs --- .github/workflows/upm-subtree-split.yml | 3 ++- README.md | 17 +++++++++++++++++ .../com.utilities.rest/Documentation~/README.md | 13 +++++++++++++ .../Packages/com.utilities.rest/package.json | 6 +++--- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upm-subtree-split.yml b/.github/workflows/upm-subtree-split.yml index dd5a5e2..5a9be9a 100644 --- a/.github/workflows/upm-subtree-split.yml +++ b/.github/workflows/upm-subtree-split.yml @@ -3,7 +3,7 @@ name: upm-subtree-split on: push: branches: - - main + - main jobs: upm-subtree-split: @@ -12,4 +12,5 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: RageAgainstThePixel/upm-subtree-split@v1 diff --git a/README.md b/README.md index 2625c8d..406fd0b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) @@ -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 diff --git a/Utilities.Rest/Packages/com.utilities.rest/Documentation~/README.md b/Utilities.Rest/Packages/com.utilities.rest/Documentation~/README.md index 89d5243..14c762e 100644 --- a/Utilities.Rest/Packages/com.utilities.rest/Documentation~/README.md +++ b/Utilities.Rest/Packages/com.utilities.rest/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/Utilities.Rest/Packages/com.utilities.rest/package.json b/Utilities.Rest/Packages/com.utilities.rest/package.json index 59f507a..89b9c3a 100644 --- a/Utilities.Rest/Packages/com.utilities.rest/package.json +++ b/Utilities.Rest/Packages/com.utilities.rest/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",