Documentation ¶
Index ¶
- Constants
- Variables
- func MustNewWebhookURLString(input string, webhookVersion int) string
- func PostFile(client *http.Client, serverURL, groupID, path string) (*http.Response, error)
- 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 GenericEvent
- type GlipEvent
- type GlipEventMention
- 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 TextMessageBody
- 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/" // #nosec G101 GlipWebhookV2BaseURLProduction = "https://hooks.ringcentral.com/webhook/v2/" // #nosec G101 GlipWebhookV1BaseURLSandbox = "https://hooks-glip.devtest.ringcentral.com/webhook/" // #nosec G101 GlipWebhookV2BaseURLSandbox = "https://hooks-glip.devtest.ringcentral.com/webhook/v2/" // #nosec G101 AttachmentTypeCard = "Card" HeaderValidationToken = "Validation-Token" )
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 ¶ added in v0.5.0
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 GenericEvent ¶ added in v0.5.0
type GlipEventMention ¶ added in v0.5.0
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
func NewGlipWebhookClientFast ¶
func NewGlipWebhookClientFast(urlOrGUID string, webhookVersion int) GlipWebhookClient
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 TextMessageBody ¶ added in v0.5.0
type TextMessageBody struct { ID string `json:"id,omitempty"` GroupID string `json:"groupId,omitempty"` Type string `json:"type,omitempty"` Text string `json:"text,omitempty"` CreatorID string `json:"creatorId,omitempty"` CreationTime time.Time `json:"creationTime,omitempty"` LastModifiedTime time.Time `json:"lastModifiedTime,omitempty"` Mentions []GlipEventMention `json:"mentions,omitempty"` EventType string `json:"eventType,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.5.0
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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.