Documentation ¶
Overview ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service ¶
Package groupme defines a client capable of executing API commands for the GroupMe chat service
Index ¶
- Constants
- Variables
- type Attachment
- type Block
- type Bot
- type ChangeOwnerRequest
- type ChangeOwnerResult
- type Chat
- type Client
- func (c *Client) AddMembers(ctx context.Context, groupID ID, authToken string, members ...*Member) (string, error)
- func (c *Client) AddMembersResults(ctx context.Context, groupID ID, resultID string, authToken string) ([]*Member, error)
- func (c *Client) BlockBetween(ctx context.Context, userID, otherUserID string, authToken string) (bool, error)
- func (c *Client) ChangeGroupOwner(ctx context.Context, reqs ChangeOwnerRequest, authToken string) (ChangeOwnerResult, error)
- func (c *Client) Close() error
- func (c *Client) CreateBlock(ctx context.Context, userID, otherUserID string, authToken string) (*Block, error)
- func (c *Client) CreateBot(ctx context.Context, bot *Bot, authToken string) (*Bot, error)
- func (c *Client) CreateDirectMessage(ctx context.Context, m *Message, authToken string) (*Message, error)
- func (c *Client) CreateGroup(ctx context.Context, gs GroupSettings, authToken string) (*Group, error)
- func (c *Client) CreateLike(ctx context.Context, conversationID, messageID ID, authToken string) error
- func (c *Client) CreateMessage(ctx context.Context, groupID ID, m *Message, authToken string) (*Message, error)
- func (c *Client) CreateSMSMode(ctx context.Context, duration int, registrationID *ID, authToken string) error
- func (c *Client) DeleteSMSMode(ctx context.Context, authToken string) error
- func (c *Client) DestroyBot(ctx context.Context, botID ID, authToken string) error
- func (c *Client) DestroyGroup(ctx context.Context, groupID ID, authToken string) error
- func (c *Client) DestroyLike(ctx context.Context, conversationID, messageID ID, authToken string) error
- func (c *Client) FormerGroups(ctx context.Context, authToken string) ([]*Group, error)
- func (c *Client) IndexBlock(ctx context.Context, userID string, authToken string) ([]*Block, error)
- func (c *Client) IndexBots(ctx context.Context, authToken string) ([]*Bot, error)
- func (c *Client) IndexChats(ctx context.Context, req *IndexChatsQuery, authToken string) ([]*Chat, error)
- func (c *Client) IndexDirectMessages(ctx context.Context, otherUserID string, req *IndexDirectMessagesQuery, ...) (IndexDirectMessagesResponse, error)
- func (c *Client) IndexGroups(ctx context.Context, req *GroupsQuery, authToken string) ([]*Group, error)
- func (c *Client) IndexLeaderboard(ctx context.Context, groupID ID, p period, authToken string) ([]*Message, error)
- func (c *Client) IndexMessages(ctx context.Context, groupID ID, req *IndexMessagesQuery, authToken string) (IndexMessagesResponse, error)
- func (c *Client) IndexRelations(ctx context.Context, authToken string) ([]*User, error)
- func (c *Client) JoinGroup(ctx context.Context, groupID ID, shareToken string, authToken string) (*Group, error)
- func (c *Client) MyHitsLeaderboard(ctx context.Context, groupID ID, authToken string) ([]*Message, error)
- func (c *Client) MyLikesLeaderboard(ctx context.Context, groupID ID, authToken string) ([]*Message, error)
- func (c *Client) MyUser(ctx context.Context, authToken string) (*User, error)
- func (c *Client) PostBotMessage(ctx context.Context, botID ID, text string, pictureURL *string) error
- func (c *Client) RejoinGroup(ctx context.Context, groupID ID, authToken string) (*Group, error)
- func (c *Client) RemoveMember(ctx context.Context, groupID, membershipID ID, authToken string) error
- func (c *Client) ShowGroup(ctx context.Context, groupID ID, authToken string) (*Group, error)
- func (c Client) String() string
- func (c *Client) Unblock(ctx context.Context, userID, otherUserID string, authToken string) error
- func (c *Client) UpdateGroup(ctx context.Context, groupID ID, gs GroupSettings, authToken string) (*Group, error)
- func (c *Client) UpdateMember(ctx context.Context, groupID ID, nickname string, authToken string) (*Member, error)
- func (c *Client) UpdateMyUser(ctx context.Context, us UserSettings, authToken string) (*User, error)
- type Group
- type GroupMessages
- type GroupSettings
- type GroupsQuery
- type HTTPStatusCode
- type HandleGroupAvatar
- type HandleGroupLikeIcon
- type HandleGroupName
- type HandleGroupTopic
- type HandleMemberNewAvatar
- type HandleMemberNewNickname
- type HandleMembers
- type Handler
- type HandlerAll
- type HandlerLike
- type HandlerMembership
- type HandlerText
- type ID
- type IndexChatsQuery
- type IndexDirectMessagesQuery
- type IndexDirectMessagesResponse
- type IndexMessagesQuery
- type IndexMessagesResponse
- type Member
- type Message
- type MessagePreview
- type Meta
- type PhoneNumber
- type PushSubscription
- func (r *PushSubscription) AddFullHandler(h HandlerAll, authToken string)
- func (r *PushSubscription) AddHandler(h Handler, authToken string)
- func (r *PushSubscription) Connect(context context.Context) error
- func (r *PushSubscription) Connected() bool
- func (r *PushSubscription) SubscribeToDM(context context.Context, id ID, authToken string) error
- func (r *PushSubscription) SubscribeToGroup(context context.Context, id ID, authToken string) error
- func (r *PushSubscription) SubscribeToUser(context context.Context, id ID, authToken string) error
- type Timestamp
- type User
- type UserSettings
Constants ¶
const ( ChangeOwnerOk changeOwnerStatusCode = "200" ChangeOwnerRequesterNewOwner changeOwnerStatusCode = "400" ChangeOwnerNotOwner changeOwnerStatusCode = "403" ChangeOwnerBadGroupOrOwner changeOwnerStatusCode = "404" ChangeOwnerBadRequest changeOwnerStatusCode = "405" )
Change owner Status Codes
const ( SenderTypeUser senderType = "user" SenderTypeBot senderType = "bot" SenderTypeSystem senderType = "system" )
SenderType constants
const ( Mentions attachmentType = "mentions" Image attachmentType = "image" Location attachmentType = "location" Emoji attachmentType = "emoji" )
AttachmentType constants
const ( PeriodDay = "day" PeriodWeek = "week" PeriodMonth = "month" )
Define acceptable period values
const GroupMeAPIBase = "https://api.groupme.com/v3"
GroupMeAPIBase - Endpoints are added on to this to get the full URI. Overridable for testing
const (
PushServer = "wss://push.groupme.com/faye"
)
Variables ¶
var ( ErrHandlerNotFound = errors.New("Handler not found") ErrListenerNotStarted = errors.New("GroupMe listener not started") )
var RealTimeHandlers map[string]func(r *PushSubscription, channel string, authToken string, data ...interface{})
var RealTimeSystemHandlers map[string]func(r *PushSubscription, channel string, id ID, authToken string, rawData []byte)
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { Type attachmentType `json:"type,omitempty"` Loci [][]int `json:"loci,omitempty"` UserIDs []ID `json:"user_ids,omitempty"` URL string `json:"url,omitempty"` FileID string `json:"file_id,omitempty"` VideoPreviewURL string `json:"preview_url,omitempty"` Name string `json:"name,omitempty"` Latitude string `json:"lat,omitempty"` Longitude string `json:"lng,omitempty"` Placeholder string `json:"placeholder,omitempty"` Charmap [][]int `json:"charmap,omitempty"` ReplyID ID `json:"reply_id,omitempty"` }
Attachment is a GroupMe message attachment, returned in JSON API responses
func (*Attachment) String ¶
func (a *Attachment) String() string
type Block ¶
type Block struct { UserID ID `json:"user_id,omitempty"` BlockedUserID ID `json:"blocked_user_id,omitempty"` CreatedAT Timestamp `json:"created_at,omitempty"` }
Block is a GroupMe block between two users, direct messages are not allowed
type Bot ¶
type Bot struct { BotID ID `json:"bot_id,omitempty"` GroupID ID `json:"group_id,omitempty"` Name string `json:"name,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` CallbackURL string `json:"callback_url,omitempty"` DMNotification bool `json:"dm_notification,omitempty"` }
Bot is a GroupMe bot, it is connected to a specific group which it can send messages to
type ChangeOwnerRequest ¶
type ChangeOwnerRequest struct { // Required GroupID string `json:"group_id"` // Required. UserId of the new owner of the group // who must be an active member of the group OwnerID string `json:"owner_id"` }
ChangeOwnerRequest defines the new owner of a group
func (ChangeOwnerRequest) String ¶
func (r ChangeOwnerRequest) String() string
type ChangeOwnerResult ¶
type ChangeOwnerResult struct { GroupID string `json:"group_id"` // UserId of the new owner of the group who is // an active member of the group OwnerID string `json:"owner_id"` Status changeOwnerStatusCode `json:"status"` }
ChangeOwnerResult holds the status of the group owner change
func (ChangeOwnerResult) String ¶
func (r ChangeOwnerResult) String() string
type Chat ¶
type Chat struct { CreatedAt Timestamp `json:"created_at,omitempty"` UpdatedAt Timestamp `json:"updated_at,omitempty"` LastMessage *Message `json:"last_message,omitempty"` MessagesCount int `json:"messages_count,omitempty"` OtherUser User `json:"other_user,omitempty"` }
Chat is a GroupMe direct message conversation between two users, returned in JSON API responses
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with the GroupMe API to perform actions on the basic types, i.e. Listing, Creating, Destroying
func (*Client) AddMembers ¶
func (c *Client) AddMembers(ctx context.Context, groupID ID, authToken string, members ...*Member) (string, error)
AddMembers -
Add members to a group.
Multiple members can be added in a single request, and results are fetchedwith a separate call (since memberships are processed asynchronously). The response includes a results_id that's used in the results request.
In order to correlate request params with resulting memberships, GUIDs can be added to the members parameters. These GUIDs will be reflected in the membership JSON objects.
Parameters:
groupID - required, ID(string) See Member. Nickname - required One of the following identifiers must be used: UserID - ID(string) PhoneNumber - PhoneNumber(string) Email - string
func (*Client) AddMembersResults ¶
func (c *Client) AddMembersResults(ctx context.Context, groupID ID, resultID string, authToken string) ([]*Member, error)
AddMembersResults - Get the membership results from an add call.
Successfully created memberships will be returned, including any GUIDs that were sent up in the add request. If GUIDs were absent, they are filled in automatically. Failed memberships and invites are omitted.
Keep in mind that results are temporary -- they will only be available for 1 hour after the add request.
Parameters:
groupID - required, ID(string) resultID - required, string
func (*Client) BlockBetween ¶
func (c *Client) BlockBetween(ctx context.Context, userID, otherUserID string, authToken string) (bool, error)
BlockBetween - Asks if a block exists between you and another user id
func (*Client) ChangeGroupOwner ¶
func (c *Client) ChangeGroupOwner(ctx context.Context, reqs ChangeOwnerRequest, authToken string) (ChangeOwnerResult, error)
ChangeGroupOwner - Change owner of requested groups.
This action is only available to the group creator.
Response is a result object which contain status field, the result of change owner action for the request
Parameters: See ChangeOwnerRequest
func (*Client) CreateBlock ¶
func (c *Client) CreateBlock(ctx context.Context, userID, otherUserID string, authToken string) (*Block, error)
CreateBlock - Creates a block between you and the contact
func (*Client) CreateBot ¶
CreateBot - Create a bot. See the Bots Tutorial (https://dev.groupme.com/tutorials/bots) for a full walkthrough.
func (*Client) CreateDirectMessage ¶
func (c *Client) CreateDirectMessage(ctx context.Context, m *Message, authToken string) (*Message, error)
CreateDirectMessage - Send a DM to another user
If you want to attach an image, you must first process it through our image service.
Attachments of type emoji rely on data from emoji PowerUps.
Clients use a placeholder character in the message text and specify a replacement charmap to substitute emoji characters
The character map is an array of arrays containing rune data ([[{pack_id,offset}],...]).
func (*Client) CreateGroup ¶
func (c *Client) CreateGroup(ctx context.Context, gs GroupSettings, authToken string) (*Group, error)
CreateGroup -
Create a new group ¶
Parameters: See GroupSettings
func (*Client) CreateLike ¶
func (c *Client) CreateLike(ctx context.Context, conversationID, messageID ID, authToken string) error
CreateLike - Like a message.
func (*Client) CreateMessage ¶
func (c *Client) CreateMessage(ctx context.Context, groupID ID, m *Message, authToken string) (*Message, error)
CreateMessage - Send a message to a group
If you want to attach an image, you must first process it through our image service.
Attachments of type emoji rely on data from emoji PowerUps.
Clients use a placeholder character in the message text and specify a replacement charmap to substitute emoji characters
The character map is an array of arrays containing rune data ([[{pack_id,offset}],...]).
The placeholder should be a high-point/invisible UTF-8 character.
func (*Client) CreateSMSMode ¶
func (c *Client) CreateSMSMode(ctx context.Context, duration int, registrationID *ID, authToken string) error
CreateSMSMode - Enables SMS mode for N hours, where N is at most 48. After N hours have elapsed, user will receive push notfications.
Parameters:
duration - required, integer registration_id - string; The push notification ID/token that should be suppressed during SMS mode. If this is omitted, both SMS and push notifications will be delivered to the device.
func (*Client) DestroyBot ¶
DestroyBot - Remove a bot that you have created
func (*Client) DestroyGroup ¶
DestroyGroup -
Disband a group ¶
This action is only available to the group creator ¶
Parameters:
groupID - required, ID(string)
func (*Client) DestroyLike ¶
func (c *Client) DestroyLike(ctx context.Context, conversationID, messageID ID, authToken string) error
DestroyLike - Unlike a message.
func (*Client) IndexBlock ¶
IndexBlock - A list of contacts you have blocked. These people cannot DM you
func (*Client) IndexChats ¶
func (c *Client) IndexChats(ctx context.Context, req *IndexChatsQuery, authToken string) ([]*Chat, error)
IndexChats - Returns a paginated list of direct message chats, or conversations, sorted by updated_at descending.
func (*Client) IndexDirectMessages ¶
func (c *Client) IndexDirectMessages(ctx context.Context, otherUserID string, req *IndexDirectMessagesQuery, authToken string) (IndexDirectMessagesResponse, error)
IndexDirectMessages -
Fetch direct messages between two users.
DMs are returned in groups of 20, ordered by created_at descending.
If no messages are found (e.g. when filtering with since_id) we return code 304.
Note that for historical reasons, likes are returned as an array of user ids in the favorited_by key.
Parameters:
otherUserID - required, ID(string); the other participant in the conversation. See IndexDirectMessagesQuery
func (*Client) IndexGroups ¶
func (c *Client) IndexGroups(ctx context.Context, req *GroupsQuery, authToken string) ([]*Group, error)
IndexGroups -
List the authenticated user's active groups.
The response is paginated, with a default of 10 groups per page.
Please consider using of omit=memberships parameter. Not including member lists might significantly improve user experience of your app for users who are participating in huge groups.
Parameters: See GroupsQuery
func (*Client) IndexLeaderboard ¶
func (c *Client) IndexLeaderboard(ctx context.Context, groupID ID, p period, authToken string) ([]*Message, error)
IndexLeaderboard - A list of the liked messages in the group for a given period of time. Messages are ranked in order of number of likes.
func (*Client) IndexMessages ¶
func (c *Client) IndexMessages(ctx context.Context, groupID ID, req *IndexMessagesQuery, authToken string) (IndexMessagesResponse, error)
IndexMessages - Retrieves messages for a group. By default, messages are returned in groups of 20, ordered by created_at descending. This can be raised or lowered by passing a limit parameter, up to a maximum of 100 messages. Messages can be scanned by providing a message ID as either the before_id, since_id, or after_id parameter. If before_id is provided, then messages immediately preceding the given message will be returned, in descending order. This can be used to continually page back through a group's messages. The after_id parameter will return messages that immediately follow a given message, this time in ascending order (which makes it easy to pick off the last result for continued pagination). Finally, the since_id parameter also returns messages created after the given message, but it retrieves the most recent messages. For example, if more than twenty messages are created after the since_id message, using this parameter will omit the messages that immediately follow the given message. This is a bit counterintuitive, so take care. If no messages are found (e.g. when filtering with before_id) we return code 304. Note that for historical reasons, likes are returned as an array of user ids in the favorited_by key.
func (*Client) IndexRelations ¶
func (*Client) JoinGroup ¶
func (c *Client) JoinGroup(ctx context.Context, groupID ID, shareToken string, authToken string) (*Group, error)
JoinGroup -
Join a shared group ¶
Parameters:
groupID - required, ID(string) shareToken - required, string
func (*Client) MyHitsLeaderboard ¶
func (c *Client) MyHitsLeaderboard(ctx context.Context, groupID ID, authToken string) ([]*Message, error)
MyHitsLeaderboard -
A list of messages you have liked. Messages are returned in reverse chrono-order. Note that the payload includes a liked_at timestamp in ISO-8601 format.
Parameters:
groupID - required, ID(string)
func (*Client) MyLikesLeaderboard ¶
func (c *Client) MyLikesLeaderboard(ctx context.Context, groupID ID, authToken string) ([]*Message, error)
MyLikesLeaderboard -
A list of messages you have liked. Messages are returned in reverse chrono-order. Note that the payload includes a liked_at timestamp in ISO-8601 format.
Parameters:
groupID - required, ID(string)
func (*Client) PostBotMessage ¶
func (c *Client) PostBotMessage(ctx context.Context, botID ID, text string, pictureURL *string) error
PostBotMessage - Post a message from a bot TODO: Move PostBotMessage to bot object, since it doesn't require access token
func (*Client) RejoinGroup ¶
RejoinGroup -
Rejoin a group. Only works if you previously removed yourself.
Parameters:
groupID - required, ID(string)
func (*Client) RemoveMember ¶
func (c *Client) RemoveMember(ctx context.Context, groupID, membershipID ID, authToken string) error
RemoveMember -
Remove a member (or yourself) from a group.
Note: The creator of the group cannot be removed or exit.
Parameters:
groupID - required, ID(string) membershipID - required, ID(string). Not the same as userID
func (*Client) ShowGroup ¶
ShowGroup -
Loads a specific group.
Parameters:
groupID - required, ID(string)
func (*Client) UpdateGroup ¶
func (c *Client) UpdateGroup(ctx context.Context, groupID ID, gs GroupSettings, authToken string) (*Group, error)
UpdateGroup -
Update a group after creation ¶
Parameters:
groupID - required, ID(string) See GroupSettings
func (*Client) UpdateMember ¶
func (c *Client) UpdateMember(ctx context.Context, groupID ID, nickname string, authToken string) (*Member, error)
UpdateMember -
Update your nickname in a group. The nickname must be between 1 and 50 characters.
func (*Client) UpdateMyUser ¶
func (c *Client) UpdateMyUser(ctx context.Context, us UserSettings, authToken string) (*User, error)
UpdateMyUser -
Update attributes about your own account ¶
Parameters: See UserSettings
type Group ¶
type Group struct { ID ID `json:"id,omitempty"` Name string `json:"name,omitempty"` // Type of group (private|public) Type string `json:"type,omitempty"` Description string `json:"description,omitempty"` ImageURL string `json:"image_url,omitempty"` CreatorUserID ID `json:"creator_user_id,omitempty"` CreatedAt Timestamp `json:"created_at,omitempty"` UpdatedAt Timestamp `json:"updated_at,omitempty"` Members []*Member `json:"members,omitempty"` Messages GroupMessages `json:"messages,omitempty"` }
Group is a GroupMe group, returned in JSON API responses
func (*Group) GetMemberByNickname ¶
GetMemberByNickname gets the group member by their Nickname, nil if no member matches
func (*Group) GetMemberByUserID ¶
GetMemberByUserID gets the group member by their UserID, nil if no member matches
type GroupMessages ¶
type GroupMessages struct { Count uint `json:"count,omitempty"` LastMessageID ID `json:"last_message_id,omitempty"` LastMessageCreatedAt Timestamp `json:"last_message_created_at,omitempty"` Preview MessagePreview `json:"preview,omitempty"` }
GroupMessages is a Group field, only returned in Group JSON API responses
type GroupSettings ¶
type GroupSettings struct { // Required. Primary name of the group. Maximum 140 characters Name string `json:"name"` // A subheading for the group. Maximum 255 characters Description string `json:"description"` // GroupMe Image Service URL ImageURL string `json:"image_url"` // Defaults false. If true, disables notifications for all members. // Documented for use only for UpdateGroup OfficeMode bool `json:"office_mode"` // Anyone with the URL can join the group Share bool `json:"share"` }
GroupSettings is the settings for a group, used by CreateGroup and UpdateGroup
func (GroupSettings) String ¶
func (gss GroupSettings) String() string
type GroupsQuery ¶
type GroupsQuery struct { // Fetch a particular page of results. Defaults to 1. Page int `json:"page"` // Define page size. Defaults to 10. PerPage int `json:"per_page"` // Comma separated list of data to omit from output. // Currently supported value is only "memberships". // If used then response will contain empty (null) members field. Omit string `json:"omit"` }
GroupsQuery defines optional URL parameters for IndexGroups
func (GroupsQuery) String ¶
func (q GroupsQuery) String() string
type HTTPStatusCode ¶
type HTTPStatusCode int
HTTPStatusCode are returned by HTTP requests in the header and the json "meta" field
const ( HTTPOk HTTPStatusCode = 200 HTTPCreated HTTPStatusCode = 201 HTTPNoContent HTTPStatusCode = 204 HTTPNotModified HTTPStatusCode = 304 HTTPBadRequest HTTPStatusCode = 400 HTTPForbidden HTTPStatusCode = 403 HTTPNotFound HTTPStatusCode = 404 HTTPEnhanceYourCalm HTTPStatusCode = 420 HTTPInternalServerError HTTPStatusCode = 500 HTTPBadGateway HTTPStatusCode = 502 )
Text used as constant name
func (HTTPStatusCode) String ¶
func (c HTTPStatusCode) String() string
String returns the description of the status code according to GroupMe
type HandleGroupAvatar ¶
type HandleGroupLikeIcon ¶
type HandleGroupName ¶
type HandleGroupTopic ¶
Group Handlers
type HandleMemberNewAvatar ¶
type HandleMemberNewNickname ¶
Group member handlers
type HandleMembers ¶
type HandlerAll ¶
type HandlerAll interface { Handler //of self HandlerText HandlerLike HandlerMembership //of group HandleGroupTopic HandleGroupAvatar HandleGroupName HandleGroupLikeIcon //of group members HandleMemberNewNickname HandleMemberNewAvatar HandleMembers }
type HandlerLike ¶
type HandlerLike interface {
HandleLike(Message)
}
type HandlerMembership ¶
type HandlerMembership interface {
HandleJoin(ID)
}
type HandlerText ¶
type HandlerText interface {
HandleTextMessage(Message)
}
type IndexChatsQuery ¶
type IndexChatsQuery struct { // Page Number Page int `json:"page"` // Number of chats per page PerPage int `json:"per_page"` }
IndexChatsQuery defines the optional URL parameters for IndexChats
type IndexDirectMessagesQuery ¶
type IndexDirectMessagesQuery struct { // Returns 20 messages created before the given message ID BeforeID ID `json:"before_id"` // Returns 20 messages created after the given message ID SinceID ID `json:"since_id"` }
IndexDirectMessagesQuery defines the optional URL parameters for IndexDirectMessages
func (IndexDirectMessagesQuery) String ¶
func (q IndexDirectMessagesQuery) String() string
type IndexDirectMessagesResponse ¶
type IndexDirectMessagesResponse struct { Count int `json:"count"` Messages []*Message `json:"direct_messages"` }
IndexDirectMessagesResponse contains the count and set of messages returned by the IndexDirectMessages API request
func (IndexDirectMessagesResponse) String ¶
func (r IndexDirectMessagesResponse) String() string
type IndexMessagesQuery ¶
type IndexMessagesQuery struct { // Returns messages created before the given message ID BeforeID ID // Returns most recent messages created after the given message ID SinceID ID // Returns messages created immediately after the given message ID AfterID ID // Number of messages returned. Default is 20. Max is 100. Limit int }
IndexMessagesQuery defines the optional URL parameters for IndexMessages
func (IndexMessagesQuery) String ¶
func (q IndexMessagesQuery) String() string
type IndexMessagesResponse ¶
type IndexMessagesResponse struct { Count int `json:"count"` Messages []*Message `json:"messages"` }
IndexMessagesResponse contains the count and set of messages returned by the IndexMessages API request
func (IndexMessagesResponse) String ¶
func (r IndexMessagesResponse) String() string
type Member ¶
type Member struct { ID ID `json:"id,omitempty"` UserID ID `json:"user_id,omitempty"` Nickname string `json:"nickname,omitempty"` Muted bool `json:"muted,omitempty"` ImageURL string `json:"image_url,omitempty"` AutoKicked bool `json:"autokicked,omitempty"` AppInstalled bool `json:"app_installed,omitempty"` GUID string `json:"guid,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` // Only used when searching for the member to add to a group. Email string `json:"email,omitempty"` // Only used when searching for the member to add to a group. }
Member is a GroupMe group member, returned in JSON API responses
type Message ¶
type Message struct { ID ID `json:"id,omitempty"` SourceGUID string `json:"source_guid,omitempty"` CreatedAt Timestamp `json:"created_at,omitempty"` GroupID ID `json:"group_id,omitempty"` UserID ID `json:"user_id,omitempty"` BotID ID `json:"bot_id,omitempty"` SenderID ID `json:"sender_id,omitempty"` SenderType senderType `json:"sender_type,omitempty"` System bool `json:"system,omitempty"` Name string `json:"name,omitempty"` RecipientID ID `json:"recipient_id,omitempty"` //ChatID - over push ConversationID seems to be called ChatID ChatID ID `json:"chat_id,omitempty"` ConversationID ID `json:"conversation_id,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` // Maximum length of 1000 characters Text string `json:"text,omitempty"` // Must be an image service URL (i.groupme.com) ImageURL string `json:"image_url,omitempty"` FavoritedBy []string `json:"favorited_by,omitempty"` Attachments []*Attachment `json:"attachments,omitempty"` }
Message is a GroupMe group message, returned in JSON API responses
type MessagePreview ¶
type MessagePreview struct { Nickname string `json:"nickname,omitempty"` Text string `json:"text,omitempty"` ImageURL string `json:"image_url,omitempty"` Attachments []*Attachment `json:"attachments,omitempty"` }
MessagePreview is a GroupMessages field, only returned in Group JSON API responses. Abbreviated form of Message type
type Meta ¶
type Meta struct { Code HTTPStatusCode `json:"code,omitempty"` Errors []string `json:"errors,omitempty"` }
Meta is the error type returned in the GroupMe response. Meant for clients that can't read HTTP status codes
type PhoneNumber ¶
type PhoneNumber string
PhoneNumber is the country code plus the number of the user
func (PhoneNumber) String ¶
func (pn PhoneNumber) String() string
func (PhoneNumber) Valid ¶
func (pn PhoneNumber) Valid() bool
Valid checks if the ID string is alpha numeric
type PushSubscription ¶
type PushSubscription struct { LastConnected int64 // contains filtered or unexported fields }
PushSubscription manages real time subscription
func NewPushSubscription ¶
func NewPushSubscription(context context.Context) PushSubscription
NewPushSubscription creates and returns a push subscription object
func (*PushSubscription) AddFullHandler ¶
func (r *PushSubscription) AddFullHandler(h HandlerAll, authToken string)
AddFullHandler is the same as AddHandler except it ensures the interface implements everything
func (*PushSubscription) AddHandler ¶
func (r *PushSubscription) AddHandler(h Handler, authToken string)
func (*PushSubscription) Connect ¶
func (r *PushSubscription) Connect(context context.Context) error
Listen connects to GroupMe. Runs in Goroutine.
func (*PushSubscription) Connected ¶
func (r *PushSubscription) Connected() bool
Connected check if connected
func (*PushSubscription) SubscribeToDM ¶
SubscribeToDM to users
func (*PushSubscription) SubscribeToGroup ¶
SubscribeToGroup to groups for typing notification
func (*PushSubscription) SubscribeToUser ¶
SubscribeToUser to users
type Timestamp ¶
type Timestamp uint64
Timestamp is the number of seconds since the UNIX epoch
type User ¶
type User struct { ID ID `json:"id,omitempty"` PhoneNumber PhoneNumber `json:"phone_number,omitempty"` ImageURL string `json:"image_url,omitempty"` Name string `json:"name,omitempty"` CreatedAt Timestamp `json:"created_at,omitempty"` UpdatedAt Timestamp `json:"updated_at,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` Email string `json:"email,omitempty"` SMS bool `json:"sms,omitempty"` }
User is a GroupMe user, returned in JSON API responses
type UserSettings ¶
type UserSettings struct { // URL to valid JPG/PNG/GIF image. URL will be converted into // an image service link (https://i.groupme.com/....) AvatarURL string `json:"avatar_url"` // Name must be of the form FirstName LastName Name string `json:"name"` // Email address. Must be in name@domain.com form Email string `json:"email"` ZipCode string `json:"zip_code"` }
UserSettings are the settings for a GroupMe user