Documentation
¶
Overview ¶
Package github provides a client for using the Sourceforge.net API. Sourceforge API docs: https://anypoint.mulesoft.com/apiplatform/sourceforge/#/portals/organizations/98f11a03-7ec0-4a34-b001-c1ca0e0c45b1/apis/32951/versions/34322
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL Project string // Services Tracker *TrackerService // contains filtered or unexported fields }
Client manages communication with the Sourceforge API
func NewClient ¶
NewClient returns a new Sourceforge API client. If nil httpClient provided, http.DefaultClient will be used.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type DiscussionPost ¶
type DiscussionPost struct { Attachments []TicketAttachment `json:"attachments"` Author string `json:"author"` LastEdited interface{} `json:"last_edited"` Slug string `json:"slug"` Subject string `json:"subject"` Text string `json:"text"` Timestamp string `json:"timestamp"` }
DiscussionPost represents comments on a Sourceforge issue
func (DiscussionPost) TimestampTime ¶ added in v1.3.0
func (t DiscussionPost) TimestampTime() time.Time
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Milestone ¶
type Milestone struct { Closed int `json:"closed"` Complete bool `json:"complete"` // Default bool `json:"default"` // bool or string in sourceforge Description string `json:"description"` DueDate string `json:"due_date"` Name string `json:"name"` Total int `json:"total"` }
Milestone represents project milestones, comes in TrackerInfo
type RequestQuery ¶ added in v1.1.0
RequestQuery Object represents what fields can be added to query string
func NewRequestQuery ¶ added in v1.1.0
func NewRequestQuery() *RequestQuery
NewRequestQuery Creates a RequestQuery object with default values
type Ticket ¶
type Ticket struct { ID string `json:"_id"` AssignedTo string `json:"assigned_to"` AssignedToID string `json:"assigned_to_id"` Attachments []TicketAttachment `json:"attachments"` CreatedDate string `json:"created_date"` CustomFields struct { Milestone string `json:"_milestone"` Priority string `json:"_priority"` } `json:"custom_fields"` Description string `json:"description"` DiscussionDisabled bool `json:"discussion_disabled"` DiscussionThread struct { ID string `json:"_id"` DiscussionID string `json:"discussion_id"` Limit int `json:"limit"` Page interface{} `json:"page"` Posts []DiscussionPost `json:"posts"` Subject string `json:"subject"` } `json:"discussion_thread"` DiscussionThreadURL string `json:"discussion_thread_url"` Labels []string `json:"labels"` ModDate string `json:"mod_date"` Private bool `json:"private"` RelatedArtifacts []interface{} `json:"related_artifacts"` ReportedBy string `json:"reported_by"` ReportedByID string `json:"reported_by_id"` Status string `json:"status"` Summary string `json:"summary"` TicketNum int `json:"ticket_num"` VotesDown int `json:"votes_down"` VotesUp int `json:"votes_up"` }
Ticket represents Sourceforge issue
func (*Ticket) CreatedTime ¶ added in v1.2.0
type TicketAttachment ¶
TicketAttachment represents attachments of a ticket
type TicketResponse ¶
type TicketResponse struct {
Ticket `json:"ticket"`
}
TicketResponse represents a ticket response
type TrackerInfo ¶
type TrackerInfo struct { Count int `json:"count"` Limit int `json:"limit"` Page int `json:"page"` Milestones []Milestone `json:"milestones"` Tickets []TrackerInfoTicket `json:"tickets"` }
TrackerInfo represents information of individual ticket categories
type TrackerInfoTicket ¶
TrackerInfoTicket represents tickets in the TrackerInfo response
type TrackerService ¶
type TrackerService struct {
// contains filtered or unexported fields
}
TrackerService handles communication with the ticket tracker tool releated methods of the Sourceforge API
func (*TrackerService) Info ¶
func (s *TrackerService) Info(trackerName string, query RequestQuery) (*TrackerInfo, *Response, error)
Info Downloads information of a tracker