importer

package
v0.0.0-...-c835f56 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entrie

type Entrie struct {
	Publisher    Publisher     `json:"publisher"`
	Publications []Publication `json:"publications"`
}

Entrie is one record in file, representing publisher and its publications

type ImportError

type ImportError struct {
	Publisher   Publisher
	Publication Publication
	Error       error
}

func (*ImportError) String

func (e *ImportError) String() string

type Importer

type Importer struct {
	APIClient PublicationsAPIClient
}

func (*Importer) RunImport

func (ip *Importer) RunImport(bytes []byte) error

Actual importer

type Publication

type Publication struct {
	Name         string `json:"name"`
	Description  string `json:"description"`
	LanguageCode string `json:"language_code"`
	Type         string `json:"type"`
	// Config content is different for different publication types.
	// when parsing, we decide on Type
	Config PublicationConfig `json:"config"`
}

type PublicationConfig

type PublicationConfig interface{}

PublicationConfig is used to pass around different config structs

type PublicationsAPIClient

type PublicationsAPIClient interface {
	CreatePublisher(ctx context.Context, name string, url string) (entity.Publisher, error)
	CreatePublication(ctx context.Context, name string, description string, languageCode string, publisherUUID uuid.UUID, publicationType string, config interface{}) (entity.Publication, error)
}

type Publisher

type Publisher struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

Jump to

Keyboard shortcuts

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