Files
apex-public/internal/scan/types.go
T
2026-07-06 11:05:50 -04:00

103 lines
3.6 KiB
Go

package scan
// Job is a single posting discovered from a portal.
type Job struct {
Title string
URL string
Company string
Location string
Source string
}
// Company is a target scanned from adapters.yaml.
type Company struct {
Name string `yaml:"name"`
CareersURL string `yaml:"careers_url"`
API string `yaml:"api,omitempty"`
ScanMethod string `yaml:"scan_method,omitempty"`
ScanQuery string `yaml:"scan_query,omitempty"`
Enabled bool `yaml:"enabled"`
Notes string `yaml:"notes,omitempty"`
Workday *WorkdayConfig `yaml:"workday,omitempty"`
}
// WorkdayConfig holds tenant/site for Workday POST API.
type WorkdayConfig struct {
Host string `yaml:"host"`
Tenant string `yaml:"tenant"`
Site string `yaml:"site"`
}
// TitleFilter controls which job titles are accepted.
type TitleFilter struct {
Positive []string `yaml:"positive"`
Negative []string `yaml:"negative"`
SeniorityBoost []string `yaml:"seniority_boost,omitempty"`
}
// Aggregator is a broad-search job source (not tied to one company).
// Examples: Remotive keyword search, RemoteOK by tag, USAJobs keyword search,
// a generic RSS feed. The runner scans aggregators alongside TrackedCompanies.
type Aggregator struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // remotive | remoteok | usajobs | rss
Query string `yaml:"query,omitempty"` // keyword search (remotive, usajobs)
Tag string `yaml:"tag,omitempty"` // remoteok tag (e.g. "security")
Limit int `yaml:"limit,omitempty"` // results per call; default 50
URL string `yaml:"url,omitempty"` // rss feed URL
Company string `yaml:"company,omitempty"` // default company label for rss
APIKey string `yaml:"api_key,omitempty"` // USAJobs API key; env USAJOBS_API_KEY also honored
UserAgent string `yaml:"user_agent,omitempty"`
Enabled bool `yaml:"enabled"`
}
// Config is the scan configuration loaded from adapters.yaml.
type Config struct {
TitleFilter TitleFilter `yaml:"title_filter"`
TrackedCompanies []Company `yaml:"tracked_companies"`
Aggregators []Aggregator `yaml:"aggregators,omitempty"`
}
// AdapterType identifies the detected API kind.
type AdapterType string
const (
AdapterGreenhouse AdapterType = "greenhouse"
AdapterAshby AdapterType = "ashby"
AdapterLever AdapterType = "lever"
AdapterWorkday AdapterType = "workday"
AdapterBambooHR AdapterType = "bamboohr"
AdapterTeamtailor AdapterType = "teamtailor"
AdapterRemotive AdapterType = "remotive"
AdapterRemoteOK AdapterType = "remoteok"
AdapterUSAJobs AdapterType = "usajobs"
AdapterRSS AdapterType = "rss"
AdapterLinkedIn AdapterType = "linkedin"
AdapterUnknown AdapterType = "unknown"
)
// AdapterInfo is the resolved API endpoint for a company or aggregator.
// RSS and USAJobs populate the extra fields used during fetch (e.g. default
// company label, API key header). Zero values are fine for other adapters.
type AdapterInfo struct {
Type AdapterType
URL string
Host string
Site string
DefaultCompany string // rss: spliced into Job.Company when feed is generic
APIKey string // usajobs: Authorization-Key header
UserAgent string // usajobs + rss: optional UA override
}
// ScanResult is reported per-company as the runner progresses.
type ScanResult struct {
Company string
Found int
Filtered int
Duplicate int
New int
NewJobs []Job
Err error
DurationMs int64
}