Skip to content

Commit

Permalink
Merge pull request #196 from proyecto26/develop
Browse files Browse the repository at this point in the history
Release 2.6.2
  • Loading branch information
jdnichollsc authored Dec 27, 2021
2 parents 0b5e71f + 196b635 commit 712b78c
Show file tree
Hide file tree
Showing 37 changed files with 730 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ patreon: proyecto26
open_collective: proyecto26
ko_fi: proyecto26
tidelift: "nuget/Proyecto26.RestClient"
liberapay: jdnichollsc
liberapay: proyecto26
custom: paypal.me/jdnichollsc
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI
on:
push:
branches:
- master
- release
jobs:
split-upm:
name: split upm branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: split upm branch
run: |
git branch -d upm &> /dev/null || echo upm branch not found # recreate the upm branch each time
git mv "$PKG_ROOT" "src/$UPM_ROOT"
git mv "src/$UPM_ROOT" .
git mv demo/Assets demo/Sample
git mv demo/Sample $UPM_ROOT
git mv doc Docs
git mv Docs $UPM_ROOT
git mv LICENSE $UPM_ROOT
git mv README.md $UPM_ROOT
git mv SECURITY.md $UPM_ROOT
git mv CHANGELOG.md $UPM_ROOT
git mv CONTRIBUTING.md $UPM_ROOT
echo "********************** ROOT **********************"
ls
git add "$UPM_ROOT"
git config --global user.name 'github-bot'
git config --global user.email '[email protected]'
git commit -m "create release folder"
git subtree split -P "$UPM_ROOT" -b upm # create the upm branch
git checkout upm # checkout the branch
if [[ -d "Sample/Packages" ]]; then
git rm -rf Sample/Packages
git rm Sample/Packages.meta --ignore-unmatch
git rm Sample/packages.config
git rm Sample/packages.config.meta --ignore-unmatch
fi
if [[ -d "Properties" ]]; then
git rm -rf Properties
git rm Properties.meta --ignore-unmatch
git rm Proyecto26.RestClient.csproj
git rm Proyecto26.RestClient.csproj.meta --ignore-unmatch
git rm Proyecto26.RestClient.nuspec
git rm Proyecto26.RestClient.nuspec.meta --ignore-unmatch
git rm packages.config
git rm packages.config.meta --ignore-unmatch
fi
git commit -am "fix: src => root"
echo "********************** ROOT **********************"
ls
git push -u origin upm --force # commit the branch
env:
PKG_ROOT: src/Proyecto26.RestClient
UPM_ROOT: Release
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.6.2] - 2021-12-26

### Added
- Add a progress reporting callback by [@lyze237](https://github.com/lyze237) ([#153](https://github.com/proyecto26/RestClient/pull/153)).
- Add support for **PATCH** verb by [@neegool](https://github.com/neegool) ([#185](https://github.com/proyecto26/RestClient/pull/185)).
- Add solution to make network call on main thread by [@maifeeulasad](https://github.com/maifeeulasad) ([#190](https://github.com/proyecto26/RestClient/pull/190)).
- 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)).

### Changed
- Changes to use **RetryCallback** to handle token expiration by [@fegabe](https://github.com/fegabe) ([#142](https://github.com/proyecto26/RestClient/pull/142)).

### Fixed
- 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)).

### Removed
- Removing Depricated APIs by [@Drazail](https://github.com/Drazail) ([#164](https://github.com/proyecto26/RestClient/pull/164)).

## [2.6.1] - 2020-06-10

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

[Unreleased]: https://github.com/proyecto26/RestClient/compare/v2.6.1...HEAD
[Unreleased]: https://github.com/proyecto26/RestClient/compare/v2.6.2...HEAD
[2.6.2]: https://github.com/proyecto26/RestClient/compare/v2.6.1...v2.6.2
[2.6.1]: https://github.com/proyecto26/RestClient/compare/v2.6.0...v2.6.1
[2.6.0]: https://github.com/proyecto26/RestClient/compare/v2.5.9...v2.6.0
[2.5.9]: https://github.com/proyecto26/RestClient/compare/2.5.7...v2.5.9
Expand Down
92 changes: 92 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Contributing

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.

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.

## Code of Conduct

### Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

### Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
63 changes: 56 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![Made with Unity](https://img.shields.io/badge/Made%20with-Unity-57b9d3.svg?style=flat&logo=unity)](https://assetstore.unity.com/publishers/32542)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![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)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/proyecto26/RestClient/graphs/commit-activity)
[![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)
[![Build Status](https://travis-ci.org/proyecto26/RestClient.svg?branch=master)](https://travis-ci.org/proyecto26/RestClient)
Expand Down Expand Up @@ -55,6 +54,7 @@ RestClient.GetArray<Post>(api + "/posts").Then(response => {
- Handle HTTP exceptions in a better way
- Retry HTTP requests easily
- Open Source 🦄
- Utility to work during scene transition

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

### Nuget package
### UPM package
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`

### NuGet package
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:

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

## Handling during scene transition
```csharp
ExecuteOnMainThread.RunOnMainThread.Enqueue(() => {
//Any API call using RestClient
});
```

### Generic Request Method
And we have a generic method to create any type of request:
```csharp
Expand All @@ -137,7 +147,9 @@ RestClient.Request(new RequestHelper {
ContentType = "application/json", //JSON is used by default
Retries = 3, //Number of retries
RetrySecondsDelay = 2, //Seconds of delay to make a retry
RetryCallbackOnlyOnNetworkErrors = true, //Invoke RetryCallack only when the retry is provoked by a network error
RetryCallback = (err, retries) => {}, //See the error before retrying the request
ProgressCallback = (percent) => {}, //Reports progress of the request from 0 to 1
EnableDebug = true, //See logs of the requests for debug mode
IgnoreHttpException = true, //Prevent to catch http exceptions
ChunkedTransfer = false,
Expand All @@ -152,6 +164,9 @@ RestClient.Request(new RequestHelper {
AssetBundle assetBundle = ((DownloadHandlerAssetBundle)response.Request.downloadHandler).assetBundle;

EditorUtility.DisplayDialog("Status", response.StatusCode.ToString(), "Ok");
}).Catch(err => {
var error = err as RequestException;
EditorUtility.DisplayDialog("Error Response", error.Response, "Ok");
});
```

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

Additionally we can run a callback function whenever a progress change happens!
```csharp
RestClient.Get(new RequestHelper {
Uri = "https://jsonplaceholder.typicode.com/users",
ProgressCallback = percent => Debug.Log(percent)
});
```

Later we can clear the default headers and params for all requests
```csharp
RestClient.ClearDefaultHeaders();
Expand Down Expand Up @@ -295,19 +318,42 @@ router.post('/', function(req, res) {
});
```

## Collaborators 🥇
## Credits 👍
* **C-Sharp-Promise:** [Promises library for C# for management of asynchronous operations.](https://github.com/Real-Serious-Games/C-Sharp-Promise)
* **MyAPI:** [A template to create awesome APIs easily ⚡️](https://github.com/proyecto26/MyAPI)

## Contributing ✨
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.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.
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).

## Contributors ✨
Please do contribute! Issues and pull requests are welcome.

### Code Contributors

This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].

[![](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)

### Collaborators
<!-- COLLABORATORS-LIST:START - Do not remove or modify this section -->
[<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) |
:---: | :---: | :---: |
[Juan Nicholls](mailto:[email protected]) | [Diego Ossa](mailto:[email protected]) | [Nasdull](mailto:[email protected]) |

## Credits 👍
* **Promises library for C#:** [Real Serious Games/C-Sharp-Promise](https://github.com/Real-Serious-Games/C-Sharp-Promise)
<!-- COLLABORATORS-LIST:END -->

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

Any good review from the [Unity Store](https://assetstore.unity.com/packages/tools/network/rest-client-for-unity-102501) is also really appreciated!
Donate **Ethereum**, **ADA**, **BNB**, **SHIBA**, **USDT**, **DOGE**:

![Wallet address](https://user-images.githubusercontent.com/2154886/123501719-84bf1900-d60c-11eb-882c-98a499cea323.png)

> Wallet address: 0x3F9fA8021B43ACe578C2352861Cf335449F33427
Please let us know your contributions! 🙏

## Enterprise 💼

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

## License ⚖️
This repository is available under the [MIT License](https://github.com/proyecto26/RestClient/blob/develop/LICENSE).

## Happy coding 💯
Made with ❤️

Expand Down
Binary file modified doc/RestClient.docx
Binary file not shown.
Binary file added doc/RestClient.pages
Binary file not shown.
Binary file modified doc/RestClient.pdf
Binary file not shown.
Binary file added img/rest-client.tif
Binary file not shown.
Binary file added img/rest-client_banner.tif
Binary file not shown.
6 changes: 5 additions & 1 deletion src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ artifacts/
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
Expand All @@ -73,6 +72,11 @@ artifacts/
*.svclog
*.scc

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Chutzpah Test files
_Chutzpah*

Expand Down
9 changes: 9 additions & 0 deletions src/Proyecto26.RestClient/Helpers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/Proyecto26.RestClient/Helpers/Common.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

Expand Down Expand Up @@ -78,10 +77,10 @@ private static void ConfigureWebRequestWithOptions(UnityWebRequest request, byte
/// <summary>
/// Send the web request to the server
/// </summary>
/// <returns>An UnityWebRequestAsyncOperation object.</returns>
/// <returns>An AsyncOperation object.</returns>
/// <param name="request">An UnityWebRequest object.</param>
/// <param name="options">An options object.</param>
public static IEnumerator SendWebRequestWithOptions(this UnityWebRequest request, RequestHelper options)
public static AsyncOperation SendWebRequestWithOptions(this UnityWebRequest request, RequestHelper options)
{
byte[] bodyRaw = options.BodyRaw;
string contentType = string.Empty;
Expand Down Expand Up @@ -119,9 +118,9 @@ public static IEnumerator SendWebRequestWithOptions(this UnityWebRequest request

ConfigureWebRequestWithOptions(request, bodyRaw, contentType, options);
#if UNITY_2017_2_OR_NEWER
yield return request.SendWebRequest();
return request.SendWebRequest();
#else
yield return request.Send();
return request.Send();
#endif
}
}
Expand Down
Loading

0 comments on commit 712b78c

Please sign in to comment.