Documentation ¶
Index ¶
- Constants
- type BundleComponent
- type Client
- func (c *Client) CreateArticle(article io.Reader, bundleComponents []MultipartUploadComponent, ...) (*ReadArticleResponse, error)
- func (c *Client) DeleteArticle(articleId string) error
- func (c *Client) ListSections() (*ListSectionsResponse, error)
- func (c *Client) PromoteArticles(sectionId string, articleIds []string) (*PromoteArticlesResponse, error)
- func (c *Client) ReadArticle(articleId string) (*ReadArticleResponse, error)
- func (c *Client) ReadChannel(channelId string) (*ReadChannelResponse, error)
- func (c *Client) ReadSection(sectionId string) (*ReadSectionResponse, error)
- func (c *Client) SearchArticles(options *SearchArticlesOptions) (*SearchArticlesResponse, error)
- func (c *Client) SendNotification(articleId string, alertBody string, countries []string, ignoreWarnings bool) (*NotificationResponse, error)
- func (c *Client) UpdateArticle(articleId string, revision string, article io.Reader, ...) (*ReadArticleResponse, error)
- func (c *Client) UpdateArticleMetadata(articleId string, metadata *Metadata) (*ReadArticleResponse, error)
- type ContentType
- type CoverArtType
- type Data
- type Links
- type ListSectionsResponse
- type MaturityRating
- type Meta
- type Metadata
- type MultipartUploadComponent
- type NotificationData
- type NotificationRequest
- type NotificationResponse
- type PromoteArticlesRequest
- type PromoteArticlesResponse
- type ReadArticleResponse
- type ReadChannelResponse
- type ReadSectionResponse
- type ResultPage
- type SearchArticlesOptions
- type SearchArticlesResponse
- type SearchResponseMeta
- type SearchResult
Constants ¶
View Source
const ( CountryEU = "EU" CountryGB = "GB" CountryUS = "US" )
View Source
const DefaultAppleNewsBaseURL = "https://news-api.apple.com"
View Source
const SORTDIR_ASC = "ASC"
View Source
const SORTDIR_DESC = "DESC"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Client *http.Client APIKey string APISecret string BaseURL string ChannelID string }
Client to communicate to Apple API
func (*Client) CreateArticle ¶
func (c *Client) CreateArticle(article io.Reader, bundleComponents []MultipartUploadComponent, metadata *Metadata) (*ReadArticleResponse, error)
func (*Client) DeleteArticle ¶
func (*Client) ListSections ¶
func (c *Client) ListSections() (*ListSectionsResponse, error)
func (*Client) PromoteArticles ¶
func (c *Client) PromoteArticles(sectionId string, articleIds []string) (*PromoteArticlesResponse, error)
func (*Client) ReadArticle ¶
func (c *Client) ReadArticle(articleId string) (*ReadArticleResponse, error)
func (*Client) ReadChannel ¶
func (c *Client) ReadChannel(channelId string) (*ReadChannelResponse, error)
func (*Client) ReadSection ¶
func (c *Client) ReadSection(sectionId string) (*ReadSectionResponse, error)
func (*Client) SearchArticles ¶
func (c *Client) SearchArticles(options *SearchArticlesOptions) (*SearchArticlesResponse, error)
func (*Client) SendNotification ¶
func (*Client) UpdateArticle ¶
func (c *Client) UpdateArticle(articleId string, revision string, article io.Reader, bundleComponents []MultipartUploadComponent, metadata *Metadata) (*ReadArticleResponse, error)
func (*Client) UpdateArticleMetadata ¶
func (c *Client) UpdateArticleMetadata(articleId string, metadata *Metadata) (*ReadArticleResponse, error)
type ContentType ¶
type ContentType string
const ( ContentTypeJpeg ContentType = "image/jpeg" ContentTypePng ContentType = "image/png" ContentTypeGif ContentType = "image/gif" ContentTypeOctetStream ContentType = "application/octet-stream" ContentTypeJson ContentType = "application/json" ContentTypeHtml ContentType = "text/html" ContentTypeCss ContentType = "text/css" ContentTypeJs ContentType = "text/javascript" ContentTypeManifest ContentType = "text/cache-manifest" ContentTypeMultipart ContentType = "multipart/form-data" MaturityRatingKids = "KIDS" MaturityRatingMature = "MATURE" MaturityRatingGeneral = "GENERAL" )
func GetContentType ¶
func GetContentType(extension string) (ContentType, error)
type CoverArtType ¶
type CoverArtType string
type Data ¶
type Data struct { Links Links `json:"links,omitempty"` IsSponsored bool `json:"isSponsored,omitempty"` IsPreview bool `json:"isPreview,omitempty"` AccessoryText string `json:"accessoryText,omitempty"` MaturityRating string `json:"maturityRating,omitempty"` IsCandidateToBeFeatured bool `json:"isCandidateToBeFeatured,omitempty"` IsDevelopingStory bool `json:"isDevelopingStory,omitempty"` IsHidden bool `json:"isHidden,omitempty"` Revision string `json:"revision,omitempty"` }
type ListSectionsResponse ¶
type ListSectionsResponse struct { Data []struct { CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` ID string `json:"id"` Type string `json:"type"` ShareURL string `json:"shareUrl"` Links Links `json:"links"` Name string `json:"name"` IsDefault bool `json:"isDefault"` } `json:"data"` }
type MaturityRating ¶
type MaturityRating string
type MultipartUploadComponent ¶
type MultipartUploadComponent struct { Data io.Reader Name string FileName string ContentType }
func GetBundleComponents ¶
func GetBundleComponents(articleJson io.Reader, bundleBasePath string) ([]MultipartUploadComponent, error)
type NotificationData ¶
type NotificationRequest ¶
type NotificationRequest struct {
NotificationData `json:"data"`
}
type NotificationResponse ¶
type NotificationResponse struct { Data struct { CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` ID string `json:"id"` Type string `json:"type"` Links struct { Article string `json:"article"` } `json:"links"` AlertBody string `json:"alertBody"` Countries []string `json:"countries"` } `json:"data"` Meta struct { Quotas struct { Daily struct { Sent int `json:"sent"` Limit int `json:"limit"` } `json:"daily"` } `json:"quotas"` } `json:"meta"` }
type PromoteArticlesRequest ¶
type PromoteArticlesRequest struct { Data struct { PromotedArticles []string `json:"promotedArticles"` } `json:"data"` }
type PromoteArticlesResponse ¶
type PromoteArticlesResponse struct { Data struct { PromotedArticles []string `json:"promotedArticles"` } `json:"data"` }
type ReadArticleResponse ¶
type ReadArticleResponse struct { Data struct { CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` ID string `json:"id"` Type string `json:"type"` ShareURL string `json:"shareUrl"` Links Links `json:"links"` Document interface{} `json:"document"` Revision string `json:"revision"` State string `json:"state"` AccessoryText string `json:"accessoryText"` Title string `json:"title"` MaturityRating string `json:"maturityRating"` Warnings []interface{} `json:"warnings"` TargetTerritoryCountryCodes []string `json:"targetTerritoryCountryCodes"` IsCandidateToBeFeatured bool `json:"isCandidateToBeFeatured"` IsSponsored bool `json:"isSponsored"` IsPreview bool `json:"isPreview"` IsDevelopingStory bool `json:"isDevelopingStory"` IsHidden bool `json:"isHidden"` } `json:"data"` Meta Meta `json:"meta,omitempty"` }
type ReadChannelResponse ¶
type ReadChannelResponse struct { Data struct { CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` ID string `json:"id"` Type string `json:"type"` ShareURL string `json:"shareUrl"` Links Links `json:"links"` Name string `json:"name"` Website string `json:"website"` } `json:"data"` }
type ReadSectionResponse ¶
type ReadSectionResponse struct { Data struct { CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` ID string `json:"id"` Type string `json:"type"` ShareURL string `json:"shareUrl"` Links Links `json:"links"` Name string `json:"name"` IsDefault bool `json:"isDefault"` } `json:"data"` }
type ResultPage ¶
type ResultPage struct {
Results []SearchResult
}
type SearchArticlesOptions ¶
type SearchArticlesOptions struct { SortDir string FromDate *time.Time ToDate *time.Time PageSize int PageToken string }
func DefaultSearchArticlesOptions ¶
func DefaultSearchArticlesOptions() *SearchArticlesOptions
func (*SearchArticlesOptions) ApplyToQuery ¶
func (options *SearchArticlesOptions) ApplyToQuery(query *url.Values)
type SearchArticlesResponse ¶
type SearchArticlesResponse struct { Data []struct { CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` ID string `json:"id"` Type string `json:"type"` ShareURL string `json:"shareUrl"` Links Links `json:"links"` Revision string `json:"revision"` State string `json:"state"` AccessoryText string `json:"accessoryText"` Title string `json:"title"` MaturityRating string `json:"maturityRating"` Warnings []interface{} `json:"warnings"` IsCandidateToBeFeatured bool `json:"isCandidateToBeFeatured"` IsSponsored bool `json:"isSponsored"` IsPreview bool `json:"isPreview"` IsDevelopingStory bool `json:"isDevelopingStory"` IsHidden bool `json:"isHidden"` } `json:"data"` Links Links `json:"links,omitempty"` Meta SearchResponseMeta `json:"meta,omitempty"` }
type SearchResponseMeta ¶
type SearchResponseMeta struct {
NextPageToken string `json:"nextPageToken,omitempty"`
}
type SearchResult ¶
Click to show internal directories.
Click to hide internal directories.