Skip to content

Check CallApi function with IHttpRequestHandler requestHandler and SimvaPlugin.Instance.RequestHandler instead of using UnityWebRequest #20

Description

@jujusb
    /// TODO CHECK WITH IHttpRequestHandler requestHandler instead using SimvaPlugin.Instance.RequestHandler
    public IAsyncOperation<UnityWebRequest> CallApi(String path, string method, Dictionary<String, String> queryParams, String postBody,
        Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
        Dictionary<String, String> fileParams, String[] authSettings, bool inBackground = false)
    {
        UnityWebRequest request = null;
        var result = new AsyncCompletionSource<UnityWebRequest>();
        switch (method){
            case UnityWebRequest.kHttpVerbGET:
                request = UnityWebRequest.Get(BasePath + path);
                break;
            case UnityWebRequest.kHttpVerbPOST:
                request = UnityWebRequest.Post(BasePath + path, formParams);
                break;
            case UnityWebRequest.kHttpVerbPUT:
                request = UnityWebRequest.Put(BasePath + path, postBody);
                break;
            case UnityWebRequest.kHttpVerbDELETE:
                request = UnityWebRequest.Delete(BasePath + path);
                break;
            default:
                throw new ApiException(500, "Method not available: " + method);
        }

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status
To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions