Documentation ¶
Overview ¶
Package slideshare provides API wrapper for SlideShare.
Index ¶
- func Btoa(input bool) string
- type DeletedSlideshow
- type EditedSlideshow
- type Favorite
- type Group
- type Groups
- type Service
- func (s *Service) AddFavorite(username string, password string, slideshow_id int) bool
- func (s *Service) CheckFavorite(username string, password string, slideshow_id int) (Favorite, error)
- func (s *Service) DeleteSlideshow(username string, password string, slideshowID int) bool
- func (s *Service) EditSlideshow(username string, password string, slideshowID int, additionalParams ...string) bool
- func (s *Service) GetSlideshow(id int, detailed bool) (Slideshow, error)
- func (s *Service) GetSlideshowsByTag(tag string, detailed bool, limitOffset ...int) (SlideshowsByTag, error)
- func (s *Service) GetSlideshowsByUser(username string, detailed bool, limitOffset ...int) (SlideshowsByUser, error)
- func (s *Service) GetUserContacts(username_for string, limitOffset ...int) (UserContacts, error)
- func (s *Service) GetUserFavorites(username_for string) (UserFavorites, error)
- func (s *Service) GetUserTags(username string, password string) (Tags, error)
- func (s *Service) SearchSlideshows(queryString string, detailed bool, additionalParams ...string) (SlideshowsSearch, error)
- func (s *Service) UploadSlideshow(username string, password string, uploadURL string, slideshowTitle string, ...) (int, bool)
- type Slideshow
- type SlideshowsByTag
- type SlideshowsByUser
- type SlideshowsSearch
- type Tags
- type UploadedSlideshow
- type UserContact
- type UserContacts
- type UserFavorite
- type UserFavorites
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeletedSlideshow ¶
type DeletedSlideshow struct {
DeletedID int `xml:"SlideshowID"`
}
type EditedSlideshow ¶
type EditedSlideshow struct {
EditedID int `xml:"SlideShowID"`
}
type Favorite ¶
type Favorite struct { SlideshowID int `xml:"SlideshowID"` UserID uint64 `xml:"User"` Favorited bool `xml:"Favorited"` }
Favorite type keeps the information about favorited slideshow by the user
type Service ¶
type Service struct { ApiKey string }
Type Service defines the service, it needs Api key and Shared Secret you can obtain them from slideshare website.
func (*Service) AddFavorite ¶
Add favorite favorites a slideshow. Needs username and password of the requesting user and id of the slideshow to be favorited.
func (*Service) CheckFavorite ¶
func (s *Service) CheckFavorite(username string, password string, slideshow_id int) (Favorite, error)
Check user favorite needs username and password of the requesting user and id of the slideshow which is being checked, whether is favorited by the user.
func (*Service) DeleteSlideshow ¶
Delete a slideshow needs username and password of the requesting user and slideshow ID.
func (*Service) EditSlideshow ¶
func (s *Service) EditSlideshow(username string, password string, slideshowID int, additionalParams ...string) bool
Edit a Slideshow needs username and password of the owner of the requesting user and slideshow id other parameters are new title, new tags and make the slideshow private, generate secret url, allow embeds and share with contacts are optinal.You have to pass their values like strigs.
func (*Service) GetSlideshow ¶
GetSlideshow returns information about a slideshow needs id of the slideshow to be fetched, and detailed flag.
Example ¶
You have to get API_KEY & SHARED_SECRET from Slideshare Here we are creating our service by providing the API_KEY & SHARED_SECRET After we call the method GetSlideshow with the Slideshow ID and without detailed information if you want detailed information for the slideshow, second argument has to be true, if everything is ok we have slideshow object with all the properties.
service := slideshare.Service{"5Pl6RFlI", "X1lMfjPo"} slideshow, err := service.GetSlideshow(30975136, false) if err != nil { fmt.Println("Error:") fmt.Println(err) } fmt.Println("ID:", slideshow.ID) fmt.Println("Title:", slideshow.Title) fmt.Println("Username:", slideshow.Username)
Output: ID: 30975136 Title: Do not delete! Username: ddishev
func (*Service) GetSlideshowsByTag ¶
func (s *Service) GetSlideshowsByTag(tag string, detailed bool, limitOffset ...int) (SlideshowsByTag, error)
GetSlideshowByTag need tag name and detailed flag limit and offset are optional if they are used, should be passed in that way limit first then offset.
Example ¶
Getting slideshows which have "sql" tag.
service := slideshare.Service{"5Pl6RFlI", "X1lMfjPo"} slideshows, err := service.GetSlideshowsByTag("dishev", false) if err != nil { fmt.Println("Error:") fmt.Println(err) } fmt.Println("ID:", slideshows.Slideshows[0].ID) fmt.Println("Title:", slideshows.Slideshows[0].Title) fmt.Println("Username:", slideshows.Slideshows[0].Username)
Output: ID: 30975136 Title: Do not delete! Username: ddishev
func (*Service) GetSlideshowsByUser ¶
func (s *Service) GetSlideshowsByUser(username string, detailed bool, limitOffset ...int) (SlideshowsByUser, error)
GetSlideshowByUser needs username and detailed flag arguments, others like limit and offset are optional.Should be passed in that way limit first then offset.
Example ¶
service := slideshare.Service{"5Pl6RFlI", "X1lMfjPo"} slideshows, err := service.GetSlideshowsByUser("ddishev", false) lastSlideshowIndex := slideshows.Count - 1 if err != nil { fmt.Println("Error:") fmt.Println(err) } fmt.Println("ID:", slideshows.Slideshows[lastSlideshowIndex].ID) fmt.Println("Title:", slideshows.Slideshows[lastSlideshowIndex].Title) fmt.Println("Username:", slideshows.Slideshows[lastSlideshowIndex].Username)
Output: ID: 30975136 Title: Do not delete! Username: ddishev
func (*Service) GetUserContacts ¶
func (s *Service) GetUserContacts(username_for string, limitOffset ...int) (UserContacts, error)
GetUserContacts needs username of user whose Contacts are being requested. You can 1 additional parameter int to specify number of items to return.
func (*Service) GetUserFavorites ¶
func (s *Service) GetUserFavorites(username_for string) (UserFavorites, error)
GetUserFavorites needs username of user whose Favorites are being requested.
func (*Service) GetUserTags ¶
GetUserTags needs username and password of the requesting user.
func (*Service) SearchSlideshows ¶
func (s *Service) SearchSlideshows(queryString string, detailed bool, additionalParams ...string) (SlideshowsSearch, error)
Search for a slideshow needs query string and detailed flag arguments Optional are page default is 1, items per page default is 12, sort type default is relevance, and upload date default is any If you want to change the default values of additional parameters, you should pass them like that: page,items_per_page,sort,upload_date and values casted to string.
func (*Service) UploadSlideshow ¶
func (s *Service) UploadSlideshow(username string, password string, uploadURL string, slideshowTitle string, additionalParams ...string) (int, bool)
This method requires extra permissions. If you want to upload a file using SlideShare API, please send an email to api@slideshare.com with your developer account username describing the use case. The method requires username and password of the requesting user, title and upload url string containing an url pointing to the power point file: ex: http://domain.tld/directory/my_power_point.ppt The following urls are also acceptable http://www.domain.tld/directory/file.ppt http://www.domain.tld/directory/file.cgi?filename=file.ppt Optinal parameters are description of the slideshow and slideshow tags.
type Slideshow ¶
type Slideshow struct { ID uint64 `xml:"ID"` Title string `xml:"Title"` Description string `xml:"Description"` Username string `xml:"Username"` Status uint8 `xml:"Status"` Url string `xml:"URL"` ThumbnailUrl string `xml:"ThumbnailURL"` ThumbnailSize string `xml:"ThumbnailSize"` ThumbnailSmallUrl string `xml:"ThumbnailSmallURL"` Embed string `xml:"Embed"` Created string `xml:"Created"` Updated string `xml:"Updated"` Language string `xml:"Language"` Format string `xml:"Format"` Download bool `xml:"Download"` DownloadUrl string `xml:"DownloadUrl"` SlideshowType uint8 `xml:"SlideshowType"` InContest bool `xml:"InContest"` UserID uint64 `xml:"UserID"` PPTLocation string `xml:"PPTLocation"` StrippedTitle string `xml:"StrippedTitle"` Tags []string `xml:"Tags>Tag"` Audio bool `xml:"Audio"` NumDownloads uint32 `xml:"NumDownloads"` NumViews uint32 `xml:"NumViews"` NumComments uint32 `xml:"NumComments"` NumFavorites uint32 `xml:"NumFavorites"` NumSlides uint16 `xml:"NumSlides"` RelatedSlideshows []uint64 `xml:"RelatedSlideshows>RelatedSlideshowID"` PrivacyLevel bool `xml:"PrivacyLevel"` FlagVisible bool `xml:"FlagVisible"` ShowOnSS bool `xml:"ShowOnSS"` SecretURL bool `xml:"SecretUrl"` AllowEmbed bool `xml:"AllowEmbed"` }
Slideshow type, which holds all the information about a slideshow properties bellow InContest are detailed, they will have reliabe information if detailed flag is set to true.
type SlideshowsByTag ¶
type SlideshowsByTag struct { TagName string `xml:"Name"` Count uint32 `xml:"Count"` Slideshows []Slideshow `xml:"Slideshow"` }
SlideshowsByTag struct keeps the Tag we are looking for Count of all found slideshow and array with them.
type SlideshowsByUser ¶
type SlideshowsByUser struct { UserName string `xml:"Name"` Count uint32 `xml:"Count"` Slideshows []Slideshow `xml:"Slideshow"` }
SlideshowsByUser struct keeps the username we are looking for Count of all found slideshow and array with them.
type SlideshowsSearch ¶
type SlideshowsSearch struct { QueryString string `xml:"Meta>Query"` NumResults uint32 `xml:"Meta>NumResults"` TotalResults uint64 `xml:"Meta>TotalResults"` Slideshows []Slideshow `xml:"Slideshow"` }
SlideshowsByUser struct keeps the query string. offset of the result,results per page and total results and array with slideshows.
type UploadedSlideshow ¶
type UploadedSlideshow struct {
UploadedID int `xml:"SlideShowID"`
}
type UserContact ¶
type UserContacts ¶
type UserContacts struct {
Values []UserContact `xml:"Contact"`
}
type UserFavorite ¶
type UserFavorites ¶
type UserFavorites struct {
Values []UserFavorite `xml:"favorite"`
}