Skip to content

Commit

Permalink
add Groups.IsMember method
Browse files Browse the repository at this point in the history
  • Loading branch information
vildan-valeev committed Dec 23, 2023
1 parent 5528b38 commit 87f3516
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ func (a API) GroupsSetLongPollSettings(opts *SetLongPollSettingsOptions) (res AP
vals.Set("access_token", a.token)
vals.Set("v", APIVersion)
return get[APIResponseSetLongPollSettings](a.base, "groups.setLongPollSettings", addValues(vals, opts))
}

// GroupsSetLongPollSettings https://dev.vk.com/ru/method/groups.isMember
func (a API) GroupsIsMember(opts *GroupsIsMemberOptions) (res APIResponseGroupsIsMember, err error) {
var vals = make(url.Values)

vals.Set("access_token", a.token)
vals.Set("v", APIVersion)
return get[APIResponseGroupsIsMember](a.base, "groups.isMember", addValues(vals, opts))
}

func (a API) MessagesSend(text string, opts *MessagesSendOptions) (res APIResponseMessagesSend, err error) {
Expand Down
7 changes: 7 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ type MessageEventAnswerOptions struct {
PeerID int64 `query:"peer_id"`
EventData string `query:"text"`
}

type GroupsIsMemberOptions struct {
GroupID int64 `query:"group_id"`
UserID int64 `query:"user_id"`
UserIDs string `query:"user_ids"`
Extended int64 `query:"extended"`
}
11 changes: 11 additions & 0 deletions responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ func (a APIResponseSetLongPollSettings) Base() APIError {

//---------------------------------------------------------------

type APIResponseGroupsIsMember struct {
Response int64 `json:"response,omitempty"`
Error APIError `json:"error,omitempty"`
}

func (a APIResponseGroupsIsMember) Base() APIError {
return a.Error
}

// -------------------------

type APIResponseUpdate struct {
Ts string `json:"ts,omitempty"`
//Updates []*Update `json:"updates,omitempty"`
Expand Down

0 comments on commit 87f3516

Please sign in to comment.