restapi

package
v0.0.0-...-ed5f25b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAPIResponse

type BaseAPIResponse struct {
	Success bool `json:"success"`
	Result  json.RawMessage
	Message string
}

BaseAPIResponse represents the most basic standard Centrify API response,

where Result itself is left as raw json

type BoolResponse

type BoolResponse struct {
	BaseAPIResponse
	Result bool
}

type GenericMapResponse

type GenericMapResponse struct {
	BaseAPIResponse
	Result map[string]interface{}
}

GenericMapResponse represents Centrify API responses where results are map[string]interface{},

this type allows direct access to these without further decoding.

type HttpClientFactory

type HttpClientFactory func() *http.Client

type HttpError

type HttpError struct {
	StatusCode int // HTTP status
	// contains filtered or unexported fields
}

type RestClient

type RestClient struct {
	Service         string
	Client          *http.Client
	Headers         map[string]string
	SourceHeader    string
	ResponseHeaders http.Header
}

RestClient represents a stateful API client (cookies maintained between calls, single service etc)

func GetNewRestClient

func GetNewRestClient(service string, httpFactory HttpClientFactory) (*RestClient, error)

GetNewRestClient creates a new RestClient for the specified endpoint. If a factory for creating

http.Client's is not provided, you'll get a new: &http.Client{}.

func (*RestClient) CallBaseAPI

func (r *RestClient) CallBaseAPI(method string, args map[string]interface{}) (*BaseAPIResponse, error)

func (*RestClient) CallBoolAPI

func (r *RestClient) CallBoolAPI(method string, args map[string]interface{}) (*BoolResponse, error)

func (*RestClient) CallGenericMapAPI

func (r *RestClient) CallGenericMapAPI(method string, args map[string]interface{}) (*GenericMapResponse, error)

func (*RestClient) CallRawAPI

func (r *RestClient) CallRawAPI(method string, args map[string]interface{}) ([]byte, error)

func (*RestClient) CallStringAPI

func (r *RestClient) CallStringAPI(method string, args map[string]interface{}) (*StringResponse, error)

func (*RestClient) GetLastResponseHeaders

func (r *RestClient) GetLastResponseHeaders() http.Header

GetLastResponseHeaders returns the response headers from last REST call

type RestClientMode

type RestClientMode uint32

BackendType is the type of backend that is being implemented

type StringResponse

type StringResponse struct {
	BaseAPIResponse
	Result string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL