mirror of
https://github.com/1f349/dendrite.git
synced 2024-12-23 16:54:08 +00:00
gb vendor update github.com/matrix-org/gomatrix
This commit is contained in:
parent
831a76ae91
commit
bcf58fad84
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -135,7 +135,7 @@
|
|||||||
{
|
{
|
||||||
"importpath": "github.com/matrix-org/gomatrix",
|
"importpath": "github.com/matrix-org/gomatrix",
|
||||||
"repository": "https://github.com/matrix-org/gomatrix",
|
"repository": "https://github.com/matrix-org/gomatrix",
|
||||||
"revision": "27ae91d1b3a3be1d83864c6c4dc38c2297f11aae",
|
"revision": "a7fc80c8060c2544fe5d4dae465b584f8e9b4e27",
|
||||||
"branch": "master"
|
"branch": "master"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ func (cli *Client) BuildBaseURL(urlPath ...string) string {
|
|||||||
return hsURL.String()
|
return hsURL.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildURLWithQuery builds a URL with query paramters in addition to the Client's homeserver/prefix/access_token set already.
|
// BuildURLWithQuery builds a URL with query parameters in addition to the Client's homeserver/prefix/access_token set already.
|
||||||
func (cli *Client) BuildURLWithQuery(urlPath []string, urlQuery map[string]string) string {
|
func (cli *Client) BuildURLWithQuery(urlPath []string, urlQuery map[string]string) string {
|
||||||
u, _ := url.Parse(cli.BuildURL(urlPath...))
|
u, _ := url.Parse(cli.BuildURL(urlPath...))
|
||||||
q := u.Query()
|
q := u.Query()
|
||||||
@ -387,6 +387,20 @@ func (cli *Client) JoinRoom(roomIDorAlias, serverName string, content interface{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDisplayName returns the display name of the user from the specified MXID. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
|
||||||
|
func (cli *Client) GetDisplayName(mxid string) (resp *RespUserDisplayName, err error) {
|
||||||
|
urlPath := cli.BuildURL("profile", mxid, "displayname")
|
||||||
|
_, err = cli.MakeRequest("GET", urlPath, nil, &resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOwnDisplayName returns the user's display name. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
|
||||||
|
func (cli *Client) GetOwnDisplayName() (resp *RespUserDisplayName, err error) {
|
||||||
|
urlPath := cli.BuildURL("profile", cli.UserID, "displayname")
|
||||||
|
_, err = cli.MakeRequest("GET", urlPath, nil, &resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// SetDisplayName sets the user's profile display name. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-profile-userid-displayname
|
// SetDisplayName sets the user's profile display name. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-profile-userid-displayname
|
||||||
func (cli *Client) SetDisplayName(displayName string) (err error) {
|
func (cli *Client) SetDisplayName(displayName string) (err error) {
|
||||||
urlPath := cli.BuildURL("profile", cli.UserID, "displayname")
|
urlPath := cli.BuildURL("profile", cli.UserID, "displayname")
|
||||||
@ -644,7 +658,7 @@ func (cli *Client) Messages(roomID, from, to string, dir rune, limit int) (resp
|
|||||||
query["to"] = to
|
query["to"] = to
|
||||||
}
|
}
|
||||||
if limit != 0 {
|
if limit != 0 {
|
||||||
query["limit"] = string(limit)
|
query["limit"] = strconv.Itoa(limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlPath := cli.BuildURLWithQuery([]string{"rooms", roomID, "messages"}, query)
|
urlPath := cli.BuildURLWithQuery([]string{"rooms", roomID, "messages"}, query)
|
||||||
@ -652,6 +666,14 @@ func (cli *Client) Messages(roomID, from, to string, dir rune, limit int) (resp
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TurnServer returns turn server details and credentials for the client to use when initiating calls.
|
||||||
|
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-voip-turnserver
|
||||||
|
func (cli *Client) TurnServer() (resp *RespTurnServer, err error) {
|
||||||
|
urlPath := cli.BuildURL("voip", "turnServer")
|
||||||
|
_, err = cli.MakeRequest("GET", urlPath, nil, &resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func txnID() string {
|
func txnID() string {
|
||||||
return "go" + strconv.FormatInt(time.Now().UnixNano(), 10)
|
return "go" + strconv.FormatInt(time.Now().UnixNano(), 10)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ type Event struct {
|
|||||||
StateKey *string `json:"state_key,omitempty"` // The state key for the event. Only present on State Events.
|
StateKey *string `json:"state_key,omitempty"` // The state key for the event. Only present on State Events.
|
||||||
Sender string `json:"sender"` // The user ID of the sender of the event
|
Sender string `json:"sender"` // The user ID of the sender of the event
|
||||||
Type string `json:"type"` // The event type
|
Type string `json:"type"` // The event type
|
||||||
Timestamp int `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server
|
Timestamp int64 `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server
|
||||||
ID string `json:"event_id"` // The unique ID of this event
|
ID string `json:"event_id"` // The unique ID of this event
|
||||||
RoomID string `json:"room_id"` // The room the event was sent to. May be nil (e.g. for presence)
|
RoomID string `json:"room_id"` // The room the event was sent to. May be nil (e.g. for presence)
|
||||||
Content map[string]interface{} `json:"content"` // The JSON content of the event.
|
Content map[string]interface{} `json:"content"` // The JSON content of the event.
|
||||||
|
43
vendor/src/github.com/matrix-org/gomatrix/filter.go
vendored
Normal file
43
vendor/src/github.com/matrix-org/gomatrix/filter.go
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2017 Jan Christian Grünhage
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package gomatrix
|
||||||
|
|
||||||
|
//Filter is used by clients to specify how the server should filter responses to e.g. sync requests
|
||||||
|
//Specified by: https://matrix.org/docs/spec/client_server/r0.2.0.html#filtering
|
||||||
|
type Filter struct {
|
||||||
|
AccountData FilterPart `json:"account_data,omitempty"`
|
||||||
|
EventFields []string `json:"event_fields,omitempty"`
|
||||||
|
EventFormat string `json:"event_format,omitempty"`
|
||||||
|
Presence FilterPart `json:"presence,omitempty"`
|
||||||
|
Room struct {
|
||||||
|
AccountData FilterPart `json:"account_data,omitempty"`
|
||||||
|
Ephemeral FilterPart `json:"ephemeral,omitempty"`
|
||||||
|
IncludeLeave bool `json:"include_leave,omitempty"`
|
||||||
|
NotRooms []string `json:"not_rooms,omitempty"`
|
||||||
|
Rooms []string `json:"rooms,omitempty"`
|
||||||
|
State FilterPart `json:"state,omitempty"`
|
||||||
|
Timeline FilterPart `json:"timeline,omitempty"`
|
||||||
|
} `json:"room,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterPart struct {
|
||||||
|
NotRooms []string `json:"not_rooms,omitempty"`
|
||||||
|
Rooms []string `json:"rooms,omitempty"`
|
||||||
|
Limit *int `json:"limit,omitempty"`
|
||||||
|
NotSenders []string `json:"not_senders,omitempty"`
|
||||||
|
NotTypes []string `json:"not_types,omitempty"`
|
||||||
|
Senders []string `json:"senders,omitempty"`
|
||||||
|
Types []string `json:"types,omitempty"`
|
||||||
|
}
|
@ -3,6 +3,23 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
golint
|
golint
|
||||||
|
misspell --error .
|
||||||
|
|
||||||
|
# gofmt doesn't exit with an error code if the files don't match the expected
|
||||||
|
# format. So we have to run it and see if it outputs anything.
|
||||||
|
if gofmt -l -s . 2>&1 | read
|
||||||
|
then
|
||||||
|
echo "Error: not all code had been formatted with gofmt."
|
||||||
|
echo "Fixing the following files"
|
||||||
|
gofmt -s -w -l .
|
||||||
|
echo
|
||||||
|
echo "Please add them to the commit"
|
||||||
|
git status --short
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ineffassign .
|
||||||
|
|
||||||
go fmt
|
go fmt
|
||||||
go tool vet --all --shadow .
|
go tool vet --all --shadow .
|
||||||
gocyclo -over 12 .
|
gocyclo -over 12 .
|
||||||
|
@ -100,6 +100,11 @@ func (r RespUserInteractive) HasSingleStageFlow(stageName string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RespUserDisplayName is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
|
||||||
|
type RespUserDisplayName struct {
|
||||||
|
DisplayName string `json:"displayname"`
|
||||||
|
}
|
||||||
|
|
||||||
// RespRegister is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register
|
// RespRegister is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register
|
||||||
type RespRegister struct {
|
type RespRegister struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
@ -162,3 +167,10 @@ type RespSync struct {
|
|||||||
} `json:"invite"`
|
} `json:"invite"`
|
||||||
} `json:"rooms"`
|
} `json:"rooms"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RespTurnServer struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
TTL int `json:"ttl"`
|
||||||
|
URIs []string `json:"uris"`
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user