Documentation
¶
Overview ¶
Package stackoverflow wraps the public Stack Exchange Data API (api.stackexchange.com) to surface a contributor's Stack Overflow reputation as a cross-platform credibility signal. Discovery flow: the contributor's GitHub profile (bio or blog) declares a stackoverflow.com/users/{id}/{slug} link → we extract the user ID → the SE API returns reputation, badges, and account metadata.
SE rate limits: 300 requests/day per IP unauthenticated, 10000/day when a registered `key` is provided. Weekly cache keeps us comfortably under either ceiling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("stackoverflow: user not found")
ErrNotFound is returned when the SE API has no user with the requested ID. Distinguishes "user does not exist" from a transport or decode error so callers can cache the empty result.
Functions ¶
func ExtractUserID ¶
ExtractUserID returns the Stack Overflow user ID encoded in the given URL, or 0 if the URL is not a recognizable SO profile link. Used by the service layer to convert a contributor's classified stackoverflow LinkedAccount into an API lookup.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Stack Overflow / Stack Exchange API client.
func NewClient ¶
NewClient returns a Client with the given timeout and optional API key. A zero or negative timeout falls back to a sane default; an empty apiKey runs against the unauthenticated quota.
type Profile ¶
type Profile struct {
UserID int64
DisplayName string
Reputation int64
BadgeBronze int
BadgeSilver int
BadgeGold int
URL string
CreatedAt time.Time
LastAccessAt time.Time
}
Profile is the parsed SE user response. Only fields we surface are kept; the SE API returns considerably more (collectives, per-period reputation deltas, accept rate) that we currently do not display.