Documentation ¶
Index ¶
- func IsNotFound(err error) bool
- func SetPageAccessToken(ctx context.Context, token string) context.Context
- type Client
- func (c *Client) Delete(ctx context.Context, url string) error
- func (c *Client) DeleteJSON(ctx context.Context, url string, req, res interface{}) error
- func (c *Client) GetJSON(ctx context.Context, url string, res interface{}) error
- func (c *Client) GetList(ctx context.Context, url string, res interface{}) error
- func (c *Client) PostForm(ctx context.Context, endpointUrl string, formBody url.Values, res interface{}) error
- func (c *Client) PostJSON(ctx context.Context, url string, req, res interface{}) error
- func (c *Client) PostValues(ctx context.Context, u string, vals url.Values) error
- func (c *Client) ReadList(ctx context.Context, url string, res chan<- json.RawMessage) error
- func (c *Client) UploadFile(ctx context.Context, url, name string, r io.Reader, ...) error
- type Error
- type ErrorContainer
- type Filter
- type ID
- type InsightsStatus
- type KeyValue
- type Metadata
- type MetadataContainer
- type MinimalResponse
- type Paging
- type RouteBuilder
- func (rb *RouteBuilder) ActionAttributionWindows(s ...string) *RouteBuilder
- func (rb *RouteBuilder) ActionBreakdowns(s string) *RouteBuilder
- func (rb *RouteBuilder) AdFormat(s string) *RouteBuilder
- func (rb *RouteBuilder) Aggregation(s string) *RouteBuilder
- func (rb *RouteBuilder) Breakdowns(s ...string) *RouteBuilder
- func (rb *RouteBuilder) Class(s string) *RouteBuilder
- func (rb *RouteBuilder) DailyTimeIncrement(b bool) *RouteBuilder
- func (rb *RouteBuilder) DatePreset(s string) *RouteBuilder
- func (rb *RouteBuilder) DefaultSummary(t bool) *RouteBuilder
- func (rb *RouteBuilder) EffectiveStatus(s ...string) *RouteBuilder
- func (rb *RouteBuilder) ExportFormat(s string) *RouteBuilder
- func (rb *RouteBuilder) Fields(f ...string) *RouteBuilder
- func (rb *RouteBuilder) Filter(s string) *RouteBuilder
- func (rb *RouteBuilder) Filtering(f ...Filter) *RouteBuilder
- func (rb *RouteBuilder) Level(s string) *RouteBuilder
- func (rb *RouteBuilder) Limit(limit int) *RouteBuilder
- func (rb *RouteBuilder) LocationTypes(s ...string) *RouteBuilder
- func (rb *RouteBuilder) Metadata(t bool) *RouteBuilder
- func (rb *RouteBuilder) Order(s string) *RouteBuilder
- func (rb *RouteBuilder) Q(s string) *RouteBuilder
- func (rb *RouteBuilder) String() string
- func (rb *RouteBuilder) Summary(s string) *RouteBuilder
- func (rb *RouteBuilder) TargetingOptionList(s ...string) *RouteBuilder
- func (rb *RouteBuilder) TargetingSpec(ts interface{}) *RouteBuilder
- func (rb *RouteBuilder) TimeRange(minDate, maxDate time.Time) *RouteBuilder
- func (rb *RouteBuilder) Type(s string) *RouteBuilder
- func (rb *RouteBuilder) UnifiedAttributionSettings(t bool) *RouteBuilder
- type Stat
- type StatsContainer
- type SummaryContainer
- type Time
- type TimeRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound returns whether the error is a fb error with specific code and subcode.
Types ¶
type Client ¶
Client holds an http.Client and provides additional functionality.
func NewClient ¶
NewClient returns a http.Client containing a special transport with injects the version, token, and clientkey.
func (*Client) DeleteJSON ¶
DeleteJSON sends a DELETE request to url with a body and marshals the response to res.
func (*Client) PostForm ¶
func (c *Client) PostForm(ctx context.Context, endpointUrl string, formBody url.Values, res interface{}) error
Send a Post request encoded as a form.
func (*Client) PostJSON ¶
PostJSON encodes req as JSON into a buffer, sends this as a POST body to the url and parses the response as JSON into res.
func (*Client) PostValues ¶
PostValues sends an POST request to the Facebook Graph API.
type Error ¶
type Error struct { Message string `json:"message"` Type string `json:"type"` Code uint64 `json:"code"` ErrorSubcode uint64 `json:"error_subcode"` FbtraceID string `json:"fbtrace_id"` IsTransient bool `json:"is_transient"` ErrorUserTitle string `json:"error_user_title"` ErrorUserMsg string `json:"error_user_msg"` ErrorData json.RawMessage `json:"error_data"` }
Error implements error.
type ErrorContainer ¶
type ErrorContainer struct {
Error *Error `json:"error"`
}
ErrorContainer is a convenient type for embedding in other structs.
func (*ErrorContainer) GetError ¶
func (ec *ErrorContainer) GetError() error
GetError returns an error if available.
type Filter ¶
type Filter struct { Field string `json:"field"` Operator string `json:"operator"` Value interface{} `json:"value"` }
Filter is used for filtering lists.
type InsightsStatus ¶
type InsightsStatus struct { IsCreated bool `json:"is_created"` Current uint64 `json:"current"` Total uint64 `json:"total"` }
InsightsStatus contains information about the progress of a single insights report.
type Metadata ¶
type Metadata struct { Type string `json:"type"` Connections map[string]string `json:"connections"` Fields []struct { Name string `json:"name"` Description string `json:"description"` Type string `json:"type,omitempty"` } `json:"fields"` }
Metadata contains information about a graph API object.
type MetadataContainer ¶
type MetadataContainer struct {
Metadata *Metadata `json:"metadata"`
}
MetadataContainer contains a graph APIs object metadata.
type MinimalResponse ¶
type MinimalResponse struct { ID string `json:"id"` Success bool `json:"success"` UpdatedTime Time `json:"updated_time"` ErrorContainer }
MinimalResponse contains some information about a object being updated.
type Paging ¶
type Paging struct { Paging struct { Cursors struct { Before string `json:"before"` After string `json:"after"` } `json:"cursors"` Next string `json:"next"` } `json:"paging"` }
Paging is a convenient type for embedding in other structs.
type RouteBuilder ¶
type RouteBuilder struct {
// contains filtered or unexported fields
}
RouteBuilder helps building facebook API request routes.
func NewRoute ¶
func NewRoute(version, format string, a ...interface{}) *RouteBuilder
NewRoute starts building a new route.
func (*RouteBuilder) ActionAttributionWindows ¶
func (rb *RouteBuilder) ActionAttributionWindows(s ...string) *RouteBuilder
ActionAttributionWindows sets the action_attribution_windows param or deletes it.
func (*RouteBuilder) ActionBreakdowns ¶
func (rb *RouteBuilder) ActionBreakdowns(s string) *RouteBuilder
ActionBreakdowns sets the action_breakdowns param.
func (*RouteBuilder) AdFormat ¶
func (rb *RouteBuilder) AdFormat(s string) *RouteBuilder
AdFormat sets the ad_format param or deletes it.
func (*RouteBuilder) Aggregation ¶
func (rb *RouteBuilder) Aggregation(s string) *RouteBuilder
Aggregation sets the aggregation param or deletes it.
func (*RouteBuilder) Breakdowns ¶
func (rb *RouteBuilder) Breakdowns(s ...string) *RouteBuilder
Breakdowns sets the breakdowns array param.
func (*RouteBuilder) Class ¶
func (rb *RouteBuilder) Class(s string) *RouteBuilder
Class sets the type param.
func (*RouteBuilder) DailyTimeIncrement ¶
func (rb *RouteBuilder) DailyTimeIncrement(b bool) *RouteBuilder
DailyTimeIncrement sets whether time_increment should be 1.
func (*RouteBuilder) DatePreset ¶
func (rb *RouteBuilder) DatePreset(s string) *RouteBuilder
DatePreset sets date_preset param and deletes the time_range one.
func (*RouteBuilder) DefaultSummary ¶
func (rb *RouteBuilder) DefaultSummary(t bool) *RouteBuilder
DefaultSummary sets default_summary param or deletes it.
func (*RouteBuilder) EffectiveStatus ¶
func (rb *RouteBuilder) EffectiveStatus(s ...string) *RouteBuilder
EffectiveStatus sets the effective_status param or deletes it.
func (*RouteBuilder) ExportFormat ¶
func (rb *RouteBuilder) ExportFormat(s string) *RouteBuilder
ExportFormat sets the export_format level param.
func (*RouteBuilder) Fields ¶
func (rb *RouteBuilder) Fields(f ...string) *RouteBuilder
Fields sets the fields query param.
func (*RouteBuilder) Filter ¶
func (rb *RouteBuilder) Filter(s string) *RouteBuilder
Filter sets the filter param or deletes it.
func (*RouteBuilder) Filtering ¶
func (rb *RouteBuilder) Filtering(f ...Filter) *RouteBuilder
Filtering sets filtering param or deletes it.
func (*RouteBuilder) Level ¶
func (rb *RouteBuilder) Level(s string) *RouteBuilder
Level sets the location_types level param.
func (*RouteBuilder) Limit ¶
func (rb *RouteBuilder) Limit(limit int) *RouteBuilder
Limit sets the limit param.
func (*RouteBuilder) LocationTypes ¶
func (rb *RouteBuilder) LocationTypes(s ...string) *RouteBuilder
LocationTypes sets the location_types array param.
func (*RouteBuilder) Metadata ¶
func (rb *RouteBuilder) Metadata(t bool) *RouteBuilder
Metadata sets the ad_format param or deletes it.
func (*RouteBuilder) Order ¶
func (rb *RouteBuilder) Order(s string) *RouteBuilder
Order sets the order param or deletes it.
func (*RouteBuilder) Q ¶
func (rb *RouteBuilder) Q(s string) *RouteBuilder
Q sets the q param or deletes it.
func (*RouteBuilder) String ¶
func (rb *RouteBuilder) String() string
String implements fmt.Stringer and returns the finished url.
func (*RouteBuilder) Summary ¶
func (rb *RouteBuilder) Summary(s string) *RouteBuilder
Summary sets the summary param or deletes it.
func (*RouteBuilder) TargetingOptionList ¶
func (rb *RouteBuilder) TargetingOptionList(s ...string) *RouteBuilder
TargetingOptionList sets the targeting_option_list param or deletes it.
func (*RouteBuilder) TargetingSpec ¶
func (rb *RouteBuilder) TargetingSpec(ts interface{}) *RouteBuilder
TargetingSpec sets the action_attribution_windows param or deletes it.
func (*RouteBuilder) TimeRange ¶
func (rb *RouteBuilder) TimeRange(minDate, maxDate time.Time) *RouteBuilder
TimeRange sets time_range param and deletes the date_preset one.
func (*RouteBuilder) Type ¶
func (rb *RouteBuilder) Type(s string) *RouteBuilder
Type sets the type param.
func (*RouteBuilder) UnifiedAttributionSettings ¶
func (rb *RouteBuilder) UnifiedAttributionSettings(t bool) *RouteBuilder
UnifiedAttributionSettings sets unified_attribution_setting param or deletes it.
type Stat ¶
type Stat struct {
// contains filtered or unexported fields
}
Stat contains stat information about a list job.
func StatFromContext ¶
StatFromContext tries to retrieve the stat from the context.
func (*Stat) AddToContext ¶
AddToContext adds the stat container to the given context.
func (*Stat) SetProgress ¶
SetProgress sets the current and total values.
type StatsContainer ¶
type StatsContainer struct {
// contains filtered or unexported fields
}
StatsContainer contains a set of stats.
func NewStatsContainer ¶
func NewStatsContainer() *StatsContainer
NewStatsContainer initializes a new StatsContainer.
func (*StatsContainer) AddStats ¶
func (sc *StatsContainer) AddStats(id string) *Stat
AddStats adds new stats to the StatsContainer.
func (*StatsContainer) RemoveStats ¶
func (sc *StatsContainer) RemoveStats(id string)
RemoveStats removes the stats from the stats container.
func (*StatsContainer) Stats ¶
func (sc *StatsContainer) Stats() map[string]InsightsStatus
Stats returns a map of all insights stats.
type SummaryContainer ¶
type SummaryContainer struct { Summary struct { TotalCount uint64 `json:"total_count"` } `json:"summary"` }
SummaryContainer contains a summary with a total count of items.
type Time ¶
Time is used since the timestamp format used by the Graph API is not 100% the one used for unmarshaling time fields by the encoding/json Go package.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.