repository

package
v0.0.0-...-079c800 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIFixtureRepository

type APIFixtureRepository interface {
	// Get Content data by id
	Get(
		method types.MethodType,
		name string,
		path string,
	) ([]byte, error)

	// GetFixtureNames returns list of fixture names for given Method and Path
	GetFixtureNames(
		method types.MethodType,
		path string) (names []string, err error)

	// Save Content data
	Save(
		method types.MethodType,
		name string,
		path string,
		contents []byte) (err error)

	// Delete removes a content data
	Delete(
		method types.MethodType,
		name string,
		path string,
	) error
}

APIFixtureRepository defines data store for content for mocking purpose

type APIScenarioRepository

type APIScenarioRepository interface {
	// HistoryNames returns list of api scenarios names
	HistoryNames(group string) []string

	// SaveHistory saves history APIScenario
	SaveHistory(
		scenario *types.APIScenario,
		url string,
		started time.Time,
		ended time.Time,
	) (err error)

	// LoadHistory loads HAR file for the executed history
	LoadHistory(name string, group string, page int, limit int) ([]*types.APIScenario, error)

	// GetGroups returns api scenarios groups
	GetGroups() []string

	// GetScenariosNames returns api scenarios for given Method and Path
	GetScenariosNames(
		method types.MethodType,
		path string) ([]string, error)

	// SaveRaw saves raw data assuming to be yaml format
	SaveRaw(input io.ReadCloser) (err error)

	// SaveYaml saves as yaml data
	SaveYaml(key *types.APIKeyData, payload []byte) (err error)

	// LoadRaw loads matching scenario
	LoadRaw(method types.MethodType, name string, path string) (b []byte, err error)

	// Save APIScenario
	Save(scenario *types.APIScenario) (err error)

	// Delete removes a api scenario
	Delete(
		method types.MethodType,
		scenarioName string,
		path string) error

	// LookupAll finds matching scenarios
	LookupAll(key *types.APIKeyData) ([]*types.APIKeyData, int, int, error)

	// LookupAllByGroup finds matching scenarios by group
	LookupAllByGroup(group string) []*types.APIKeyData

	// LookupAllByPath finds matching scenarios by path
	LookupAllByPath(path string) []*types.APIKeyData

	// Lookup finds top matching scenario that hasn't been used recently
	Lookup(target *types.APIKeyData, data map[string]any) (*types.APIScenario, error)

	// ListScenarioKeyData returns keys for all scenarios
	ListScenarioKeyData(group string) []*types.APIKeyData
}

APIScenarioRepository defines data store for api-scenarios

type FileAPIScenarioRepository

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

FileAPIScenarioRepository implements API scenario storage based on local files

func NewFileAPIScenarioRepository

func NewFileAPIScenarioRepository(
	config *types.Configuration,
) (repo *FileAPIScenarioRepository, err error)

NewFileAPIScenarioRepository creates new instance for api scenarios

func (*FileAPIScenarioRepository) Delete

func (sr *FileAPIScenarioRepository) Delete(
	method types.MethodType,
	scenarioName string,
	path string) error

Delete removes a job

func (*FileAPIScenarioRepository) GetGroups

func (sr *FileAPIScenarioRepository) GetGroups() (res []string)

GetGroups returns api scenarios groups

func (*FileAPIScenarioRepository) GetScenariosNames

func (sr *FileAPIScenarioRepository) GetScenariosNames(
	method types.MethodType,
	path string) (scenarioNames []string, err error)

GetScenariosNames returns api scenarios for given Method and Path

func (*FileAPIScenarioRepository) HistoryNames

func (sr *FileAPIScenarioRepository) HistoryNames(group string) (names []string)

HistoryNames returns list of API scenarios names

func (*FileAPIScenarioRepository) ListScenarioKeyData

func (sr *FileAPIScenarioRepository) ListScenarioKeyData(group string) []*types.APIKeyData

ListScenarioKeyData returns keys for all scenarios

func (*FileAPIScenarioRepository) LoadHistory

func (sr *FileAPIScenarioRepository) LoadHistory(
	name string,
	group string,
	page int,
	limit int) (scenarios []*types.APIScenario, err error)

LoadHistory loads scenario

func (*FileAPIScenarioRepository) LoadRaw

func (sr *FileAPIScenarioRepository) LoadRaw(
	method types.MethodType,
	name string,
	path string,
) (b []byte, err error)

LoadRaw loads matching scenario

func (*FileAPIScenarioRepository) Lookup

func (sr *FileAPIScenarioRepository) Lookup(
	other *types.APIKeyData,
	inData map[string]any) (scenario *types.APIScenario, err error)

Lookup finds top matching scenario

func (*FileAPIScenarioRepository) LookupAll

func (sr *FileAPIScenarioRepository) LookupAll(
	other *types.APIKeyData,
) (res []*types.APIKeyData, paramMismatchErrors int, keyDataLen int, lastErr error)

LookupAll finds matching scenarios

func (*FileAPIScenarioRepository) LookupAllByGroup

func (sr *FileAPIScenarioRepository) LookupAllByGroup(
	group string) []*types.APIKeyData

LookupAllByGroup finds matching scenarios by group

func (*FileAPIScenarioRepository) LookupAllByPath

func (sr *FileAPIScenarioRepository) LookupAllByPath(path string) []*types.APIKeyData

LookupAllByPath finds matching scenarios by path

func (*FileAPIScenarioRepository) Save

func (sr *FileAPIScenarioRepository) Save(
	scenario *types.APIScenario) (err error)

Save APIScenario

func (*FileAPIScenarioRepository) SaveHistory

func (sr *FileAPIScenarioRepository) SaveHistory(
	scenario *types.APIScenario,
	url string,
	started time.Time,
	ended time.Time,
) (err error)

SaveHistory saves history APIScenario

func (*FileAPIScenarioRepository) SaveRaw

func (sr *FileAPIScenarioRepository) SaveRaw(input io.ReadCloser) (err error)

SaveRaw saves raw data assuming to be yaml format

func (*FileAPIScenarioRepository) SaveYaml

func (sr *FileAPIScenarioRepository) SaveYaml(keyData *types.APIKeyData, payload []byte) (err error)

SaveYaml saves APIScenario as yaml format

type FileGroupConfigRepository

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

FileGroupConfigRepository implements storage for contents using local files

func NewFileGroupConfigRepository

func NewFileGroupConfigRepository(
	config *types.Configuration,
) (*FileGroupConfigRepository, error)

NewFileGroupConfigRepository creates new instance for GroupConfigRepository

func (*FileGroupConfigRepository) Delete

func (gcr *FileGroupConfigRepository) Delete(name string) error

Delete removes an GroupConfig spec

func (*FileGroupConfigRepository) Load

Load loads GroupConfig spec

func (*FileGroupConfigRepository) Save

func (gcr *FileGroupConfigRepository) Save(name string, gc *types.GroupConfig) (err error)

Save saves GroupConfig spec

func (*FileGroupConfigRepository) Variables

func (gcr *FileGroupConfigRepository) Variables(name string) map[string]string

Variables returns variables for given name

type FileMockFixtureRepository

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

FileMockFixtureRepository implements storage for contents using local files

func NewFileFixtureRepository

func NewFileFixtureRepository(
	config *types.Configuration,
) (*FileMockFixtureRepository, error)

NewFileFixtureRepository creates new instance for content repository

func (*FileMockFixtureRepository) Delete

func (cr *FileMockFixtureRepository) Delete(
	method types.MethodType,
	name string,
	path string) error

Delete removes a job

func (*FileMockFixtureRepository) Get

func (cr *FileMockFixtureRepository) Get(
	method types.MethodType,
	name string,
	path string) ([]byte, error)

Get contents by id

func (*FileMockFixtureRepository) GetFixtureNames

func (cr *FileMockFixtureRepository) GetFixtureNames(
	method types.MethodType,
	path string) (names []string, err error)

GetFixtureNames returns list of fixture names for given Method and Path

func (*FileMockFixtureRepository) Save

func (cr *FileMockFixtureRepository) Save(
	method types.MethodType,
	name string,
	path string,
	content []byte) error

Save contents

type FileOAPIRepository

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

FileOAPIRepository implements storage for contents using local files

func NewFileOAPIRepository

func NewFileOAPIRepository(
	config *types.Configuration,
) (*FileOAPIRepository, error)

NewFileOAPIRepository creates new instance for OAPIRepository

func (*FileOAPIRepository) Delete

func (or *FileOAPIRepository) Delete(name string) error

Delete removes an OAPI spec

func (*FileOAPIRepository) GetNames

func (or *FileOAPIRepository) GetNames() (names []string)

GetNames returns list of open-api spec names

func (*FileOAPIRepository) Load

func (or *FileOAPIRepository) Load(name string) (*openapi3.T, error)

Load loads OAPI spec

func (*FileOAPIRepository) LoadRaw

func (or *FileOAPIRepository) LoadRaw(name string) (b []byte, err error)

LoadRaw loads raw spec

func (*FileOAPIRepository) Save

func (or *FileOAPIRepository) Save(name string, t *openapi3.T) (err error)

Save saves OAPI spec

func (*FileOAPIRepository) SaveRaw

func (or *FileOAPIRepository) SaveRaw(name string, data []byte) (err error)

SaveRaw saves raw spec

type GroupConfigRepository

type GroupConfigRepository interface {
	// Variables returns variables for given name
	Variables(name string) map[string]string

	// Save saves group config
	Save(name string, gc *types.GroupConfig) (err error)

	// Load loads group config
	Load(name string) (*types.GroupConfig, error)

	// Delete removes group config
	Delete(name string) error
}

GroupConfigRepository defines data store for group config

type OAPIRepository

type OAPIRepository interface {
	// GetNames returns list of open-api spec names
	GetNames() []string

	// Save saves OAPI spec
	Save(name string, t *openapi3.T) (err error)

	// Load loads OAPI spec
	Load(name string) (*openapi3.T, error)

	// SaveRaw saves raw spec
	SaveRaw(name string, data []byte) (err error)

	// LoadRaw loads raw spec
	LoadRaw(name string) (b []byte, err error)

	// Delete removes an OAPI spec
	Delete(name string) error
}

OAPIRepository defines data store for OpenAPI specs

Jump to

Keyboard shortcuts

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