upsert

package
v0.0.0-...-c800da7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package upsert contains the logic to send the upsert request to the API

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidResponse is returned when the Search API returns a non 200 status
	ErrInvalidResponse = errors.New("invalid status returned by search.api.ch.gov.uk")
)

Functions

This section is empty.

Types

type APIUpsert

type APIUpsert struct {
	HTTPClient                      *http.Client
	AlphabeticalUpsertCompanyAPIUrl string
	AdvancedUpsertCompanyAPIUrl     string
}

Template config contains recipient address, http client and send email endpoint

func (*APIUpsert) SendViaAPI

func (upsert *APIUpsert) SendViaAPI(data string, apiKey string) error

SendViaAPI makes a call to the search.api.ch.gov.uk and passes it the required data for upserting to alpha_search index

type CompanyProfileDelta

type CompanyProfileDelta struct {
	CompanyNumber string `json:"company_number"`
}

Company profile delta data json contains fields such as company_number

type MockUpsert

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

MockUpsert is a mock of Upsert interface

func NewMockUpsert

func NewMockUpsert(ctrl *gomock.Controller) *MockUpsert

NewMockUpsert creates a new mock instance

func (*MockUpsert) EXPECT

func (m *MockUpsert) EXPECT() *MockUpsertMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUpsert) SendViaAPI

func (m *MockUpsert) SendViaAPI(data string, apiKey string) error

SendViaAPI mocks base method

type MockUpsertMockRecorder

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

MockUpsertMockRecorder is the mock recorder for MockUpsert

func (*MockUpsertMockRecorder) SendViaAPI

func (mr *MockUpsertMockRecorder) SendViaAPI(data interface{}) *gomock.Call

SendViaAPI indicates an expected call of SendViaAPI

type Upsert

type Upsert interface {
	// SendViaAPI provides ability to post to search api
	SendViaAPI(data string, apiKey string) error
}

Upsert is an interface for calling api to upsert data to an elastic search index

Jump to

Keyboard shortcuts

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