Documentation ¶
Overview ¶
Package patreon is a Go client library for accessing the Patreon API.
Example (RefreshToken) ¶
Automatically refresh token
config := oauth2.Config{ ClientID: "<client_id>", ClientSecret: "<client_secret>", Endpoint: oauth2.Endpoint{ AuthURL: AuthorizationURL, TokenURL: AccessTokenURL, }, Scopes: []string{"users", "pledges-to-me", "my-campaign"}, } token := oauth2.Token{ AccessToken: "<current_access_token>", RefreshToken: "<current_refresh_token>", // Must be non-nil, otherwise token will not be expired Expiry: time.Now().Add(-24 * time.Hour), } tc := config.Client(context.Background(), &token) client := NewClient(tc) _, err := client.FetchIdentity() if err != nil { panic(err) } print("OK")
Output:
Index ¶
- Constants
- Variables
- func VerifySignature(message []byte, secret string, signature string) (bool, error)
- func WithCursor(cursor string) requestOption
- func WithFields(resource string, fields ...string) requestOption
- func WithIncludes(include ...string) requestOption
- func WithPageSize(size int) requestOption
- type Address
- type AddressAttributes
- type AddressRelationship
- type Benefit
- type BenefitAttributes
- type BenefitRelationship
- type BenefitsRelationship
- type Campaign
- type CampaignAttributes
- type CampaignRelationship
- type CampaignResponse
- type CampaignsRelationship
- type CampaignsResponse
- type CategoriesRelationship
- type Client
- func (c *Client) Client() *http.Client
- func (c *Client) FetchCampaign(campaignID string, opts ...requestOption) (*CampaignResponse, error)
- func (c *Client) FetchCampaignMember(memberID string, opts ...requestOption) (*MemberResponse, error)
- func (c *Client) FetchCampaignMembers(campaignID string, opts ...requestOption) (*MembersResponse, error)
- func (c *Client) FetchCampaignPost(postID string, opts ...requestOption) (*PostResponse, error)
- func (c *Client) FetchCampaignPosts(campaignID string, opts ...requestOption) (*PostsResponse, error)
- func (c *Client) FetchCampaignWebhooks(opts ...requestOption) (*WebhookResponse, error)
- func (c *Client) FetchCampaigns(opts ...requestOption) (*CampaignsResponse, error)
- func (c *Client) FetchIdentity(opts ...requestOption) (*UserResponse, error)
- type CreatorRelationship
- type Data
- type Deliverable
- type DeliverableAttributes
- type DeliverablesRelationship
- type Error
- type ErrorResponse
- type Goal
- type GoalAttributes
- type GoalsRelationship
- type Includes
- type Media
- type MediaAttributes
- type MediaRelationship
- type Member
- type MemberAttributes
- type MemberRelationship
- type MemberResponse
- type MembersResponse
- type MembershipsRelationship
- type Meta
- type NullTime
- type OauthClient
- type OauthClientAttributes
- type PatronRelationship
- type PledgeEvent
- type PledgeEventAttributes
- type PledgeEventRelationship
- type Post
- type PostAggregationRelationship
- type PostAttributes
- type PostResponse
- type PostsResponse
- type Related
- type RewardRelationship
- type RewardsRelationship
- type Tier
- type TierAttributes
- type TierRelationship
- type TiersRelationship
- type User
- type UserAttributes
- type UserRelationship
- type UserResponse
- type Webhook
- type WebhookAttributes
- type WebhookResponse
Examples ¶
Constants ¶
const ( // AuthorizationURL specifies Patreon's OAuth2 authorization endpoint (see https://tools.ietf.org/html/rfc6749#section-3.1). // See Example_refreshToken for examples. AuthorizationURL = "https://www.patreon.com/oauth2/authorize" // AccessTokenURL specifies Patreon's OAuth2 token endpoint (see https://tools.ietf.org/html/rfc6749#section-3.2). // See Example_refreshToken for examples. AccessTokenURL = "https://api.patreon.com/oauth2/token" )
const ( // EventCreatePledge specifies a create pledge event EventCreatePledge = "pledges:create" // EventUpdatePledge specifies an update pledge event EventUpdatePledge = "pledges:update" // EventDeletePledge specifies a delete pledge event EventDeletePledge = "pledges:delete" )
const ( // HeaderEventType specifies an event type HTTP header name HeaderEventType = "X-Patreon-Event" // HeaderEventSignature specifies message signature HTTP header name to verify message body HeaderSignature = "X-Patreon-Signature" )
Variables ¶
var ( // CampaignDefaultIncludes specifies default includes for Campaign. CampaignDefaultIncludes = []string{"tiers", "creator", "benefits", "goals"} // CampaignFields is all fields in the Campaign Attributes struct CampaignFields = getObjectFields(CampaignAttributes{}) )
var ( // MemberDefaultIncludes specifies default includes for Member. MemberDefaultIncludes = []string{"address", "campaign", "currently_entitled_tiers", "user"} // MemberFields is all fields in the Member Attributes struct MemberFields = getObjectFields(Member{}.Attributes) )
var ( // PostDefaultIncludes specifies default includes for Post. PostDefaultIncludes = []string{"campaign", "user"} // PostFields is all fields in the Post Attributes struct PostFields = getObjectFields(Post{}.Attributes) )
var ( // UserDefaultIncludes specifies default includes for User. UserDefaultIncludes = []string{"campaign", "memberships"} // UserFields is all fields in the User Attributes struct UserFields = getObjectFields(UserAttributes{}) )
var ( // WebhookDefaultIncludes specifies default includes for Webhook. WebhookDefaultIncludes = []string{"campaign", "client"} // WebhookFields is all fields in the Webhook Attributes struct WebhookFields = getObjectFields(Webhook{}.Attributes) )
var AddressFields = getObjectFields(AddressAttributes{})
AddressFields is all fields in the Address Attributes struct
var AllScopes = []string{
"identity", "identity[email]", "identity.memberships", "campaigns",
"w:campaigns.webhook", "campaigns.members", "campaigns.members[email]",
"campaigns.members.address", "campaigns.posts",
}
AllScopes is every scope possible for Oauth (see https://docs.patreon.com/#scopes).
var BenefitFields = getObjectFields(BenefitAttributes{})
BenefitFields is all fields in the Benefit Attributes struct
var DeliverableFields = getObjectFields(Deliverable{}.Attributes)
DeliverableFields is all fields in the Deliverable Attributes struct
var GoalFields = getObjectFields(Goal{}.Attributes)
GoalFields is all fields in the Goal Attributes struct
var MediaFields = getObjectFields(Media{}.Attributes)
MediaFields is all fields in the Media Attributes struct
var OauthClientFields = []string{
"AuthorName", "ClientSecret", "DefaultScopes",
"Description", "Domain", "IconURL", "Name",
"PrivacyPolicyURL", "RedirectURIs", "TosURL", "Version",
}
OauthClientFields is all fields in the OauthClient Attributes struct
var PledgeEventFields = getObjectFields(PledgeEvent{}.Attributes)
PledgeEventFields is all fields in the PledgeEvent Attributes struct
var TierFields = getObjectFields(Tier{}.Attributes)
TierFields is all fields in the Tier Attributes struct
Functions ¶
func VerifySignature ¶
VerifySignature verifies the sender of the message
func WithCursor ¶
func WithCursor(cursor string) requestOption
WithCursor controls cursor-based pagination. Cursor will also be extracted from navigation links for convenience.
func WithFields ¶
WithFields specifies the resource attributes you want to be returned by API.
func WithIncludes ¶
func WithIncludes(include ...string) requestOption
WithIncludes specifies the related resources you want to be returned by API.
func WithPageSize ¶
func WithPageSize(size int) requestOption
WithPageSize specifies the number of items to return.
Types ¶
type Address ¶
type Address struct { Type string `json:"type"` ID string `json:"id"` Attributes AddressAttributes `json:"attributes"` Relationships struct { Campaigns *CampaignsRelationship `json:"campaigns,omitempty"` User *UserRelationship `json:"user,omitempty"` } `json:"relationships"` }
Address represents a Patreon's shipping address.
type AddressAttributes ¶
type AddressAttributes struct { Addressee string `json:"addressee"` City string `json:"city"` Country string `json:"country"` CreatedAt NullTime `json:"created_at"` Line1 string `json:"line_1"` Line2 string `json:"line_2"` PhoneNumber string `json:"phone_number"` PostalCode string `json:"postal_code"` State string `json:"state"` }
AddressAttributes is the attributes struct for the Address
type AddressRelationship ¶
AddressRelationship represents 'address' include.
type Benefit ¶
type Benefit struct { Type string `json:"type"` ID string `json:"id"` Attributes BenefitAttributes `json:"attributes"` Relationships struct { Campaign *CampaignRelationship `json:"campaign,omitempty"` CampaignInstallations interface{} `json:"campaign_installation"` // I don't know what this is.. Couldn't find any docs / examples Deliverables *DeliverablesRelationship `json:"deliverables,omitempty"` Tiers *TiersRelationship `json:"tiers,omitempty"` } `json:"relationships"` }
Benefit is a benefit added to the campaign, which can be added to a tier to be delivered to the patron.
type BenefitAttributes ¶
type BenefitAttributes struct { AppExternalID string `json:"app_external_id,omitempty"` AppMeta map[string]interface{} `json:"app_meta,omitempty"` BenefitType string `json:"benefit_type,omitempty"` CreatedAt NullTime `json:"created_at,omitempty"` DeliverablesDueTodayCount int `json:"deliverables_due_today_count,omitempty"` DeliveredDeliverablesCount int `json:"delivered_deliverables_count,omitempty"` Description string `json:"description,omitempty"` IsDeleted bool `json:"is_deleted,omitempty"` IsEnded bool `json:"is_ended,omitempty"` IsPublished bool `json:"is_published,omitempty"` NextDeliverableDueDate NullTime `json:"next_deliverable_due_date,omitempty"` NotDeliveredDeliverablesCount int `json:"not_delivered_deliverables_count,omitempty"` RuleType bool `json:"rule_type,omitempty"` TiersCount int `json:"tiers_count,omitempty"` Title string `json:"title,omitempty"` }
BenefitAttributes is the attributes struct for Benefit
type BenefitRelationship ¶
BenefitRelationship represents 'benefit' include.
type BenefitsRelationship ¶
BenefitsRelationship represents 'benefits' include.
type Campaign ¶
type Campaign struct { Type string `json:"type"` ID string `json:"id"` Attributes CampaignAttributes `json:"attributes"` Relationships struct { Benefits *BenefitsRelationship `json:"benefits,omitempty"` CampaignInstallations *interface{} `json:"campaign_installations,omitempty"` Categories *CategoriesRelationship `json:"categories,omitempty"` Creator *CreatorRelationship `json:"creator,omitempty"` Goals *GoalsRelationship `json:"goals,omitempty"` Tiers *TiersRelationship `json:"tiers,omitempty"` } `json:"relationships"` }
Campaign is the creator's page, and the top-level object for accessing lists of members, tiers, etc.
type CampaignAttributes ¶
type CampaignAttributes struct { CreatedAt NullTime `json:"created_at"` CreationName string `json:"creation_name"` DiscordServerID string `json:"discord_server_id"` GoogleAnalyticsID string `json:"google_analytics_id"` HasRSS bool `json:"has_rss"` HasSentRSSNotify bool `json:"has_sent_rss_notify"` ImageSmallURL string `json:"image_small_url"` ImageURL string `json:"image_url"` IsChargedImmediately bool `json:"is_charged_immediately"` IsMonthly bool `json:"is_monthly"` IsNsfw bool `json:"is_nsfw"` MainVideoEmbed string `json:"main_video_embed"` MainVideoURL string `json:"main_video_url"` OneLiner string `json:"one_liner"` PatronCount int `json:"patron_count"` PayPerName string `json:"pay_per_name"` PledgeURL string `json:"pledge_url"` PublishedAt NullTime `json:"published_at"` RSSArtworkURL bool `json:"rss_artwork_url"` RSSFeedTitle string `json:"rss_feed_title"` ShowEarnings bool `json:"show_earnings"` Summary string `json:"summary"` ThanksEmbed string `json:"thanks_embed"` ThanksMsg string `json:"thanks_msg"` ThanksVideoURL string `json:"thanks_video_url"` URL string `json:"url"` Vanity string `json:"vanity"` }
CampaignAttributes is the attributes struct for Campaign
type CampaignRelationship ¶
CampaignRelationship represents 'campaign' include.
type CampaignResponse ¶
CampaignV2Response wraps Patreon's campaign API response
type CampaignsRelationship ¶
CampaignsRelationship represents 'campaigns' include.
type CampaignsResponse ¶
CampaignsV2Response wraps Patreon's campaign API response
type CategoriesRelationship ¶
type CategoriesRelationship struct {
Data []Data `json:"data"`
}
CategoriesRelationship represents 'categories' include.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages communication with Patreon API.
func NewClient ¶
NewClient returns a new Patreon API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).
func (*Client) FetchCampaign ¶
func (c *Client) FetchCampaign(campaignID string, opts ...requestOption) (*CampaignResponse, error)
FetchCampaign is the single resource endpoint returns information about a single Campaign, fetched by campaign ID. Requires the campaigns scope.
func (*Client) FetchCampaignMember ¶
func (c *Client) FetchCampaignMember(memberID string, opts ...requestOption) (*MemberResponse, error)
FetchCampaignMember gets a particular member by id. Requires the campaigns.members scope.
func (*Client) FetchCampaignMembers ¶
func (c *Client) FetchCampaignMembers(campaignID string, opts ...requestOption) (*MembersResponse, error)
FetchCampaignMembers gets the Members for a given Campaign. Requires the campaigns.members scope.
func (*Client) FetchCampaignPost ¶
func (c *Client) FetchCampaignPost(postID string, opts ...requestOption) (*PostResponse, error)
FetchCampaignPost gets a particular Post by ID. Requires the campaigns.posts scope.
func (*Client) FetchCampaignPosts ¶
func (c *Client) FetchCampaignPosts(campaignID string, opts ...requestOption) (*PostsResponse, error)
FetchCampaignPosts gets a list of all the Posts on a given Campaign by campaign ID. Requires the campaigns.posts scope.
func (*Client) FetchCampaignWebhooks ¶ added in v1.0.0
func (c *Client) FetchCampaignWebhooks(opts ...requestOption) (*WebhookResponse, error)
FetchCampaignWebhooks gets the Webhooks for the current user's Campaign created by the API client. You will only be able to see webhooks created by your client. Requires the w:campaigns.webhook scope.
func (*Client) FetchCampaigns ¶
func (c *Client) FetchCampaigns(opts ...requestOption) (*CampaignsResponse, error)
FetchCampaigns Returns a list of Campaigns owned by the authorized user. Requires the campaigns scope.
func (*Client) FetchIdentity ¶
func (c *Client) FetchIdentity(opts ...requestOption) (*UserResponse, error)
FetchIdentity fetches a patron's profile info. This is the endpoint for accessing information about the current User with reference to the oauth token. It is most typically used in the OAuth "Log in with Patreon" flow to create or update the user's account on your site.
type CreatorRelationship ¶
CreatorRelationship represents 'creator' include.
type Deliverable ¶
type Deliverable struct { Type string `json:"type"` ID string `json:"id"` Attributes DeliverableAttributes `json:"attributes"` Relationships struct { Benefit *BenefitsRelationship `json:"benefit,omitempty"` Campaign *CampaignRelationship `json:"campaign,omitempty"` Member *MemberRelationship `json:"member,omitempty"` User *UserRelationship `json:"user,omitempty"` } `json:"relationships"` }
Deliverable is the record of whether or not a patron has been delivered the benefit they are owed because of their member tier.
type DeliverableAttributes ¶
type DeliverableAttributes struct { CompletedAt NullTime `json:"completed_at"` DeliveryStatus string `json:"delivery_status"` DueAt NullTime `json:"due_at"` }
DeliverableAttributes is the attributes struct for Deliverable
type DeliverablesRelationship ¶
DeliverablesRelationship represents 'deliverables' include.
type Error ¶
type Error struct { Code int `json:"code"` CodeName string `json:"code_name"` Detail string `json:"detail"` ID string `json:"id"` Status string `json:"status"` Title string `json:"title"` }
Error describes error details.
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
ErrorResponse is a Patreon error response.
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type Goal ¶
type Goal struct { Type string `json:"type"` ID string `json:"id"` Attributes GoalAttributes `json:"attributes"` Relationships struct { Campaign *CampaignRelationship `json:"campaign,omitempty"` } `json:"relationships"` }
Goal is the funding goal in USD set by a creator on a campaign.
type GoalAttributes ¶
type GoalAttributes struct { AmountCents int `json:"amount_cents"` CompletedPercentage int `json:"completed_percentage"` CreatedAt NullTime `json:"created_at"` Description string `json:"description"` ReachedAt NullTime `json:"reached_at"` Title string `json:"title"` }
GoalAttributes is the attributes struct for Goal
type GoalsRelationship ¶
type GoalsRelationship struct {
Data []Data `json:"data"`
}
GoalsRelationship represents 'goals' include.
type Includes ¶
type Includes struct {
Items []interface{}
}
Includes wraps 'includes' JSON field to handle objects of different type within an array.
func (*Includes) UnmarshalJSON ¶
UnmarshalJSON deserializes 'includes' field into the appropriate structs depending on the 'type' field. See http://gregtrowbridge.com/golang-json-serialization-with-interfaces/ for implementation details.
type Media ¶
type Media struct { Type string `json:"type"` ID string `json:"id"` Attributes MediaAttributes `json:"attributes"` }
Media is a file uploaded to patreon.com, usually an image.
type MediaAttributes ¶
type MediaAttributes struct { CreatedAt NullTime `json:"created_at"` DownloadURL string `json:"download_url"` FileName string `json:"file_name"` ImageURLs interface{} `json:"image_urls"` Metadata interface{} `json:"metadata"` Mimetype string `json:"mimetype"` OwnerID string `json:"owner_id"` OwnerRelationship string `json:"owner_relationship"` OwnerType string `json:"owner_type"` SizeBytes int `json:"size_bytes"` State string `json:"state"` UploadExpiresAt NullTime `json:"upload_expires_at"` UploadParameters interface{} `json:"upload_parameters"` UploadUrl string `json:"upload_url"` }
type MediaRelationship ¶
MediaRelationship represents 'membership' include
type Member ¶
type Member struct { Type string `json:"type"` ID string `json:"id"` Attributes MemberAttributes `json:"attributes"` Relationships struct { Address *AddressRelationship `json:"address,omitempty"` Campaign *CampaignRelationship `json:"campaign,omitempty"` CurrentlyEntitledTiers *TiersRelationship `json:"currently_entitled_tiers,omitempty"` PledgeHistory *PledgeEventRelationship `json:"pledge_history,omitempty"` User *UserRelationship `json:"user,omitempty"` } `json:"relationships"` }
Member is the record of a user's membership to a campaign. Remains consistent across months of pledging.
type MemberAttributes ¶
type MemberAttributes struct { CampaignLifetimeSupportCents int `json:"campaign_lifetime_support_cents"` CurrentlyEntitledAmountCents int `json:"currently_entitled_amount_cents"` Email string `json:"email"` FullName string `json:"full_name"` IsFollower bool `json:"is_follower"` LastChargeDate NullTime `json:"last_charge_date"` LastChargeStatus string `json:"last_charge_status"` LifetimeSupportCents int `json:"lifetime_support_cents"` NextChargeDate NullTime `json:"next_charge_date"` Note string `json:"note"` PatronStatus string `json:"patron_status"` PledgeCadence int `json:"pledge_cadence"` PledgeRelationshipStart NullTime `json:"pledge_relationship_start"` WillPayAmountCents int `json:"will_pay_amount_cents"` }
MemberAttributes is the attributes struct for Member
type MemberRelationship ¶
MemberRelationship represents 'member' include
type MemberResponse ¶
type MemberResponse struct { Data Member `json:"data"` Included Includes `json:"included"` Links struct { Self string `json:"self"` } `json:"links"` }
MemberResponse wraps Patreon's fetch benefit API response
type MembersResponse ¶
type MembersResponse struct { Data []Member `json:"data"` Included Includes `json:"included"` Links struct { First string `json:"first"` Last string `json:"last"` Next string `json:"next"` Prev string `json:"prev"` } `json:"links"` Meta struct { Pagination struct { Cursors struct { First string `json:"first"` Last string `json:"last"` Next string `json:"next"` Prev string `json:"prev"` } `json:"cursors"` } `json:"pagination"` Count int `json:"count"` } `json:"meta"` }
MembersResponse wraps Patreon's fetch benefit API response
type MembershipsRelationship ¶
MembershipsRelationship represents 'membership' include
type Meta ¶
type Meta struct {
Count int `json:"count"`
}
Meta represents extra information about relationship.
type NullTime ¶
NullTime represents a time.Time that may be JSON "null". golang prior 1.8 doesn't support this scenario (fails with error: parsing time "null" as ""2006-01-02T15:04:05Z07:00"": cannot parse "null" as """)
func (*NullTime) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler with JSON "null" support
type OauthClient ¶
type OauthClient struct { Type string `json:"type"` ID string `json:"id"` Attributes OauthClientAttributes `json:"attributes"` Relationships struct { // Apps *AppsRelationship `json:"apps"` Campaign *CampaignRelationship `json:"campaign,omitempty"` CreatorToken *oauth2.Token `json:"creator_token,omitempty"` User *UserRelationship `json:"user,omitempty"` } `json:"relationships"` }
OauthClient is a client created by a developer, used for getting OAuth2 access tokens.
type OauthClientAttributes ¶
type OauthClientAttributes struct { AuthorName string `json:"author_name"` ClientSecret string `json:"client_secret"` DefaultScopes string `json:"default_scopes"` Description string `json:"description"` Domain string `json:"domain"` IconURL string `json:"icon_url"` Name string `json:"name"` PrivacyPolicyURL string `json:"privacy_policy_url"` RedirectURIs string `json:"redirect_uris"` TosURL string `json:"tos_url"` Version string `json:"version"` }
OauthClientAttributes is the attributes struct for OauthClient
type PatronRelationship ¶
PatronRelationship represents 'patron' include.
type PledgeEvent ¶
type PledgeEvent struct { Type string `json:"type"` ID string `json:"id"` Attributes PledgeEventAttributes `json:"attributes"` Relationships struct { Campaign *CampaignRelationship `json:"campaign,omitempty"` Patron *PatronRelationship `json:"patron"` Tier *TierRelationship `json:"tier,omitempty"` } `json:"relationships"` }
PledgeEvent is the record of a pledging action taken by the user, or that action's failure.
type PledgeEventAttributes ¶
type PledgeEventAttributes struct { AmountCents int `json:"amount_cents"` CurrencyCode string `json:"currency_code"` Date NullTime `json:"date"` PaymentStatus string `json:"payment_status"` TierID string `json:"tier_id"` TierTitle string `json:"tier_title"` Type string `json:"type"` }
PledgeEventAttributes is the attributes struct for PledgeEvent
type PledgeEventRelationship ¶
PledgeEventRelationship represents 'pledge_history' include.
type Post ¶
type Post struct { Type string `json:"type"` ID string `json:"id"` Attributes PostAttributes `json:"attributes"` Relationships struct { User *UserRelationship `json:"user,omitempty"` Campaign *CampaignRelationship `json:"campaign,omitempty"` } `json:"relationships"` }
Post is content posted by a creator on a campaign page.
type PostAggregationRelationship ¶
PostAggregationRelationship represents 'post_aggregation' include.
type PostAttributes ¶
type PostAttributes struct { AppID int `json:"app_id"` AppStatus string `json:"app_status"` Content string `json:"content"` EmbedData interface{} `json:"embed_data"` EmbedURL string `json:"embed_url"` IsPaid bool `json:"is_paid"` IsPublic bool `json:"is_public"` PublishedAt NullTime `json:"published_at"` Title string `json:"title"` URL string `json:""` }
PostAttributes is the attributes struct for Post
type PostResponse ¶
type PostResponse struct { Data Post `json:"data"` Included Includes `json:"included"` Links struct { Self string `json:"self"` } `json:"links"` }
PostResponse wraps Patreon's fetch benefit API response
type PostsResponse ¶
type PostsResponse struct { Data []Post `json:"data"` Included Includes `json:"included"` Links struct { Self string `json:"self"` } `json:"links"` }
PostsResponse wraps Patreon's fetch benefit API response
type Related ¶ added in v1.0.0
type Related struct {
Related string `json:"related"`
}
Related is the string within Links
type RewardRelationship ¶
RewardRelationship represents 'reward' include.
type RewardsRelationship ¶
type RewardsRelationship struct {
Data []Data `json:"data"`
}
RewardsRelationship represents 'rewards' include.
type Tier ¶
type Tier struct { Type string `json:"type"` ID string `json:"id"` Attributes TierAttributes `json:"attributes"` Relationships struct { Benefits *BenefitsRelationship `json:"benefits,omitempty"` Campaign *CampaignRelationship `json:"campaign,omitempty"` TierImage *MediaRelationship `json:"tier_image,omitempty"` } `json:"relationships"` }
Tier is a membership level on a campaign, which can have benefits attached to it.
type TierAttributes ¶
type TierAttributes struct { AmountCents int `json:"amount_cents"` CreatedAt NullTime `json:"created_at"` Description string `json:"description"` DiscordRoleIds interface{} `json:"discord_role_ids"` EditedAt NullTime `json:"edited_at"` ImageURL string `json:"image_url"` PatronCount int `json:"patron_count"` PostCount int `json:"post_count"` Published bool `json:"published"` PublishedAt NullTime `json:"published_at"` Remaining int `json:"remaining"` RequiresShipping bool `json:"requires_shipping"` Title string `json:"title"` UnpublishedAt NullTime `json:"unpublished_at"` URL string `json:"url"` UserLimit int `json:"user_limit"` }
TierAttributes is the attributes struct for Tier
type TierRelationship ¶
TierRelationship represents 'tier' include
type TiersRelationship ¶
TiersRelationship represents 'tiers' include
type User ¶
type User struct { Type string `json:"type"` ID string `json:"id"` Attributes UserAttributes `json:"attributes"` Relationships struct { Campaign *CampaignRelationship `json:"campaign,omitempty"` Memberships *MembershipsRelationship `json:"memberships,omitempty"` } `json:"relationships"` }
User is the Patreon user, which can be both patron and creator.
type UserAttributes ¶
type UserAttributes struct { About string `json:"about"` CanSeeNSFW bool `json:"can_see_nsfw"` Created NullTime `json:"created"` Email string `json:"email"` FirstName string `json:"first_name"` FullName string `json:"full_name"` HidePledges bool `json:"hide_pledges"` ImageURL string `json:"image_url"` IsEmailVerified bool `json:"is_email_verified"` LastName string `json:"last_name"` LikeCount int `json:"like_count"` SocialConnections interface{} `json:"social_connections"` ThumbURL string `json:"thumb_url"` URL string `json:"url"` Vanity string `json:"vanity"` }
UserAttributes is the attributes struct for User
type UserRelationship ¶
UserRelationship represents 'user' include
type UserResponse ¶
type UserResponse struct { Data User `json:"data"` Included Includes `json:"included"` Links struct { Self string `json:"self"` } `json:"links"` }
UserResponse wraps Patreon's fetch user API response
type Webhook ¶
type Webhook struct { Type string `json:"type"` ID string `json:"id"` Attributes WebhookAttributes `json:"attributes"` Relationships struct { Campaign *CampaignRelationship `json:"campaign,omitempty"` Memberships *MembershipsRelationship `json:"memberships,omitempty"` } `json:"relationships"` }
Webhook is fired based on events happening on a particular campaign.
type WebhookAttributes ¶
type WebhookAttributes struct { LastAttemptedAt NullTime `json:"last_attempted_at"` NumConsecutiveTimesFailed int `json:"num_consecutive_times_failed"` Paused bool `json:"paused"` Secret string `json:"secret"` Triggers interface{} `json:"triggers"` URI string `json:"uri"` }
WebhookAttributes is the attributes struct for Webhook
type WebhookResponse ¶
type WebhookResponse struct { Data Webhook `json:"data"` Included Includes `json:"included"` Links struct { Self string `json:"self"` } `json:"links"` }
WebhookResponse wraps Patreon's fetch user API response