Documentation
¶
Overview ¶
Package connpass provides a search method for using the connpass API (See https://connpass.com/about/api/).
Construct a query, then search with that on connpass. For example:
query := connpass.Query{}
// Retrieve the latest 10 events.
res, err := query.Search()
Specify query parameters by setting fields of a Query object.
query := connpass.Query{Start: 1, Order: connpass.CREATE}
query.KeywordOr = []string{"go", "golang"}
query.Time = []connpass.Time{connpass.Time{Year: 2015, Month: 3}, connpass.Time{Year: 2015, Month: 4}}
// Retrieve the recently created 10 events containing "go" or "golang" in its title or description
// and being held in March or April, 2015.
res, err := query.Search()
Pagination ¶
The search API supports pagenation. Pagenation options can be specified with Start, Order and Count. Pages information is available via ResultSet struct.
var allEvents []connpass.Event
for {
res, err := query.Search()
if err != nil {
return err
}
allEvents = append(allEvents, res.Events...)
offset := res.Start + res.Returned
if offset > res.Available {
break
}
query.Start = offset
}
Index ¶
Constants ¶
const BaseUrl = "https://connpass.com/api/v1/event/"
BaseUrl is the base URL of the API (See https://connpass.com/about/api/)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Id int `json:"event_id"`
Title string `json:"title"`
Catch string `json:"catch"`
Description string `json:"description"`
Url string `json:"event_url"`
Tag string `json:"hash_tag"`
Start string `json:"started_at"`
End string `json:"ended_at"`
Limit int `json:"limit"`
Etype string `json:"event_type"`
Address string `json:"address"`
Place string `json:"place"`
Lat string `json:"lat"`
Lon string `json:"lon"`
OwnerID int `json:"owner_id"`
OwnerNickname string `json:"owner_nickname"`
OwnerName string `json:"owner_display_name"`
Accepted int `json:"accepted"`
Waiting int `json:"waiting"`
Updated string `json:"updated_at"`
}
Event specifies an event on connpass.
type Format ¶
type Format string
Format specifies the format of the response. Currently, only JSON format is supported.
const (
JSON Format = "json"
)
type Query ¶
type Query struct {
EventId []int // Event ID
KeywordAnd []string // Keywords combined with AND operator
KeywordOr []string // Keywords combined with OR operator
Time []Time // Holding date of the event
Participant []string // Nickname of participants
Owner []string // Nickname of the owner
SeriesId []int // Series ID
Start int // Offset
Order Order // Order of the result
Count int // Max number of results
Format // Format of response
}
Query specifies the criteria of search. Note that multiple values can be specified for each parameter type. And each type of the parameter is combined with other types with AND, while the values of a parameter are combined with OR.