Files
m3o-go/thumbnail/thumbnail.go
2021-12-29 13:41:36 +00:00

42 lines
907 B
Go
Executable File

package thumbnail
import (
"go.m3o.com/client"
)
type Thumbnail interface {
Screenshot(*ScreenshotRequest) (*ScreenshotResponse, error)
}
func NewThumbnailService(token string) *ThumbnailService {
return &ThumbnailService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type ThumbnailService struct {
client *client.Client
}
// Create a thumbnail screenshot by passing in a url, height and width
func (t *ThumbnailService) Screenshot(request *ScreenshotRequest) (*ScreenshotResponse, error) {
rsp := &ScreenshotResponse{}
return rsp, t.client.Call("thumbnail", "Screenshot", request, rsp)
}
type ScreenshotRequest struct {
// height of the browser window, optional
Height int32 `json:"height"`
Url string `json:"url"`
// width of the browser window. optional
Width int32 `json:"width"`
}
type ScreenshotResponse struct {
ImageUrl string `json:"imageURL"`
}