Skip to content

Simple API Webrequest system for Unity

License

Notifications You must be signed in to change notification settings

NyanHeavy/Vangogh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vangogh

Simple API WebRequest system for Unity!

Goal

The goal of this repository is to make it easier to query text APIs using Unity.

🚧 Work in progress 🚧
Currently, this repository is in development.

Vangogh.Instance()
.GET(Url)
.WithGetResultAction((response) => { })
.Init();

See example of use: RequestManager.cs

Features

Use POST or GET easily

.POST(Url)
.GET(Url)

Custom Headers

.SetHeader("Header", "Value")
Vangogh.Instance()
.GET(Url)
.SetHeader("Authorization", "value")
.WithGetResultAction((response) => { })
.Init();

Supports as many headers as you need

Vangogh.Instance()
.GET(Url)
.SetHeader("Authorization", "value")
.SetHeader("Content-Type", "value")
.SetHeader("Any-Header-Name", "value")
.WithGetResultAction((response) => { })
.Init();

Easy debugging

.SetEnableLog()

Request Body

.SetBody("value")
Vangogh.Instance()
.GET(Url)
.SetBody("some-value")
.WithGetResultAction((response) => { })
.Init();

Reconnection Attempts

Sets the maximum number of attempts before terminating

.SetAttempts(int)

You can also set the time between attempts

.SetAttemptsDelay(float)
Vangogh.Instance()
.GET(Url)
.SetAttempts(3)
.SetAttemptsDelay(5f)
.WithGetResultAction((response) => { })
.Init();

Control Instances

Using single instance will terminating existing process with current url

.UseSingleInstance()

Actions

//Called when the process is started
.WithStartAction(() => { })

//Called when the process encounters an error
.WithErrorAction(() => { })

//Called when the process is done with results
.WithGetResultAction((response) => { })

Also:

  • Supports native GET & POST
  • Custom Headers.
  • Custom Body.

Supporting Platforms

  • Standalone Builds ✔
  • Android ✔
  • iOS (maybe)
  • WebGl ✔

Usage

Open Vangogh/Assets in unity or import the UnityPackage to your existing project or just copy Vangogh.cs and past in your project. Add the namespace to your scripts:

using NyanHeavyStudios.Vangogh;

THIRDPARTY

▶ Based on Davinci structure by Shamsdev

License

Vangogh is available under the MIT license. See the LICENSE file for more info.