Skip to content

Commit 712b78c

Browse files
authored
Merge pull request #196 from proyecto26/develop
Release 2.6.2
2 parents 0b5e71f + 196b635 commit 712b78c

37 files changed

+730
-46
lines changed

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ patreon: proyecto26
55
open_collective: proyecto26
66
ko_fi: proyecto26
77
tidelift: "nuget/Proyecto26.RestClient"
8-
liberapay: jdnichollsc
8+
liberapay: proyecto26
99
custom: paypal.me/jdnichollsc

.github/workflows/ci.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release
7+
jobs:
8+
split-upm:
9+
name: split upm branch
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- name: split upm branch
16+
run: |
17+
git branch -d upm &> /dev/null || echo upm branch not found # recreate the upm branch each time
18+
git mv "$PKG_ROOT" "src/$UPM_ROOT"
19+
git mv "src/$UPM_ROOT" .
20+
git mv demo/Assets demo/Sample
21+
git mv demo/Sample $UPM_ROOT
22+
git mv doc Docs
23+
git mv Docs $UPM_ROOT
24+
git mv LICENSE $UPM_ROOT
25+
git mv README.md $UPM_ROOT
26+
git mv SECURITY.md $UPM_ROOT
27+
git mv CHANGELOG.md $UPM_ROOT
28+
git mv CONTRIBUTING.md $UPM_ROOT
29+
echo "********************** ROOT **********************"
30+
ls
31+
git add "$UPM_ROOT"
32+
git config --global user.name 'github-bot'
33+
git config --global user.email '[email protected]'
34+
git commit -m "create release folder"
35+
git subtree split -P "$UPM_ROOT" -b upm # create the upm branch
36+
git checkout upm # checkout the branch
37+
if [[ -d "Sample/Packages" ]]; then
38+
git rm -rf Sample/Packages
39+
git rm Sample/Packages.meta --ignore-unmatch
40+
git rm Sample/packages.config
41+
git rm Sample/packages.config.meta --ignore-unmatch
42+
fi
43+
if [[ -d "Properties" ]]; then
44+
git rm -rf Properties
45+
git rm Properties.meta --ignore-unmatch
46+
git rm Proyecto26.RestClient.csproj
47+
git rm Proyecto26.RestClient.csproj.meta --ignore-unmatch
48+
git rm Proyecto26.RestClient.nuspec
49+
git rm Proyecto26.RestClient.nuspec.meta --ignore-unmatch
50+
git rm packages.config
51+
git rm packages.config.meta --ignore-unmatch
52+
fi
53+
git commit -am "fix: src => root"
54+
echo "********************** ROOT **********************"
55+
ls
56+
git push -u origin upm --force # commit the branch
57+
env:
58+
PKG_ROOT: src/Proyecto26.RestClient
59+
UPM_ROOT: Release

CHANGELOG.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.6.2] - 2021-12-26
10+
11+
### Added
12+
- Add a progress reporting callback by [@lyze237](https://github.com/lyze237) ([#153](https://github.com/proyecto26/RestClient/pull/153)).
13+
- Add support for **PATCH** verb by [@neegool](https://github.com/neegool) ([#185](https://github.com/proyecto26/RestClient/pull/185)).
14+
- Add solution to make network call on main thread by [@maifeeulasad](https://github.com/maifeeulasad) ([#190](https://github.com/proyecto26/RestClient/pull/190)).
15+
- Add support for UPM package by [@benukhanov](https://github.com/benukhanov), [@tonygiang](https://github.com/tonygiang) and [@Hermesiss](https://github.com/Hermesiss) ([#198](https://github.com/proyecto26/RestClient/pull/198)).
16+
17+
### Changed
18+
- Changes to use **RetryCallback** to handle token expiration by [@fegabe](https://github.com/fegabe) ([#142](https://github.com/proyecto26/RestClient/pull/142)).
19+
20+
### Fixed
21+
- Handle HTTP NO CONTENT status code (204) to prevent null reference exceptions by [@L-Naej](https://github.com/L-Naej) and [@StevenGarberg](https://github.com/StevenGarberg) ([#188](https://github.com/proyecto26/RestClient/pull/188)).
22+
23+
### Removed
24+
- Removing Depricated APIs by [@Drazail](https://github.com/Drazail) ([#164](https://github.com/proyecto26/RestClient/pull/164)).
25+
926
## [2.6.1] - 2020-06-10
1027

1128
### Fixed
@@ -142,7 +159,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
142159
## [...1.0.1]
143160
Missing tags for previous versions 🤷‍♂
144161

145-
[Unreleased]: https://github.com/proyecto26/RestClient/compare/v2.6.1...HEAD
162+
[Unreleased]: https://github.com/proyecto26/RestClient/compare/v2.6.2...HEAD
163+
[2.6.2]: https://github.com/proyecto26/RestClient/compare/v2.6.1...v2.6.2
146164
[2.6.1]: https://github.com/proyecto26/RestClient/compare/v2.6.0...v2.6.1
147165
[2.6.0]: https://github.com/proyecto26/RestClient/compare/v2.5.9...v2.6.0
148166
[2.5.9]: https://github.com/proyecto26/RestClient/compare/2.5.7...v2.5.9

CONTRIBUTING.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## Pull Request Process
9+
10+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11+
build.
12+
2. Update the README.md with details of changes to the interface, this includes new environment
13+
variables, exposed ports, useful file locations and container parameters.
14+
3. Increase the version numbers in any examples files and the README.md to the new version that this
15+
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16+
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
17+
do not have permission to do that, you may request the second reviewer to merge it for you.
18+
19+
## Code of Conduct
20+
21+
### Our Pledge
22+
23+
In the interest of fostering an open and welcoming environment, we as
24+
contributors and maintainers pledge to making participation in our project and
25+
our community a harassment-free experience for everyone, regardless of age, body
26+
size, disability, ethnicity, gender identity and expression, level of experience,
27+
nationality, personal appearance, race, religion, or sexual identity and
28+
orientation.
29+
30+
### Our Standards
31+
32+
Examples of behavior that contributes to creating a positive environment
33+
include:
34+
35+
* Using welcoming and inclusive language
36+
* Being respectful of differing viewpoints and experiences
37+
* Gracefully accepting constructive criticism
38+
* Focusing on what is best for the community
39+
* Showing empathy towards other community members
40+
41+
Examples of unacceptable behavior by participants include:
42+
43+
* The use of sexualized language or imagery and unwelcome sexual attention or
44+
advances
45+
* Trolling, insulting/derogatory comments, and personal or political attacks
46+
* Public or private harassment
47+
* Publishing others' private information, such as a physical or electronic
48+
address, without explicit permission
49+
* Other conduct which could reasonably be considered inappropriate in a
50+
professional setting
51+
52+
### Our Responsibilities
53+
54+
Project maintainers are responsible for clarifying the standards of acceptable
55+
behavior and are expected to take appropriate and fair corrective action in
56+
response to any instances of unacceptable behavior.
57+
58+
Project maintainers have the right and responsibility to remove, edit, or
59+
reject comments, commits, code, wiki edits, issues, and other contributions
60+
that are not aligned to this Code of Conduct, or to ban temporarily or
61+
permanently any contributor for other behaviors that they deem inappropriate,
62+
threatening, offensive, or harmful.
63+
64+
### Scope
65+
66+
This Code of Conduct applies both within project spaces and in public spaces
67+
when an individual is representing the project or its community. Examples of
68+
representing a project or community include using an official project e-mail
69+
address, posting via an official social media account, or acting as an appointed
70+
representative at an online or offline event. Representation of a project may be
71+
further defined and clarified by project maintainers.
72+
73+
### Enforcement
74+
75+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
76+
reported by contacting the project team at [email protected]. All
77+
complaints will be reviewed and investigated and will result in a response that
78+
is deemed necessary and appropriate to the circumstances. The project team is
79+
obligated to maintain confidentiality with regard to the reporter of an incident.
80+
Further details of specific enforcement policies may be posted separately.
81+
82+
Project maintainers who do not follow or enforce the Code of Conduct in good
83+
faith may face temporary or permanent repercussions as determined by other
84+
members of the project's leadership.
85+
86+
### Attribution
87+
88+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
89+
available at [http://contributor-covenant.org/version/1/4][version]
90+
91+
[homepage]: http://contributor-covenant.org
92+
[version]: http://contributor-covenant.org/version/1/4/

README.md

+56-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![Made with Unity](https://img.shields.io/badge/Made%20with-Unity-57b9d3.svg?style=flat&logo=unity)](https://assetstore.unity.com/publishers/32542)
22
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
3-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/969f6b9d04324af58382f7ee7a8faccd)](https://app.codacy.com/app/jdnichollsc/RestClient?utm_source=github.com&utm_medium=referral&utm_content=proyecto26/RestClient&utm_campaign=Badge_Grade_Dashboard)
43
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/proyecto26/RestClient/graphs/commit-activity)
54
[![Tidelift Subscription](https://tidelift.com/badges/package/nuget/Proyecto26.RestClient)](https://tidelift.com/subscription/pkg/nuget-proyecto26-restclient?utm_source=nuget-proyecto26-restclient&utm_medium=referral&utm_campaign=readme)
65
[![Build Status](https://travis-ci.org/proyecto26/RestClient.svg?branch=master)](https://travis-ci.org/proyecto26/RestClient)
@@ -55,6 +54,7 @@ RestClient.GetArray<Post>(api + "/posts").Then(response => {
5554
- Handle HTTP exceptions in a better way
5655
- Retry HTTP requests easily
5756
- Open Source 🦄
57+
- Utility to work during scene transition
5858

5959
## Supported platforms 📱 🖥
6060
The [UnityWebRequest](https://docs.unity3d.com/Manual/UnityWebRequest.html) system supports most Unity platforms:
@@ -79,7 +79,10 @@ Do you want to see this beautiful package in action? Download the demo [here](ht
7979
### Unity package
8080
Download and install the **.unitypackage** file of the latest release published [here](https://github.com/proyecto26/RestClient/releases).
8181

82-
### Nuget package
82+
### UPM package
83+
Make sure you had installed [C# Promise package](https://openupm.com/packages/com.rsg.promise/) or at least have it in your [openupm scope registry](https://openupm.com/). Then install **RestClient package** using this URL from **Package Manager**: `https://github.com/proyecto26/RestClient.git#upm`
84+
85+
### NuGet package
8386
Other option is download this package from **NuGet** with **Visual Studio** or using the **nuget-cli**, a **[NuGet.config](https://github.com/proyecto26/RestClient/blob/master/demo/NuGet.config)** file is required at the root of your **Unity Project**, for example:
8487

8588
```xml
@@ -112,6 +115,13 @@ RestClient.Head("https://jsonplaceholder.typicode.com/posts").Then(response => {
112115
});
113116
```
114117

118+
## Handling during scene transition
119+
```csharp
120+
ExecuteOnMainThread.RunOnMainThread.Enqueue(() => {
121+
//Any API call using RestClient
122+
});
123+
```
124+
115125
### Generic Request Method
116126
And we have a generic method to create any type of request:
117127
```csharp
@@ -137,7 +147,9 @@ RestClient.Request(new RequestHelper {
137147
ContentType = "application/json", //JSON is used by default
138148
Retries = 3, //Number of retries
139149
RetrySecondsDelay = 2, //Seconds of delay to make a retry
150+
RetryCallbackOnlyOnNetworkErrors = true, //Invoke RetryCallack only when the retry is provoked by a network error
140151
RetryCallback = (err, retries) => {}, //See the error before retrying the request
152+
ProgressCallback = (percent) => {}, //Reports progress of the request from 0 to 1
141153
EnableDebug = true, //See logs of the requests for debug mode
142154
IgnoreHttpException = true, //Prevent to catch http exceptions
143155
ChunkedTransfer = false,
@@ -152,6 +164,9 @@ RestClient.Request(new RequestHelper {
152164
AssetBundle assetBundle = ((DownloadHandlerAssetBundle)response.Request.downloadHandler).assetBundle;
153165

154166
EditorUtility.DisplayDialog("Status", response.StatusCode.ToString(), "Ok");
167+
}).Catch(err => {
168+
var error = err as RequestException;
169+
EditorUtility.DisplayDialog("Error Response", error.Response, "Ok");
155170
});
156171
```
157172

@@ -257,6 +272,14 @@ currentRequest.DownloadedBytes; //The number of bytes of body data the system ha
257272
currentRequest.Abort(); //Abort the request manually
258273
```
259274

275+
Additionally we can run a callback function whenever a progress change happens!
276+
```csharp
277+
RestClient.Get(new RequestHelper {
278+
Uri = "https://jsonplaceholder.typicode.com/users",
279+
ProgressCallback = percent => Debug.Log(percent)
280+
});
281+
```
282+
260283
Later we can clear the default headers and params for all requests
261284
```csharp
262285
RestClient.ClearDefaultHeaders();
@@ -295,19 +318,42 @@ router.post('/', function(req, res) {
295318
});
296319
```
297320

298-
## Collaborators 🥇
321+
## Credits 👍
322+
* **C-Sharp-Promise:** [Promises library for C# for management of asynchronous operations.](https://github.com/Real-Serious-Games/C-Sharp-Promise)
323+
* **MyAPI:** [A template to create awesome APIs easily ⚡️](https://github.com/proyecto26/MyAPI)
324+
325+
## Contributing ✨
326+
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
327+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.
328+
You can learn more about how you can contribute to this project in the [contribution guide](https://github.com/proyecto26/RestClient/blob/develop/CONTRIBUTING.md).
329+
330+
## Contributors ✨
331+
Please do contribute! Issues and pull requests are welcome.
332+
333+
### Code Contributors
334+
335+
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
336+
337+
[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/0)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/0)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/1)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/1)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/2)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/2)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/3)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/3)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/4)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/4)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/5)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/5)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/6)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/6)[![](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/images/7)](https://sourcerer.io/fame/jdnichollsc/proyecto26/RestClient/links/7)
338+
339+
### Collaborators
340+
<!-- COLLABORATORS-LIST:START - Do not remove or modify this section -->
299341
[<img alt="jdnichollsc" src="https://avatars3.githubusercontent.com/u/2154886?v=3&s=117" width="117">](https://github.com/jdnichollsc) | [<img alt="diegoossa" src="https://avatars3.githubusercontent.com/u/3436237?v=3&s=117" width="117">](https://github.com/diegoossa) | [<img alt="nasdull" src="https://avatars3.githubusercontent.com/u/25492923?v=3&s=117" width="117">](https://github.com/nasdull) |
300342
:---: | :---: | :---: |
301343
[Juan Nicholls](mailto:[email protected]) | [Diego Ossa](mailto:[email protected]) | [Nasdull](mailto:[email protected]) |
302-
303-
## Credits 👍
304-
* **Promises library for C#:** [Real Serious Games/C-Sharp-Promise](https://github.com/Real-Serious-Games/C-Sharp-Promise)
344+
<!-- COLLABORATORS-LIST:END -->
305345

306346
## Supporting 🍻
307347
I believe in Unicorns 🦄
308348
Support [me](http://www.paypal.me/jdnichollsc/2), if you do too.
309349

310-
Any good review from the [Unity Store](https://assetstore.unity.com/packages/tools/network/rest-client-for-unity-102501) is also really appreciated!
350+
Donate **Ethereum**, **ADA**, **BNB**, **SHIBA**, **USDT**, **DOGE**:
351+
352+
![Wallet address](https://user-images.githubusercontent.com/2154886/123501719-84bf1900-d60c-11eb-882c-98a499cea323.png)
353+
354+
> Wallet address: 0x3F9fA8021B43ACe578C2352861Cf335449F33427
355+
356+
Please let us know your contributions! 🙏
311357

312358
## Enterprise 💼
313359

@@ -318,6 +364,9 @@ The maintainers of RestClient for Unity and thousands of other packages are work
318364
## Security contact information 🚨
319365
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
320366

367+
## License ⚖️
368+
This repository is available under the [MIT License](https://github.com/proyecto26/RestClient/blob/develop/LICENSE).
369+
321370
## Happy coding 💯
322371
Made with ❤️
323372

doc/RestClient.docx

71 KB
Binary file not shown.

doc/RestClient.pages

1.5 MB
Binary file not shown.

doc/RestClient.pdf

134 KB
Binary file not shown.

img/rest-client.tif

17.1 MB
Binary file not shown.

img/rest-client_banner.tif

11.7 MB
Binary file not shown.

src/.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ artifacts/
5252
*_p.c
5353
*_i.h
5454
*.ilk
55-
*.meta
5655
*.obj
5756
*.pch
5857
*.pdb
@@ -73,6 +72,11 @@ artifacts/
7372
*.svclog
7473
*.scc
7574

75+
# Unity3D generated meta files
76+
*.pidb.meta
77+
*.pdb.meta
78+
*.mdb.meta
79+
7680
# Chutzpah Test files
7781
_Chutzpah*
7882

src/Proyecto26.RestClient/Helpers.meta

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Proyecto26.RestClient/Helpers/Common.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Text;
2-
using System.Collections;
32
using UnityEngine;
43
using UnityEngine.Networking;
54

@@ -78,10 +77,10 @@ private static void ConfigureWebRequestWithOptions(UnityWebRequest request, byte
7877
/// <summary>
7978
/// Send the web request to the server
8079
/// </summary>
81-
/// <returns>An UnityWebRequestAsyncOperation object.</returns>
80+
/// <returns>An AsyncOperation object.</returns>
8281
/// <param name="request">An UnityWebRequest object.</param>
8382
/// <param name="options">An options object.</param>
84-
public static IEnumerator SendWebRequestWithOptions(this UnityWebRequest request, RequestHelper options)
83+
public static AsyncOperation SendWebRequestWithOptions(this UnityWebRequest request, RequestHelper options)
8584
{
8685
byte[] bodyRaw = options.BodyRaw;
8786
string contentType = string.Empty;
@@ -119,9 +118,9 @@ public static IEnumerator SendWebRequestWithOptions(this UnityWebRequest request
119118

120119
ConfigureWebRequestWithOptions(request, bodyRaw, contentType, options);
121120
#if UNITY_2017_2_OR_NEWER
122-
yield return request.SendWebRequest();
121+
return request.SendWebRequest();
123122
#else
124-
yield return request.Send();
123+
return request.Send();
125124
#endif
126125
}
127126
}

0 commit comments

Comments
 (0)