Documentation ¶
Overview ¶
Package mzalendo provides a client for using the Mzalendo API. Access different parts of the API using the various services.
c := mzalendo.NewClient(nil) // search for an interest results, err := c.Api.GetPerson("1290")
The full Mzalendo API is documented at http://info.mzalendo.com/help/api. To use the package in App Engine you need to create a http.Client that uses urlfetch package.
deadline := time.Duration(60) * time.Second client := &http.Client{ Transport: &urlfetch.Transport{ Context: c, Deadline: deadline, }, } c := mzalendo.NewClient(client)
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 Api ¶
type Api struct {
// contains filtered or unexported fields
}
func (*Api) GetOrganization ¶
func (a *Api) GetOrganization(id string) (Organization, error)
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Organization ¶
type Organization struct {
Result OrganizationResult `json:"result"`
}
type OrganizationResult ¶
type OrganizationResult struct { HTMLURL string `json:"html_url"` URL string `json:"url"` Category string `json:"category"` Classification string `json:"classification"` ID string `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Images []interface{} `json:"images",omitempty` Posts []interface{} `json:"posts",omitempty` Memberships []struct { HTMLURL string `json:"html_url"` URL string `json:"url"` EndDate string `json:"end_date"` ID string `json:"id"` Identifiers []interface{} `json:"identifiers"` OrganizationID string `json:"organization_id"` PersonID string `json:"person_id"` Role string `json:"role"` StartDate string `json:"start_date"` Images []interface{} `json:"images",omitempty` Links []interface{} `json:"links",omitempty` ContactDetails []interface{} `json:"contact_details",omitempty` } `json:"memberships"` Links []interface{} `json:"links, omitempty"` ContactDetails []interface{} `json:"contact_details,omitempty"` Identifiers []interface{} `json:"identifiers,omitempty"` OtherNames []interface{} `json:"other_names",omitempty` }
type Person ¶
type Person struct { Result struct { BirthDate string `json:"birth_date"` ContactDetails []interface{} `json:"contact_details"` Gender string `json:"gender"` HonorificSuffix string `json:"honorific_suffix"` HtmlURL string `json:"html_url"` ID string `json:"id"` Identifiers []interface{} `json:"identifiers"` Image string `json:"image"` Images []struct { ProxyURL string `json:"proxy_url"` URL string `json:"url"` } `json:"images"` Links []interface{} `json:"links"` Memberships []struct { ContactDetails []interface{} `json:"contact_details"` HtmlURL string `json:"html_url"` ID string `json:"id"` Identifiers []interface{} `json:"identifiers"` Images []interface{} `json:"images"` Links []interface{} `json:"links"` OrganizationID string `json:"organization_id"` PersonID string `json:"person_id"` Role string `json:"role"` StartDate string `json:"start_date"` URL string `json:"url"` } `json:"memberships"` Name string `json:"name"` OtherNames []interface{} `json:"other_names"` ProxyImage string `json:"proxy_image"` SortName string `json:"sort_name"` URL string `json:"url"` } `json:"result"` }
Click to show internal directories.
Click to hide internal directories.