-
Notifications
You must be signed in to change notification settings - Fork 6
/
matrix_rooms.go
35 lines (29 loc) · 951 Bytes
/
matrix_rooms.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2022, NewReleases Go client AUTHORS.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package newreleases
import (
"context"
"net/http"
)
// MatrixRoomsService provides information about Matrix
// notifications.
type MatrixRoomsService service
// MatrixRoom holds information about a Slack Channel that is connected to the
// account.
type MatrixRoom struct {
ID string `json:"id"`
Name string `json:"name"`
HomeserverURL string `json:"homeserver_url"`
InternalRoomID string `json:"internal_room_id"`
}
// List returns all Matrix rooms.
func (s *MatrixRoomsService) List(ctx context.Context) (rooms []MatrixRoom, err error) {
var r matrixRoomsResponse
err = s.client.request(ctx, http.MethodGet, "v1/matrix-rooms", nil, &r)
return r.Rooms, err
}
type matrixRoomsResponse struct {
Rooms []MatrixRoom `json:"rooms"`
}