RestUtilities Class

Summary

Contains utilities for interaction with RestSharp
Assembly
Cake.Rest.dll
Namespace
Cake.Rest
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["RestUtilities"] class Type type-node

Syntax

public static class RestUtilities

Methods

Name Value Summary
GetBodyContentType(BodyType) string
Returns MIME Type string for given BodyType (used for requests with a body of type "string").
static
GetClientInstance(string, bool, bool) IRestClient
Gets an instance of from Cake.Rest.RestUtilities.Clients, or instantiates a new one if not found in the dictionary. Then, configures it for buffered/non-buffered read and write, forces the use of Newtonsoft.Json as serializer, and returns the object.
static
GetFileParam(string, Stream, string) FileParameter
Creates RestSharp.FileParameter instance for use with AddFile.
static
GetHost(Uri) string
Returns the left part (Authority) of URI given to it.
static
GetRequest(string, Uri, IDictionary<string, string>) IRestRequest
Creates and configures an instance of RestSharp.RestRequest.
static

Extension Methods

Name Value Summary
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin