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.

19 lines
707 B

  1. package pixelapi
  2. import (
  3. "net/url"
  4. "fornaxian.tech/pixeldrain_server/api/restapi/apitype"
  5. )
  6. // GetSubscriptionID returns the subscription object identified by the given ID
  7. func (p *PixelAPI) GetSubscriptionID(id string) (resp apitype.Subscription, err error) {
  8. return resp, p.jsonRequest("GET", p.apiEndpoint+"/subscription/"+url.PathEscape(id), &resp)
  9. }
  10. // PostSubscriptionLink links a subscription to the logged in user account. Use
  11. // Login() before calling this function to select the account to use. This
  12. // action cannot be undone.
  13. func (p *PixelAPI) PostSubscriptionLink(id string) (err error) {
  14. return p.jsonRequest("POST", p.apiEndpoint+"/subscription/"+url.PathEscape(id)+"/link", nil)
  15. }