Search Results for

    Show / Hide Table of Contents

    Class ClientUtils

    Utility functions providing some benefit to API client consumers.

    Inheritance
    object
    ClientUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: mailslurp.Client
    Assembly: mailslurp.dll
    Syntax
    public static class ClientUtils

    Fields

    View Source

    JsonRegex

    Provides a case-insensitive check that a provided content type is a known JSON-like content type.

    Declaration
    public static readonly Regex JsonRegex
    Field Value
    Type Description
    Regex

    Methods

    View Source

    Base64Encode(string)

    Encode string in base64 format.

    Declaration
    public static string Base64Encode(string text)
    Parameters
    Type Name Description
    string text

    string to be encoded.

    Returns
    Type Description
    string

    Encoded string.

    View Source

    IsJsonMime(string)

    Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json

    Declaration
    public static bool IsJsonMime(string mime)
    Parameters
    Type Name Description
    string mime

    MIME

    Returns
    Type Description
    bool

    Returns True if MIME type is json.

    View Source

    ParameterToMultiMap(string, string, object)

    Convert params to key/value pairs. Use collectionFormat to properly format lists and collections.

    Declaration
    public static Multimap<string, string> ParameterToMultiMap(string collectionFormat, string name, object value)
    Parameters
    Type Name Description
    string collectionFormat

    The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi

    string name

    Key name.

    object value

    Value object.

    Returns
    Type Description
    Multimap<string, string>

    A multimap of keys with 1..n associated values.

    View Source

    ParameterToString(object, IReadableConfiguration)

    If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. If parameter is a list, join the list with ",". Otherwise just return the string.

    Declaration
    public static string ParameterToString(object obj, IReadableConfiguration configuration = null)
    Parameters
    Type Name Description
    object obj

    The parameter (header, path, query, form).

    IReadableConfiguration configuration

    An optional configuration instance, providing formatting options used in processing.

    Returns
    Type Description
    string

    Formatted string.

    View Source

    ReadAsBytes(Stream)

    Convert stream to byte array

    Declaration
    public static byte[] ReadAsBytes(Stream inputStream)
    Parameters
    Type Name Description
    Stream inputStream

    Input stream to be converted

    Returns
    Type Description
    byte[]

    Byte array

    View Source

    SanitizeFilename(string)

    Sanitize filename by removing the path

    Declaration
    public static string SanitizeFilename(string filename)
    Parameters
    Type Name Description
    string filename

    Filename

    Returns
    Type Description
    string

    Filename

    View Source

    SelectHeaderAccept(string[])

    Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)

    Declaration
    public static string SelectHeaderAccept(string[] accepts)
    Parameters
    Type Name Description
    string[] accepts

    The accepts array to select from.

    Returns
    Type Description
    string

    The Accept header to use.

    View Source

    SelectHeaderContentType(string[])

    Select the Content-Type header's value from the given content-type array: if JSON type exists in the given array, use it; otherwise use the first one defined in 'consumes'

    Declaration
    public static string SelectHeaderContentType(string[] contentTypes)
    Parameters
    Type Name Description
    string[] contentTypes

    The Content-Type array to select from.

    Returns
    Type Description
    string

    The Content-Type header to use.

    View Source

    Serialize(object)

    Serializes the given object when not null. Otherwise return null.

    Declaration
    public static string Serialize(object obj)
    Parameters
    Type Name Description
    object obj

    The object to serialize.

    Returns
    Type Description
    string

    Serialized string.

    • View Source
    In This Article
    Back to top See MailSlurp website for more information.