summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-04-01 00:23:19 +0200
committerGitHub <noreply@github.com>2022-04-01 00:23:19 +0200
commitc6716e030c02f316b887c1d3ee4b443aa3ab6afd (patch)
tree470461fe2d29662e7a69834ed21fce30beed65ab /vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
parent4ab72acec656dafd304f88359b509b1f27c06604 (diff)
downloadmatterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.tar.gz
matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.tar.bz2
matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.zip
Update dependencies (#1784)
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v6/model/client4.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/client4.go99
1 files changed, 98 insertions, 1 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go b/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
index d4213d15..beabda82 100644
--- a/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/client4.go
@@ -46,6 +46,7 @@ const (
APIURLSuffixV1 = "/api/v1"
APIURLSuffixV4 = "/api/v4"
+ APIURLSuffixV5 = "/api/v5"
APIURLSuffix = APIURLSuffixV4
)
@@ -5252,7 +5253,7 @@ func (c *Client4) GetGroupsAssociatedToChannelsByTeam(teamId string, opts GroupS
// GetGroups retrieves Mattermost Groups
func (c *Client4) GetGroups(opts GroupSearchOpts) ([]*Group, *Response, error) {
path := fmt.Sprintf(
- "%s?include_member_count=%v&not_associated_to_team=%v&not_associated_to_channel=%v&filter_allow_reference=%v&q=%v&filter_parent_team_permitted=%v",
+ "%s?include_member_count=%v&not_associated_to_team=%v&not_associated_to_channel=%v&filter_allow_reference=%v&q=%v&filter_parent_team_permitted=%v&group_source=%v",
c.groupsRoute(),
opts.IncludeMemberCount,
opts.NotAssociatedToTeam,
@@ -5260,6 +5261,7 @@ func (c *Client4) GetGroups(opts GroupSearchOpts) ([]*Group, *Response, error) {
opts.FilterAllowReference,
opts.Q,
opts.FilterParentTeamPermitted,
+ opts.Source,
)
if opts.Since > 0 {
path = fmt.Sprintf("%s&since=%v", path, opts.Since)
@@ -7071,6 +7073,36 @@ func (c *Client4) GetGroup(groupID, etag string) (*Group, *Response, error) {
return &g, BuildResponse(r), nil
}
+func (c *Client4) CreateGroup(group *Group) (*Group, *Response, error) {
+ groupJSON, jsonErr := json.Marshal(group)
+ if jsonErr != nil {
+ return nil, nil, NewAppError("CreateGroup", "api.marshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ r, err := c.DoAPIPostBytes("/groups", groupJSON)
+ if err != nil {
+ return nil, BuildResponse(r), err
+ }
+ defer closeBody(r)
+ var p Group
+ if jsonErr := json.NewDecoder(r.Body).Decode(&p); jsonErr != nil {
+ return nil, nil, NewAppError("CreateGroup", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ return &p, BuildResponse(r), nil
+}
+
+func (c *Client4) DeleteGroup(groupID string) (*Group, *Response, error) {
+ r, err := c.DoAPIDelete(c.groupRoute(groupID))
+ if err != nil {
+ return nil, BuildResponse(r), err
+ }
+ defer closeBody(r)
+ var p Group
+ if jsonErr := json.NewDecoder(r.Body).Decode(&p); jsonErr != nil {
+ return nil, nil, NewAppError("DeleteGroup", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ return &p, BuildResponse(r), nil
+}
+
func (c *Client4) PatchGroup(groupID string, patch *GroupPatch) (*Group, *Response, error) {
payload, _ := json.Marshal(patch)
r, err := c.DoAPIPut(c.groupRoute(groupID)+"/patch", string(payload))
@@ -7085,6 +7117,40 @@ func (c *Client4) PatchGroup(groupID string, patch *GroupPatch) (*Group, *Respon
return &g, BuildResponse(r), nil
}
+func (c *Client4) UpsertGroupMembers(groupID string, userIds *GroupModifyMembers) ([]*GroupMember, *Response, error) {
+ payload, jsonErr := json.Marshal(userIds)
+ if jsonErr != nil {
+ return nil, nil, NewAppError("UpsertGroupMembers", "api.marshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ r, err := c.DoAPIPostBytes(c.groupRoute(groupID)+"/members", payload)
+ if err != nil {
+ return nil, BuildResponse(r), err
+ }
+ defer closeBody(r)
+ var g []*GroupMember
+ if jsonErr := json.NewDecoder(r.Body).Decode(&g); jsonErr != nil {
+ return nil, nil, NewAppError("UpsertGroupMembers", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ return g, BuildResponse(r), nil
+}
+
+func (c *Client4) DeleteGroupMembers(groupID string, userIds *GroupModifyMembers) ([]*GroupMember, *Response, error) {
+ payload, jsonErr := json.Marshal(userIds)
+ if jsonErr != nil {
+ return nil, nil, NewAppError("DeleteGroupMembers", "api.marshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ r, err := c.DoAPIDeleteBytes(c.groupRoute(groupID)+"/members", payload)
+ if err != nil {
+ return nil, BuildResponse(r), err
+ }
+ defer closeBody(r)
+ var g []*GroupMember
+ if jsonErr := json.NewDecoder(r.Body).Decode(&g); jsonErr != nil {
+ return nil, nil, NewAppError("DeleteGroupMembers", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ return g, BuildResponse(r), nil
+}
+
func (c *Client4) LinkGroupSyncable(groupID, syncableID string, syncableType GroupSyncableType, patch *GroupSyncablePatch) (*GroupSyncable, *Response, error) {
payload, _ := json.Marshal(patch)
url := fmt.Sprintf("%s/link", c.groupSyncableRoute(groupID, syncableID, syncableType))
@@ -7435,6 +7501,20 @@ func (c *Client4) MarkNoticesViewed(ids []string) (*Response, error) {
return BuildResponse(r), nil
}
+func (c *Client4) CompleteOnboarding(request *CompleteOnboardingRequest) (*Response, error) {
+ buf, err := json.Marshal(request)
+ if err != nil {
+ return nil, NewAppError("CompleteOnboarding", "api.marshal_error", nil, err.Error(), http.StatusInternalServerError)
+ }
+ r, err := c.DoAPIPost(c.systemRoute()+"/onboarding/complete", string(buf))
+ if err != nil {
+ return BuildResponse(r), err
+ }
+ defer closeBody(r)
+
+ return BuildResponse(r), nil
+}
+
// CreateUpload creates a new upload session.
func (c *Client4) CreateUpload(us *UploadSession) (*UploadSession, *Response, error) {
buf, err := json.Marshal(us)
@@ -7834,3 +7914,20 @@ func (c *Client4) GetAncillaryPermissions(subsectionPermissions []string) ([]str
json.NewDecoder(r.Body).Decode(&returnedPermissions)
return returnedPermissions, BuildResponse(r), nil
}
+
+func (c *Client4) GetUsersWithInvalidEmails(page, perPage int) ([]*User, *Response, error) {
+ query := fmt.Sprintf("/invalid_emails?page=%v&per_page=%v", page, perPage)
+ r, err := c.DoAPIGet(c.usersRoute()+query, "")
+ if err != nil {
+ return nil, BuildResponse(r), err
+ }
+ defer closeBody(r)
+ var list []*User
+ if r.StatusCode == http.StatusNotModified {
+ return list, BuildResponse(r), nil
+ }
+ if jsonErr := json.NewDecoder(r.Body).Decode(&list); jsonErr != nil {
+ return nil, nil, NewAppError("GetUsers", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
+ }
+ return list, BuildResponse(r), nil
+}