From c66fdd1bdbc7919f86083a5cc131d4290e4b7f3c Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 2 Nov 2016 14:46:55 +0000 Subject: [PATCH] Review comments --- src/github.com/matrix-org/go-neb/api/api.go | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/github.com/matrix-org/go-neb/api/api.go b/src/github.com/matrix-org/go-neb/api/api.go index 15029e4..5ee438c 100644 --- a/src/github.com/matrix-org/go-neb/api/api.go +++ b/src/github.com/matrix-org/go-neb/api/api.go @@ -17,10 +17,10 @@ import ( // ConfigureAuthRealmRequest is a request to /configureAuthRealm type ConfigureAuthRealmRequest struct { // An arbitrary unique identifier for this auth realm. This can be anything. - // Using the same ID will REPLACE the entire AuthRealm with the new information. + // Using an existing ID will REPLACE the entire existing AuthRealm with the new information. ID string // The type of auth realm. This determines which code is loaded to execute the - // auth realm. It must be a known type. + // auth realm. It must be a known type. E.g. "github". Type string // AuthRealm specific config information. See the docs for the auth realm you're interested in. Config json.RawMessage @@ -30,7 +30,7 @@ type ConfigureAuthRealmRequest struct { type RequestAuthSessionRequest struct { // The realm ID to request a new auth session on. The realm MUST already exist. RealmID string - // The user ID of user requesting the auth session. If the auth is successful, + // The Matrix user ID requesting the auth session. If the auth is successful, // this user ID will be associated with the third-party credentials obtained. UserID string // AuthRealm specific config information. See the docs for the auth realm you're interested in. @@ -40,12 +40,12 @@ type RequestAuthSessionRequest struct { // ConfigureServiceRequest is a request to /configureService type ConfigureServiceRequest struct { // An arbitrary unique identifier for this service. This can be anything. - // Using the same ID will REPLACE the entire Service with the new information. + // Using an existing ID will REPLACE the entire Service with the new information. ID string // The type of service. This determines which code is loaded to execute the - // service. It must be a known type. + // service. It must be a known type, e.g. "github". Type string - // The user ID of the configured client who will be controlled by this service. + // The user ID of the configured client that this service will use to communicate with Matrix. // The user MUST already be configured. UserID string // Service-specific config information. See the docs for the service you're interested in. @@ -62,7 +62,7 @@ type ClientConfig struct { // The matrix access token to authenticate the requests with. AccessToken string // True to start a sync stream for this user. If false, no /sync goroutine will be - // created and this client will be unable to receive new events from Matrix. For services + // created and this client won't listen for new events from Matrix. For services // which only SEND events into Matrix, it may be desirable to set Sync to false to reduce the // number of goroutines Go-NEB has to maintain. For services which respond to !commands, // Sync MUST be set to true in order to receive those commands. @@ -76,9 +76,9 @@ type ClientConfig struct { DisplayName string } -// SessionRequests are usually multi-stage things so this type only exists for the config form -// for use with ConfigFile. -type SessionRequest struct { +// Sessions contain the complete auth session information for a given user on a given realm. +// They are created for use with ConfigFile. +type Session struct { SessionID string RealmID string UserID string @@ -90,7 +90,7 @@ type ConfigFile struct { Clients []ClientConfig Realms []ConfigureAuthRealmRequest Services []ConfigureServiceRequest - Sessions []SessionRequest + Sessions []Session } // Check validates the /configureService request @@ -110,7 +110,7 @@ func (c *ConfigureAuthRealmRequest) Check() error { } // Check validates the session config request -func (c *SessionRequest) Check() error { +func (c *Session) Check() error { if c.SessionID == "" || c.UserID == "" || c.RealmID == "" || c.Config == nil { return errors.New(`Must supply a "SessionID", a "RealmID", a "UserID" and a "Config"`) }