Client for the pixeldrain API. Used by pixeldrain itself for tranferring data between the web UI and API server. And for rendering JSON responses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.3 KiB

4 years ago
4 years ago
  1. package pixelapi
  2. import "time"
  3. // Patron is a backer on pixeldrain's patreon campaign
  4. type Patron struct {
  5. PatreonUserID string `json:"patreon_user_id"`
  6. ClaimID string `json:"claim_id"`
  7. CampaignID string `json:"campaign_id"`
  8. FullName string `json:"full_name"`
  9. LastChargeDate time.Time `json:"last_charge_date"`
  10. LastChargeStatus string `json:"last_charge_status"`
  11. LifetimeSupportCents int `json:"lifetime_support_cents"`
  12. PatronStatus string `json:"patron_status"`
  13. PledgeAmountCents int `json:"pledge_amount_cents"`
  14. PledgeRelationshipStart time.Time `json:"pledge_relationship_start"`
  15. UserEmail string `json:"user_email"`
  16. Subscription SubscriptionType `json:"subscription"`
  17. }
  18. // GetPatreonByID returns information about a patron by the ID
  19. func (p *PixelAPI) GetPatreonByID(id string) (resp Patron, err error) {
  20. return resp, p.jsonRequest("GET", "patreon/"+id, &resp)
  21. }
  22. // PostPatreonLink links a patreon subscription to the pixeldrain account which
  23. // is logged into this API client
  24. func (p *PixelAPI) PostPatreonLink(id string) (err error) {
  25. return p.jsonRequest("POST", "patreon/"+id+"/link_subscription", nil)
  26. }