Documentation
¶
Overview ¶
Package parser implements the w_popularity stackoverflow adapter using the Stack Exchange API v2.3.
Endpoints used (all GET, JSON):
- /users/{id}?site=stackoverflow
- /users/{id}/answers?site=stackoverflow&order=desc&sort=creation&pagesize=50
- /users/{id}/questions?site=stackoverflow&order=desc&sort=creation&pagesize=50
No authentication required. An optional Config.AppKey ("key" query parameter) raises the daily quota from 300 to 10000 requests.
Handle format used by w_popularity: "<userid>/<slug>" e.g. "937966/eugen-soloviov". Only the leading numeric id is sent to the API; the slug is human-readable and ignored for API calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// AppKey is the optional "key" query parameter that boosts quota to 10k/day.
// Leave empty to use the 300/day anonymous quota.
AppKey string
// HTTPClient lets tests inject a custom transport.
HTTPClient *http.Client
// HTTPTimeout caps every outbound call. Default 15s.
HTTPTimeout time.Duration
}
Config controls runtime behaviour.
type StackOverflowParser ¶
type StackOverflowParser struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg Config) *StackOverflowParser
New constructs a StackOverflowParser ready for use.
func (*StackOverflowParser) FetchChannel ¶
func (p *StackOverflowParser) FetchChannel(ctx context.Context, handle string) (shared.ChannelSnapshot, error)
FetchChannel returns one snapshot for the user identified by handle.
handle may be either a bare numeric id ("937966") or the canonical "<userid>/<slug>" form used in w_popularity. The slug is ignored.
func (*StackOverflowParser) FetchRecentPosts ¶
func (p *StackOverflowParser) FetchRecentPosts(ctx context.Context, handle string, since time.Time) ([]shared.PostSnapshot, error)
FetchRecentPosts returns answers + questions authored by user `handle` whose creation_date >= since. Newest-first.
func (*StackOverflowParser) Platform ¶
func (p *StackOverflowParser) Platform() shared.Platform