trialdownloader

package
v0.0.0-...-0048e3d Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDataOnPage = errors.New("can't find trial data")
)

Functions

func MutableValues

func MutableValues[Slice ~[]E, E any](s Slice) iter.Seq[*E]

func SaveJson

func SaveJson[T any](filename string, data T) error

Types

type AppType

type AppType string
const (
	AppTypeV1                 AppType = "V1:url/wokanda,I"
	AppTypeV3LogonetBydgoszcz AppType = "V3:logonet-bydgoszcz-okreg"
)

func Detect

func Detect(ctx context.Context, client *http.Client, baseUrl string) (result []AppType)

type CourtData

type CourtData struct {
	Domain   string    `json:"domain"`
	AppTypes []AppType `json:"app_types"`
}

func DetectBulk

func DetectBulk(ctx context.Context, client *http.Client, domains []string) []CourtData

func LoadCourtsData

func LoadCourtsData(filename string) ([]CourtData, error)

type DownloadResult

type DownloadResult struct {
	CourtID string  `json:"court_id"`
	Err     string  `json:"err"`
	Trials  []Trial `json:"trials"`
	Date    string  `json:"date"`
	Fetch   fetch   `json:"fetch"`
}

func BulkDownload

func BulkDownload(ctx context.Context, client *http.Client, date string, courtData []CourtData) []DownloadResult

type Downloader

type Downloader interface {
	// Downloads all trials.
	//
	// date is string in format YYYY-MM-DD.
	Download(ctx context.Context, date string) ([]Trial, error)
}

func NewDownloader

func NewDownloader(client *http.Client, baseUrl string, appID string) Downloader

type Trial

type Trial struct {
	CaseID     string    `json:"case_id"`
	Department string    `json:"department"`
	Judges     []string  `json:"judges"`
	Date       time.Time `json:"date"`
	Room       string    `json:"room"`
}

func ParseV2

func ParseV2(data []byte) (trials []Trial, err error)

ParseV1 parses one page from type pages like "https://bialystok.sa.gov.pl/zalatw-sprawe/e-wokanda".

func SortTrials

func SortTrials(trials []Trial) []Trial

func (Trial) Compare

func (t Trial) Compare(other Trial) int

type V1Wokanda

type V1Wokanda commonDownloader

func NewV1Wokanda

func NewV1Wokanda(client *http.Client, baseUrl string) V1Wokanda

func (V1Wokanda) Download

func (d V1Wokanda) Download(ctx context.Context, date string) ([]Trial, error)

Downloads all trials. date is string in format YYYY-MM-DD.

type V2Wokanda

type V2Wokanda commonDownloader

func NewV2Wokanda

func NewV2Wokanda(client *http.Client, baseUrl string) V2Wokanda

func (V2Wokanda) Download

func (d V2Wokanda) Download(ctx context.Context, date string) ([]Trial, error)

Downloads all trials. date is string in format YYYY-MM-DD.

type V3Wokanda

type V3Wokanda commonDownloader

func NewV3Wokanda

func NewV3Wokanda(client *http.Client, baseUrl string) V3Wokanda

func (V3Wokanda) Download

func (d V3Wokanda) Download(ctx context.Context, date string) ([]Trial, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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