replicated

package
v0.0.0-...-c12b17c Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewRequest = func(method string, url string, payload io.Reader) (res *http.Request, err error) {
	return http.NewRequest(method, url, payload)
}
View Source
var ReadFile = func(r io.Reader) ([]byte, error) {
	return io.ReadAll(r)
}

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	AppID       string `json:"appId"`
	AppSlug     string `json:"appSlug"`
	AppName     string `json:"appName"`
	ChannelSlug string `json:"channelSlug"`
}

type Customer

type Customer struct {
	ID             string    `json:"id"`
	TeamID         string    `json:"teamId"`
	Name           string    `json:"name"`
	Email          string    `json:"email"`
	CustomID       string    `json:"customId"`
	ExpiresAt      string    `json:"expiresAt"`
	CustomerType   string    `json:"type"`
	Airgap         bool      `json:"airgap"`
	InstallationId string    `json:"installationId"`
	Channels       []Channel `json:"channels"`
}

type CustomerSearchResponse

type CustomerSearchResponse struct {
	Query     string     `json:"query"`
	TotalHits int        `json:"total_hits"`
	Customers []Customer `json:"customers"`
}

type EntitlementValues

type EntitlementValues struct {
	IsDefault bool   `json:"isDefault"`
	Name      string `json:"name"`
	Value     string `json:"value"`
}

type GetCustomerResponse

type GetCustomerResponse struct {
	Customer Customer `json:"customer"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type IReplicated

type IReplicated interface {
	SearchCustomersByEmail(email string, requestId string) (customers []Customer, err error)
	GetDowloadUrl(customer Customer, requestId string) (url string, err error)
	DownloadFromReplicated(url, requestId, authorization string) (res *http.Response, err error)
}

func NewReplicatedImpl

func NewReplicatedImpl(config config.ReplicatedConfig, logger logger.Logger) IReplicated

type MockReplicated

type MockReplicated struct {
	SearchCustomersByEmailFunc func(email string, requestId string) (customers []Customer, err error)
	GetDowloadUrlFunc          func(customer Customer, requestId string) (url string, err error)
	DownloadFromReplicatedFunc func(url, requestId, authorization string) (res *http.Response, err error)
}

func (MockReplicated) DownloadFromReplicated

func (m MockReplicated) DownloadFromReplicated(url, requestId, authorization string) (res *http.Response, err error)

func (MockReplicated) GetDowloadUrl

func (m MockReplicated) GetDowloadUrl(customer Customer, requestId string) (url string, err error)

func (MockReplicated) SearchCustomersByEmail

func (m MockReplicated) SearchCustomersByEmail(email string, requestId string) (customers []Customer, err error)

type ReplicatedImpl

type ReplicatedImpl struct {
	ReplicatedConfig config.ReplicatedConfig
	Client           HTTPClient
	Logger           logger.Logger
}

func (ReplicatedImpl) DownloadFromReplicated

func (r ReplicatedImpl) DownloadFromReplicated(url, requestId, authorization string) (res *http.Response, err error)

func (*ReplicatedImpl) GetDowloadUrl

func (r *ReplicatedImpl) GetDowloadUrl(customer Customer, requestId string) (url string, err error)

func (ReplicatedImpl) SearchCustomersByEmail

func (r ReplicatedImpl) SearchCustomersByEmail(email string, requestId string) (customers []Customer, err error)

Jump to

Keyboard shortcuts

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