Skip to content

masterprompt/ApiBoss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Boss

Get downloadable unity package here

Unity API Library

Simplifies using UnityWebRequest by providing a fluent interface for common API client needs. Some basic examples are included in the example scene which uses a Testing API.

Tested with:

Unity Version Status
2018.1.3f1 OK

How to

Here's some code using API Boss

Getting a resource

    Request
        .Get("https://jsonplaceholder.typicode.com/posts/1")
        .OnJsonResponse<JsonResponse>(OnResponse)
        .Send();

Posting a resource

    Request
        .Post("https://jsonplaceholder.typicode.com/posts")
        .SetJsonPayload(payload)
        .OnJsonResponse<JsonResponse>(OnResponse)
        .SetHeader("Content-type","application/json; charset=UTF-8")
        .Send();

Note: the resource will not be really created on the server but it will be faked as if.

Putting a resource

    Request
        .Put("https://jsonplaceholder.typicode.com/posts/1")
        .SetJsonPayload(payload)
        .OnJsonResponse<JsonResponse>(OnResponse)
        .SetHeader("Content-type","application/json; charset=UTF-8")
        .Send();

Note: the resource will not be really updated on the server but it will be faked as if.

Deleting a resource

    Request
        .Delete("https://jsonplaceholder.typicode.com/posts/1")
        .OnError(Helpers.LogError)
        .OnResponse(Helpers.LogResponse)
        .Send();

Operations

TBD

About

Unity API Client Library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages