openhub

package
v0.9.23 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package openhub fetches OpenHub (formerly Ohloh) developer profile data. OpenHub tracks open-source developer contributions across projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthRequired

func AuthRequired() bool

AuthRequired returns false because OpenHub profiles are public.

func Match

func Match(urlStr string) bool

Match returns true if the URL is an OpenHub profile URL.

Types

type Account

type Account struct {
	ID             int        `xml:"id"`
	Name           string     `xml:"name"`
	Email          string     `xml:"email"`
	AboutRaw       string     `xml:"about_raw"`
	AvatarURL      string     `xml:"avatar_url"`
	CountryCode    string     `xml:"country_code"`
	Location       string     `xml:"location"`
	Latitude       string     `xml:"latitude"`
	Longitude      string     `xml:"longitude"`
	URL            string     `xml:"url"`
	HTMLURL        string     `xml:"html_url"`
	CreatedAt      string     `xml:"created_at"`
	UpdatedAt      string     `xml:"updated_at"`
	HomepageURL    string     `xml:"homepage_url"`
	TwitterAccount string     `xml:"twitter_account"`
	KudoRank       int        `xml:"kudo_rank"`
	KudoScore      *KudoScore `xml:"kudo_score"`
	Posts          *Posts     `xml:"posts"`
}

Account represents an OpenHub account.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles OpenHub requests.

func New

func New(ctx context.Context, opts ...Option) (*Client, error)

New creates an OpenHub client.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, urlStr string) (*profile.Profile, error)

Fetch retrieves an OpenHub profile.

type KudoScore

type KudoScore struct {
	KudoRank int `xml:"kudo_rank"`
	Position int `xml:"position"`
	Created  int `xml:"created"`
	Received int `xml:"received"`
}

KudoScore represents kudos metrics.

type Option

type Option func(*config)

Option configures a Client.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey sets the OpenHub API key (optional but recommended).

func WithHTTPCache

func WithHTTPCache(httpCache httpcache.Cacher) Option

WithHTTPCache sets the HTTP cache.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets a custom logger.

type Posts

type Posts struct {
	Count int `xml:"count,attr"`
}

Posts represents post counts.

type Response

type Response struct {
	XMLName xml.Name `xml:"response"`
	Status  string   `xml:"status"`
	Result  *Result  `xml:"result"`
	Error   string   `xml:"error"`
}

Response is the root element of OpenHub API responses.

type Result

type Result struct {
	Account *Account `xml:"account"`
}

Result contains the account data.

Jump to

Keyboard shortcuts

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