| 1 | package slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.16 context/" |
| 5 | "errorsscip-go gomod github.com/golang/go/src go1.16 errors/" |
| 6 | "net/urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/" |
| 7 | ) |
| 8 | |
| 9 | type listPinsResponseFullscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull# struct { |
| 10 | Itemsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull#Items. []Itemscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Item# |
| 11 | Pagingscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull#Paging. `json:"paging"` |
| 12 | SlackResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull#SlackResponse. |
| 13 | } |
| 14 | |
| 15 | // AddPin pins an item in a channel |
| 16 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) AddPinscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#AddPin().(channel string, item ItemRefscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#) error { |
| 17 | return api.AddPinContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#AddPinContext().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), channel, item) |
| 18 | } |
| 19 | |
| 20 | // AddPinContext pins an item in a channel with a custom context |
| 21 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) AddPinContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#AddPinContext().(ctx contextscip-go gomod github.com/golang/go/src go1.16 context/.Contextscip-go gomod github.com/golang/go/src go1.16 context/Context#, channel string, item ItemRefscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#) error { |
| 22 | values := urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#{ |
| 23 | "channel": {channel}, |
| 24 | "token": {api.tokenscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#token.}, |
| 25 | } |
| 26 | if item.Timestampscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Timestamp. != "" { |
| 27 | values.Setscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#Set().("timestamp", item.Timestampscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Timestamp.) |
| 28 | } |
| 29 | if item.Filescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#File. != "" { |
| 30 | values.Setscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#Set().("file", item.Filescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#File.) |
| 31 | } |
| 32 | if item.Commentscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Comment. != "" { |
| 33 | values.Setscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#Set().("file_comment", item.Commentscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Comment.) |
| 34 | } |
| 35 | |
| 36 | response := &SlackResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#{} |
| 37 | if err := api.postMethodscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#postMethod().(ctx, "pins.add", values, response); err != nil { |
| 38 | return err |
| 39 | } |
| 40 | |
| 41 | return response.Errscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Err().() |
| 42 | } |
| 43 | |
| 44 | // RemovePin un-pins an item from a channel |
| 45 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) RemovePinscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#RemovePin().(channel string, item ItemRefscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#) error { |
| 46 | return api.RemovePinContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#RemovePinContext().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), channel, item) |
| 47 | } |
| 48 | |
| 49 | // RemovePinContext un-pins an item from a channel with a custom context |
| 50 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) RemovePinContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#RemovePinContext().(ctx contextscip-go gomod github.com/golang/go/src go1.16 context/.Contextscip-go gomod github.com/golang/go/src go1.16 context/Context#, channel string, item ItemRefscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#) error { |
| 51 | values := urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#{ |
| 52 | "channel": {channel}, |
| 53 | "token": {api.tokenscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#token.}, |
| 54 | } |
| 55 | if item.Timestampscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Timestamp. != "" { |
| 56 | values.Setscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#Set().("timestamp", item.Timestampscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Timestamp.) |
| 57 | } |
| 58 | if item.Filescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#File. != "" { |
| 59 | values.Setscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#Set().("file", item.Filescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#File.) |
| 60 | } |
| 61 | if item.Commentscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Comment. != "" { |
| 62 | values.Setscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#Set().("file_comment", item.Commentscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/ItemRef#Comment.) |
| 63 | } |
| 64 | |
| 65 | response := &SlackResponsescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#{} |
| 66 | if err := api.postMethodscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#postMethod().(ctx, "pins.remove", values, response); err != nil { |
| 67 | return err |
| 68 | } |
| 69 | |
| 70 | return response.Errscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Err().() |
| 71 | } |
| 72 | |
| 73 | // ListPins returns information about the items a user reacted to. |
| 74 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) ListPinsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#ListPins().(channel string) ([]Itemscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Item#, *Pagingscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Paging#, error) { |
| 75 | return api.ListPinsContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#ListPinsContext().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), channel) |
| 76 | } |
| 77 | |
| 78 | // ListPinsContext returns information about the items a user reacted to with a custom context. |
| 79 | func (api *Clientscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#) ListPinsContextscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#ListPinsContext().(ctx contextscip-go gomod github.com/golang/go/src go1.16 context/.Contextscip-go gomod github.com/golang/go/src go1.16 context/Context#, channel string) ([]Itemscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Item#, *Pagingscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Paging#, error) { |
| 80 | values := urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.16 `net/url`/Values#{ |
| 81 | "channel": {channel}, |
| 82 | "token": {api.tokenscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#token.}, |
| 83 | } |
| 84 | |
| 85 | response := &listPinsResponseFullscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull#{} |
| 86 | err := api.postMethodscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Client#postMethod().(ctx, "pins.list", values, response) |
| 87 | if err != nil { |
| 88 | return nil, nil, err |
| 89 | } |
| 90 | if !response.Okscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Ok. { |
| 91 | return nil, nil, errorsscip-go gomod github.com/golang/go/src go1.16 errors/.Newscip-go gomod github.com/golang/go/src go1.16 errors/New().(response.Errorscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/SlackResponse#Error.) |
| 92 | } |
| 93 | return response.Itemsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull#Items., &response.Pagingscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/listPinsResponseFull#Paging., nil |
| 94 | } |