diff options
author | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
commit | 51062863a5c34d81e296cf15c61140911037cf3b (patch) | |
tree | 9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/peterhellberg/giphy/gif.go | |
parent | 4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff) | |
download | matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2 matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip |
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/peterhellberg/giphy/gif.go')
-rw-r--r-- | vendor/github.com/peterhellberg/giphy/gif.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/vendor/github.com/peterhellberg/giphy/gif.go b/vendor/github.com/peterhellberg/giphy/gif.go deleted file mode 100644 index 8c317c97..00000000 --- a/vendor/github.com/peterhellberg/giphy/gif.go +++ /dev/null @@ -1,44 +0,0 @@ -package giphy - -import ( - "encoding/json" - "fmt" - "strings" -) - -// GIF returns a ID response from the Giphy API -func (c *Client) GIF(id string) (GIF, error) { - if strings.ContainsAny(id, "/&?") { - return GIF{}, fmt.Errorf("Invalid giphy id: `%v`", id) - } - - req, err := c.NewRequest("/gifs/" + id) - if err != nil { - return GIF{}, err - } - - var gif GIF - if _, err = c.Do(req, &gif); err != nil { - return GIF{}, err - } - - if gif.RawData == nil || gif.RawData[0] == '[' { - return GIF{}, ErrNoImageFound - } - - // Check if the first character in Data is a { - if gif.RawData[0] == '{' { - var d Data - - err = json.Unmarshal(gif.RawData, &d) - if err != nil { - return GIF{}, err - } - - gif.Data = d - - return gif, nil - } - - return GIF{}, ErrUnknown -} |