client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a struct for EPR Client configuration

func New

func New(url string) (*Client, error)

New returns a new instance of Client struct. Requires a URL to an instance of EPR. Use options functions for setting specific parameters.

func (*Client) CheckLiveness

func (c *Client) CheckLiveness() (bool, error)

CheckLiveness checks the EPRs liveness

func (*Client) CheckReadiness

func (c *Client) CheckReadiness() (bool, error)

CheckReadiness checks EPR readiness

func (*Client) CheckStatus

func (c *Client) CheckStatus() (string, error)

CheckStatus checks the EPRs Status

func (*Client) CreateEvent

func (c *Client) CreateEvent(e *storage.Event) (string, error)

CreateEvent used to create and Event

func (*Client) CreateEventReceiver

func (c *Client) CreateEventReceiver(er *storage.EventReceiver) (string, error)

CreateEventReceiver used to create an EventReceiver

func (*Client) CreateEventReceiverGroup

func (c *Client) CreateEventReceiverGroup(erg *storage.EventReceiverGroup) (string, error)

CreateEventReceiverGroup used to create an EventReceiverGroup

func (*Client) DoDelete

func (c *Client) DoDelete(endpoint string, payload []byte) (string, error)

DoDelete makes a DELETE request to the endpoint and returns the response

func (*Client) DoGet

func (c *Client) DoGet(endpoint string) (string, error)

DoGet makes a GET request to the endpoint and returns the response

func (*Client) DoPatch

func (c *Client) DoPatch(endpoint string, payload []byte) (string, error)

DoPatch makes a PATCH request to the endpoint and returns the response

func (*Client) DoPost

func (c *Client) DoPost(endpoint string, payload []byte) (string, error)

DoPost makes a POST request to the endpoint and returns the response

func (*Client) DoPut

func (c *Client) DoPut(endpoint string, payload []byte) (string, error)

DoPut makes a PUT request to the endpoint and returns the response

func (*Client) GetCurlSearch

func (c *Client) GetCurlSearch(operation string, params map[string]interface{}, fields []string) (string, error)

GetCurlSearch

func (*Client) GetEndpoint

func (c *Client) GetEndpoint(end string) (string, error)

GetEndpoint formats endoint url

func (*Client) ModifyEventReceiverGroup

func (c *Client) ModifyEventReceiverGroup(erg *storage.EventReceiverGroup) (string, error)

ModifyEventReceiverGroup takes a EventReceiverGroup object and updates the "Disabled" field in the EPR based on the EventReceiverGroup ID. This function returns a JSON blob with the ID of the EventReceiverGroup it modified.

func (*Client) Search

func (c *Client) Search(operation string, params map[string]interface{}, fields []string) (string, error)

Search searches for the given queryFor based on params

func (*Client) SearchEventReceiverGroups

func (c *Client) SearchEventReceiverGroups(params map[string]interface{}, fields []string) ([]storage.EventReceiverGroup, error)

func (*Client) SearchEventReceivers

func (c *Client) SearchEventReceivers(params map[string]interface{}, fields []string) ([]storage.EventReceiver, error)

func (*Client) SearchEvents

func (c *Client) SearchEvents(params map[string]interface{}, fields []string) ([]storage.Event, error)

type Contract

type Contract interface {
	CreateEvent(e *storage.Event) (string, error)
	CreateEventReceiver(er *storage.EventReceiver) (string, error)
	CreateEventReceiverGroup(erg *storage.EventReceiverGroup) (string, error)
	ModifyEventReceiverGroup(erg *storage.EventReceiverGroup) (string, error)
	Search(operation string, params map[string]interface{}, fields []string) (string, error)
	SearchEvents(params map[string]interface{}, fields []string) ([]storage.Event, error)
	SearchEventReceivers(params map[string]interface{}, fields []string) ([]storage.EventReceiver, error)
	SearchEventReceiverGroups(params map[string]interface{}, fields []string) ([]storage.EventReceiverGroup, error)
	CheckReadiness() (bool, error)
	CheckLiveness() (bool, error)
	CheckStatus() (string, error)
	GetEndpoint(end string) (string, error)
}

Contract handles communications with the EPR service

type GraphQLRequest

type GraphQLRequest struct {
	Query     string                 `json:"query"`
	Operation string                 `json:"operationName,omitempty"`
	Variables map[string]interface{} `json:"variables,omitempty"`
}

GraphQLRequest struct for graphql request

func NewGraphQLMutationRequest

func NewGraphQLMutationRequest(operation string, params map[string]interface{}) *GraphQLRequest

func NewGraphQLSearchRequest

func NewGraphQLSearchRequest(operation string, params map[string]interface{}, fields []string) *GraphQLRequest

NewGraphQLSearchRequest creates a new GraphQLRequest operation can be events or event_receivers or event_receiver_groups

type RespGraphQL

type RespGraphQL struct {
	Data struct {
		Events                   []storage.Event              `json:"events,omitempty"`
		EventReceivers           []storage.EventReceiver      `json:"event_receivers,omitempty"`
		EventReceiverGroups      []storage.EventReceiverGroup `json:"event_receiver_groups,omitempty"`
		CreateEvent              graphql.ID                   `json:"create_event,omitempty"`
		CreateEventReceiver      graphql.ID                   `json:"create_event_receiver,omitempty"`
		CreateEventReceiverGroup graphql.ID                   `json:"create_event_receiver_group,omitempty"`
	} `json:"data"`
	Errors interface{} `json:"errors,omitempty"`
}

RespGraphQL type is a struct that represents the response data from a GraphQL query

func DecodeGraphQLRespFromJSON

func DecodeGraphQLRespFromJSON(reader io.Reader) (*RespGraphQL, error)

The function `DecodeGraphQLRespFromJSON` decodes a JSON response into a `RespGraphQL` struct.

type Response

type Response struct {
	Data   interface{} `json:"data"`
	Errors interface{} `json:"errors,omitempty"`
}

Response type is a struct that represents a JSON response with a data field and an optional errors field.

func DecodeRespFromJSON

func DecodeRespFromJSON(reader io.Reader) (*Response, error)

DecodeRespFromJSON decodes a JSON input from a reader into a Response struct in Go.

Jump to

Keyboard shortcuts

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