Documentation
¶
Index ¶
- Constants
- Variables
- func MustNewWebhookURLString(input string, webhookVersion int) string
- func V1ToV2WebhookAttachment(v1att Attachment) v2.Attachment
- func V1ToV2WebhookBody(v1msg GlipWebhookMessage) v2.GlipWebhookMessage
- func V1ToV2WewbhookUri(input string) (string, error)
- type Attachment
- type Author
- type Field
- type Footnote
- type GlipWebhookClient
- func (client *GlipWebhookClient) PostMessage(message GlipWebhookMessage) (*http.Response, error)
- func (client *GlipWebhookClient) PostMessageFast(message GlipWebhookMessage) (*fasthttp.Request, *fasthttp.Response, error)
- func (client *GlipWebhookClient) PostWebhook(url string, message GlipWebhookMessage) (*http.Response, error)
- func (client *GlipWebhookClient) PostWebhookFast(url string, message GlipWebhookMessage) (*fasthttp.Request, *fasthttp.Response, error)
- func (client *GlipWebhookClient) PostWebhookGUID(guid string, message GlipWebhookMessage) (*http.Response, error)
- func (client *GlipWebhookClient) PostWebhookGUIDFast(guidOrURL string, message GlipWebhookMessage) (*fasthttp.Request, *fasthttp.Response, error)
- func (client *GlipWebhookClient) PostWebhookV1Bytes(url string, message []byte) (*http.Response, error)
- func (client *GlipWebhookClient) PostWebhookV2(url string, message v2.GlipWebhookMessage) (*http.Response, error)
- type GlipWebhookError
- type GlipWebhookErrorResponse
- type GlipWebhookMessage
- type GlipWebhookResponse
- type WebhookURL
Constants ¶
View Source
const ( ApiPathGlipFiles = "/restapi/v1.0/glip/files" ApiPathGlipGroups = "/restapi/v1.0/glip/groups" ApiPathGlipPosts = "/restapi/v1.0/glip/posts" GlipWebhookV1BaseURLProduction = "https://hooks.ringcentral.com/webhook/" GlipWebhookV2BaseURLProduction = "https://hooks.ringcentral.com/webhook/v2/" GlipWebhookV1BaseURLSandbox = "https://hooks-glip.devtest.ringcentral.com/webhook/" GlipWebhookV2BaseURLSandbox = "https://hooks-glip.devtest.ringcentral.com/webhook/v2/" AttachmentTypeCard = "Card" )
Variables ¶
View Source
var (
WebhookBaseURL string = "https://hooks.glip.com/webhook/"
)
Functions ¶
func MustNewWebhookURLString ¶ added in v0.4.0
func V1ToV2WebhookAttachment ¶
func V1ToV2WebhookAttachment(v1att Attachment) v2.Attachment
func V1ToV2WebhookBody ¶
func V1ToV2WebhookBody(v1msg GlipWebhookMessage) v2.GlipWebhookMessage
func V1ToV2WewbhookUri ¶
Types ¶
type Attachment ¶
type Attachment struct {
Type string `json:"card,omitempty"`
Color string `json:"color,omitempty"`
Pretext string `json:"pretext,omitempty"`
AuthorName string `json:"author_name,omitempty"`
AuthorLink string `json:"author_link,omitempty"`
AuthorIcon string `json:"author_icon,omitempty"`
Title string `json:"title,omitempty"`
TitleLink string `json:"title_link,omitempty"`
Fallback string `json:"fallback,omitempty"`
Fields []Field `json:"fields,omitempty"`
Text string `json:"text,omitempty"`
ImageURL string `json:"image_url,omitempty"`
ThumbnailURL string `json:"thumbnail_url,omitempty"`
TS int64 `json:"ts,omitempty"`
}
type GlipWebhookClient ¶
type GlipWebhookClient struct {
HttpClient *http.Client
FastClient fasthttp.Client
WebhookUrl string
// contains filtered or unexported fields
}
func NewGlipWebhookClient ¶
func NewGlipWebhookClient(urlOrGuid string, webhookVersion int) (GlipWebhookClient, error)
func NewGlipWebhookClientFast ¶
func NewGlipWebhookClientFast(urlOrGuid string, webhookVersion int) (GlipWebhookClient, error)
func (*GlipWebhookClient) PostMessage ¶
func (client *GlipWebhookClient) PostMessage(message GlipWebhookMessage) (*http.Response, error)
func (*GlipWebhookClient) PostMessageFast ¶
func (client *GlipWebhookClient) PostMessageFast(message GlipWebhookMessage) (*fasthttp.Request, *fasthttp.Response, error)
Request using fasthttp Recycle request and response using fasthttp.ReleaseRequest(req) and fasthttp.ReleaseResponse(resp)
func (*GlipWebhookClient) PostWebhook ¶
func (client *GlipWebhookClient) PostWebhook(url string, message GlipWebhookMessage) (*http.Response, error)
func (*GlipWebhookClient) PostWebhookFast ¶
func (client *GlipWebhookClient) PostWebhookFast(url string, message GlipWebhookMessage) (*fasthttp.Request, *fasthttp.Response, error)
func (*GlipWebhookClient) PostWebhookGUID ¶
func (client *GlipWebhookClient) PostWebhookGUID(guid string, message GlipWebhookMessage) (*http.Response, error)
func (*GlipWebhookClient) PostWebhookGUIDFast ¶
func (client *GlipWebhookClient) PostWebhookGUIDFast(guidOrURL string, message GlipWebhookMessage) (*fasthttp.Request, *fasthttp.Response, error)
func (*GlipWebhookClient) PostWebhookV1Bytes ¶ added in v0.2.0
func (*GlipWebhookClient) PostWebhookV2 ¶
func (client *GlipWebhookClient) PostWebhookV2(url string, message v2.GlipWebhookMessage) (*http.Response, error)
type GlipWebhookError ¶
type GlipWebhookError struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
HttpStatusCode int `json:"http_status_code,omitempty"`
ResponseData string `json:"response_data,omitempty"`
Response GlipWebhookErrorResponse `json:"response,omitempty"`
}
func (*GlipWebhookError) Inflate ¶
func (gwerr *GlipWebhookError) Inflate()
type GlipWebhookMessage ¶
type GlipWebhookMessage struct {
Icon string `json:"icon,omitempty"`
Activity string `json:"activity,omitempty"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
AttachmentType string `json:"attachment_type,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
}
type GlipWebhookResponse ¶
type GlipWebhookResponse struct {
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
Error GlipWebhookError `json:"error,omitempty"`
}
type WebhookURL ¶ added in v0.3.3
type WebhookURL struct {
// contains filtered or unexported fields
}
func NewWebhookURL ¶ added in v0.3.3
func NewWebhookURL(input string) (WebhookURL, error)
func (*WebhookURL) Id ¶ added in v0.3.3
func (w *WebhookURL) Id() string
func (*WebhookURL) IsGUID ¶ added in v0.3.3
func (w *WebhookURL) IsGUID() bool
func (*WebhookURL) OriginalInput ¶ added in v0.3.3
func (w *WebhookURL) OriginalInput() string
func (*WebhookURL) OriginalVersion ¶ added in v0.3.3
func (w *WebhookURL) OriginalVersion() int
func (*WebhookURL) V1URL ¶ added in v0.3.3
func (w *WebhookURL) V1URL() string
func (*WebhookURL) V2URL ¶ added in v0.3.3
func (w *WebhookURL) V2URL() string
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
bot_rest
command
|
|
|
find_team
command
|
|
|
post_attachment
command
|
|
|
post_simple
command
|
|
|
test_post
command
|
|
|
upload_file
command
|
|
|
webhook_inbound
command
|
|
|
webhook_outbound
command
|
|
|
cmd/build
command
|
|
Click to show internal directories.
Click to hide internal directories.