diff --git a/pkg/github.com/index.html b/pkg/github.com/index.html index f097d57..fed5022 100644 --- a/pkg/github.com/index.html +++ b/pkg/github.com/index.html @@ -872,7 +872,7 @@ github - + Package github implements OAuth2 support for github.com @@ -883,7 +883,7 @@ jira - + Package jira implements OAuth1.0a support for arbitrary JIRA installations. diff --git a/pkg/github.com/matrix-org/go-neb/api/handlers/index.html b/pkg/github.com/matrix-org/go-neb/api/handlers/index.html index c6a3087..d19a6a4 100644 --- a/pkg/github.com/matrix-org/go-neb/api/handlers/index.html +++ b/pkg/github.com/matrix-org/go-neb/api/handlers/index.html @@ -398,7 +398,7 @@ Response: -

type ConfigureService

+

type ConfigureService

type ConfigureService struct {
     // contains filtered or unexported fields
 }
@@ -417,7 +417,7 @@ ConfigureService represents an HTTP handler which can process /admin/configureSe -

func NewConfigureService

+

func NewConfigureService

func NewConfigureService(db *database.ServiceDB, clients *clients.Clients) *ConfigureService

NewConfigureService creates a new ConfigureService handler @@ -429,7 +429,7 @@ NewConfigureService creates a new ConfigureService handler -

func (*ConfigureService) OnIncomingRequest

+

func (*ConfigureService) OnIncomingRequest

func (s *ConfigureService) OnIncomingRequest(req *http.Request) (interface{}, *errors.HTTPError)

OnIncomingRequest handles POST requests to /admin/configureService. @@ -473,7 +473,7 @@ Response: -

type GetService

+

type GetService

type GetService struct {
     Db *database.ServiceDB
 }
@@ -494,7 +494,7 @@ GetService represents an HTTP handler which can process /admin/getService reques -

func (*GetService) OnIncomingRequest

+

func (*GetService) OnIncomingRequest

func (h *GetService) OnIncomingRequest(req *http.Request) (interface{}, *errors.HTTPError)

OnIncomingRequest handles POST requests to /admin/getService. diff --git a/pkg/github.com/matrix-org/go-neb/api/index.html b/pkg/github.com/matrix-org/go-neb/api/index.html index 1de214f..7c5e587 100644 --- a/pkg/github.com/matrix-org/go-neb/api/index.html +++ b/pkg/github.com/matrix-org/go-neb/api/index.html @@ -226,7 +226,7 @@ Package "api.handlers" for information on the HTTP API calls. -

type ClientConfig

+

type ClientConfig

type ClientConfig struct {
     // The matrix User ID to connect with. E.g. @alice:matrix.org
     UserID string
@@ -234,8 +234,8 @@ Package "api.handlers" for information on the HTTP API calls.
     HomeserverURL string
     // 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 won't listen for new events from Matrix. For services
+    // True to start a sync stream for this user, making this a "syncing client". If false, no
+    // /sync goroutine will be 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.
@@ -266,7 +266,7 @@ Go-NEB can drive it. It forms the HTTP body to /configureClient requests.
 
 			
 				
-				

func (*ClientConfig) Check

+

func (*ClientConfig) Check

func (c *ClientConfig) Check() error

Check that the client has supplied the correct fields. @@ -279,7 +279,7 @@ Check that the client has supplied the correct fields. -

type ConfigFile

+

type ConfigFile

type ConfigFile struct {
     Clients  []ClientConfig
     Realms   []ConfigureAuthRealmRequest
@@ -333,7 +333,7 @@ ConfigureAuthRealmRequest is a request to /configureAuthRealm
 
 			
 				
-				

func (*ConfigureAuthRealmRequest) Check

+

func (*ConfigureAuthRealmRequest) Check

func (c *ConfigureAuthRealmRequest) Check() error

Check validates the /configureAuthRealm request @@ -377,7 +377,7 @@ ConfigureServiceRequest is a request to /configureService -

func (*ConfigureServiceRequest) Check

+

func (*ConfigureServiceRequest) Check

func (c *ConfigureServiceRequest) Check() error

Check validates the /configureService request @@ -417,7 +417,7 @@ RequestAuthSessionRequest is a request to /requestAuthSession -

func (*RequestAuthSessionRequest) Check

+

func (*RequestAuthSessionRequest) Check

func (r *RequestAuthSessionRequest) Check() error

Check that the request is valid. @@ -430,7 +430,7 @@ Check that the request is valid. -

type Session

+

type Session

type Session struct {
     SessionID string
     RealmID   string
@@ -455,7 +455,7 @@ They are created for use with ConfigFile.
 
 			
 				
-				

func (*Session) Check

+

func (*Session) Check

func (c *Session) Check() error

Check validates the session config request diff --git a/pkg/github.com/matrix-org/go-neb/index.html b/pkg/github.com/matrix-org/go-neb/index.html index c128740..361e175 100644 --- a/pkg/github.com/matrix-org/go-neb/index.html +++ b/pkg/github.com/matrix-org/go-neb/index.html @@ -204,7 +204,7 @@ github - + Package github implements OAuth2 support for github.com @@ -215,7 +215,7 @@ jira - + Package jira implements OAuth1.0a support for arbitrary JIRA installations. diff --git a/pkg/github.com/matrix-org/go-neb/matrix/index.html b/pkg/github.com/matrix-org/go-neb/matrix/index.html index 9f574f9..df73587 100644 --- a/pkg/github.com/matrix-org/go-neb/matrix/index.html +++ b/pkg/github.com/matrix-org/go-neb/matrix/index.html @@ -298,7 +298,7 @@ processing goroutine. -

type Client

+

type Client

type Client struct {
     HomeserverURL *url.URL
     Prefix        string
@@ -308,6 +308,7 @@ processing goroutine.
     Worker        *Worker
 
     NextBatchStorer NextBatchStorer
+    ClientConfig    api.ClientConfig
     // contains filtered or unexported fields
 }

@@ -325,7 +326,7 @@ Client represents a Matrix client. -

func NewClient

+

func NewClient

func NewClient(httpClient *http.Client, homeserverURL *url.URL, accessToken, userID string) *Client

NewClient creates a new Matrix Client ready for syncing @@ -337,7 +338,7 @@ NewClient creates a new Matrix Client ready for syncing -

func (*Client) JoinRoom

+

func (*Client) JoinRoom

func (cli *Client) JoinRoom(roomIDorAlias, serverName, invitingUserID string) (string, error)

JoinRoom joins the client to a room ID or alias. If serverName is specified, this will be added as a query param @@ -350,7 +351,7 @@ inserted into the content of the join request. Returns a room ID. -

func (*Client) SendMessageEvent

+

func (*Client) SendMessageEvent

func (cli *Client) SendMessageEvent(roomID string, eventType string, contentJSON interface{}) (string, error)

SendMessageEvent sends a message event into a room, returning the event_id on success. @@ -362,7 +363,7 @@ contentJSON should be a pointer to something that can be encoded as JSON using j -

func (*Client) SendText

+

func (*Client) SendText

func (cli *Client) SendText(roomID, text string) (string, error)

SendText sends an m.room.message event into the given room with a msgtype of m.text @@ -373,7 +374,7 @@ SendText sends an m.room.message event into the given room with a msgtype of m.t -

func (*Client) SetDisplayName

+

func (*Client) SetDisplayName

func (cli *Client) SetDisplayName(displayName string) error

SetDisplayName sets the user's profile display name @@ -384,7 +385,7 @@ SetDisplayName sets the user's profile display name -

func (*Client) StopSync

+

func (*Client) StopSync

func (cli *Client) StopSync()

StopSync stops the ongoing sync started by Sync. @@ -395,7 +396,7 @@ StopSync stops the ongoing sync started by Sync. -

func (*Client) Sync

+

func (*Client) Sync

func (cli *Client) Sync()

Sync starts syncing with the provided Homeserver. This function will be invoked continually. @@ -407,7 +408,7 @@ If Sync is called twice then the first sync will be stopped. -

+
func (cli *Client) UploadLink(link string) (string, error)

UploadLink uploads an HTTP URL and then returns an MXC URI. @@ -418,7 +419,7 @@ UploadLink uploads an HTTP URL and then returns an MXC URI. -

func (*Client) UploadToContentRepo

+

func (*Client) UploadToContentRepo

func (cli *Client) UploadToContentRepo(content io.Reader, contentType string, contentLength int64) (string, error)

UploadToContentRepo uploads the given bytes to the content repository and returns an MXC URI. @@ -573,7 +574,7 @@ ImageMessage is an m.image event -

type NextBatchStorer

+

type NextBatchStorer

type NextBatchStorer interface {
     // Save a next_batch token for a given user. Best effort.
     Save(userID, nextBatch string)
diff --git a/pkg/github.com/matrix-org/go-neb/realms/github/index.html b/pkg/github.com/matrix-org/go-neb/realms/github/index.html
index 32b0434..ba3fee6 100644
--- a/pkg/github.com/matrix-org/go-neb/realms/github/index.html
+++ b/pkg/github.com/matrix-org/go-neb/realms/github/index.html
@@ -5,7 +5,7 @@
 
 
 
-  realms - The Go Programming Language
+  github - The Go Programming Language
 
 
 
@@ -42,7 +42,7 @@
 
-

Package realms

+

Package github

@@ -87,7 +87,10 @@

Overview ▾

- +

+Package github implements OAuth2 support for github.com +

+
@@ -103,53 +106,65 @@ +

Constants

+ +
const RealmType = "github"
+

+RealmType of the Github Realm +

+ + + + + + +

type AuthRequest

+
type AuthRequest struct {
+    // Optional. The URL to redirect to after authentication.
+    RedirectURL string
+}
+

+AuthRequest is a request for authenticating with github.com +

+ + + + + + + + + + + + + + + + +

type AuthResponse

+
type AuthResponse struct {
+    // The URL to visit to perform OAuth on github.com
+    URL string
+}
+

+AuthResponse is a response to an AuthRequest. +

+ + + + + + + + + + + + + -

type GithubRealm

-
type GithubRealm struct {
+			

type Realm

+
type Realm struct {
+
+    // The client secret for this Github application.
     ClientSecret string
-    ClientID     string
-    StarterLink  string
+    // The client ID for this Github application.
+    ClientID string
+    // Optional. The URL to redirect the client to after authentication.
+    StarterLink string
     // contains filtered or unexported fields
 }

-GithubRealm can handle OAuth processes with github.com +Realm can handle OAuth processes with github.com

+

+Example request: +

+
{
+    "ClientSecret": "YOUR_CLIENT_SECRET",
+    "ClientID": "YOUR_CLIENT_ID"
+}
+
@@ -238,10 +322,10 @@ GithubRealm can handle OAuth processes with github.com -

func (*GithubRealm) AuthSession

-
func (r *GithubRealm) AuthSession(id, userID, realmID string) types.AuthSession
+

func (*Realm) AuthSession

+
func (r *Realm) AuthSession(id, userID, realmID string) types.AuthSession

-AuthSession returns a GithubSession for this user +AuthSession returns a Github Session for this user

@@ -249,8 +333,8 @@ AuthSession returns a GithubSession for this user -

func (*GithubRealm) ID

-
func (r *GithubRealm) ID() string
+

func (*Realm) ID

+
func (r *Realm) ID() string

ID returns the realm ID

@@ -260,8 +344,8 @@ ID returns the realm ID -

func (*GithubRealm) Init

-
func (r *GithubRealm) Init() error
+

func (*Realm) Init

+
func (r *Realm) Init() error

Init does nothing.

@@ -271,8 +355,8 @@ Init does nothing. -

func (*GithubRealm) OnReceiveRedirect

-
func (r *GithubRealm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request)
+

func (*Realm) OnReceiveRedirect

+
func (r *Realm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request)

OnReceiveRedirect processes OAuth redirect requests from Github

@@ -282,8 +366,8 @@ OnReceiveRedirect processes OAuth redirect requests from Github -

func (*GithubRealm) Register

-
func (r *GithubRealm) Register() error
+

func (*Realm) Register

+
func (r *Realm) Register() error

Register does nothing.

@@ -293,19 +377,34 @@ Register does nothing. -

func (*GithubRealm) RequestAuthSession

-
func (r *GithubRealm) RequestAuthSession(userID string, req json.RawMessage) interface{}
+

func (*Realm) RequestAuthSession

+
func (r *Realm) RequestAuthSession(userID string, req json.RawMessage) interface{}

RequestAuthSession generates an OAuth2 URL for this user to auth with github via. +The request body is of type "github.AuthRequest". The response is of type "github.AuthResponse". +

+

+Request example:

+
{
+    "RedirectURL": "https://optional-url.com/to/redirect/to/after/auth"
+}
+
+

+Response example: +

+
{
+    "URL": "https://github.com/login/oauth/authorize?client_id=abcdef&client_secret=acascacac...."
+}
+
-

func (*GithubRealm) Type

-
func (r *GithubRealm) Type() string
+

func (*Realm) Type

+
func (r *Realm) Type() string

Type is github

@@ -317,18 +416,19 @@ Type is github -

type GithubSession

-
type GithubSession struct {
-    // The client-supplied URL to redirect them to after the auth process is complete.
-    ClientsRedirectURL string
+			

type Session

+
type Session struct {
+
     // AccessToken is the github access token for the user
     AccessToken string
     // Scopes are the set of *ALLOWED* scopes (which may not be the same as the requested scopes)
     Scopes string
+    // Optional. The client-supplied URL to redirect them to after the auth process is complete.
+    ClientsRedirectURL string
     // contains filtered or unexported fields
 }

-GithubSession represents an authenticated github session +Session represents an authenticated github session

@@ -344,8 +444,8 @@ GithubSession represents an authenticated github session -

func (*GithubSession) Authenticated

-
func (s *GithubSession) Authenticated() bool
+

func (*Session) Authenticated

+
func (s *Session) Authenticated() bool

Authenticated returns true if the user has completed the auth process

@@ -355,8 +455,8 @@ Authenticated returns true if the user has completed the auth process -

func (*GithubSession) ID

-
func (s *GithubSession) ID() string
+

func (*Session) ID

+
func (s *Session) ID() string

ID returns the session ID

@@ -366,8 +466,8 @@ ID returns the session ID -

func (*GithubSession) Info

-
func (s *GithubSession) Info() interface{}
+

func (*Session) Info

+
func (s *Session) Info() interface{}

Info returns a list of possible repositories that this session can integrate with.

@@ -377,8 +477,8 @@ Info returns a list of possible repositories that this session can integrate wit -

func (*GithubSession) RealmID

-
func (s *GithubSession) RealmID() string
+

func (*Session) RealmID

+
func (s *Session) RealmID() string

RealmID returns the realm ID of the realm which performed the authentication

@@ -388,8 +488,8 @@ RealmID returns the realm ID of the realm which performed the authentication -

func (*GithubSession) UserID

-
func (s *GithubSession) UserID() string
+

func (*Session) UserID

+
func (s *Session) UserID() string

UserID returns the user_id who authorised with Github

diff --git a/pkg/github.com/matrix-org/go-neb/realms/index.html b/pkg/github.com/matrix-org/go-neb/realms/index.html index e59e25e..3e108c4 100644 --- a/pkg/github.com/matrix-org/go-neb/realms/index.html +++ b/pkg/github.com/matrix-org/go-neb/realms/index.html @@ -91,7 +91,7 @@ github - + Package github implements OAuth2 support for github.com @@ -102,7 +102,7 @@ jira - + Package jira implements OAuth1.0a support for arbitrary JIRA installations. diff --git a/pkg/github.com/matrix-org/go-neb/realms/jira/index.html b/pkg/github.com/matrix-org/go-neb/realms/jira/index.html index d620ede..a568581 100644 --- a/pkg/github.com/matrix-org/go-neb/realms/jira/index.html +++ b/pkg/github.com/matrix-org/go-neb/realms/jira/index.html @@ -5,7 +5,7 @@ - realms - The Go Programming Language + jira - The Go Programming Language @@ -42,7 +42,7 @@
-

Package realms

+

Package jira

@@ -89,7 +89,10 @@

Overview ▾

- +

+Package jira implements OAuth1.0a support for arbitrary JIRA installations. +

+
@@ -105,59 +108,71 @@
+
Constants
+ + +
type AuthRequest
+ + + + +
type AuthResponse
+ + + -
type JIRARealm
+
type Realm
-
    func (r *JIRARealm) AuthSession(id, userID, realmID string) types.AuthSession
+
    func (r *Realm) AuthSession(id, userID, realmID string) types.AuthSession
-
    func (r *JIRARealm) ID() string
+
    func (r *Realm) ID() string
-
    func (r *JIRARealm) Init() error
+
    func (r *Realm) Init() error
-
    func (r *JIRARealm) JIRAClient(userID string, allowUnauth bool) (*jira.Client, error)
+
    func (r *Realm) JIRAClient(userID string, allowUnauth bool) (*jira.Client, error)
-
    func (r *JIRARealm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request)
+
    func (r *Realm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request)
-
    func (r *JIRARealm) ProjectKeyExists(userID, projectKey string) (bool, error)
+
    func (r *Realm) ProjectKeyExists(userID, projectKey string) (bool, error)
-
    func (r *JIRARealm) Register() error
+
    func (r *Realm) Register() error
-
    func (r *JIRARealm) RequestAuthSession(userID string, req json.RawMessage) interface{}
+
    func (r *Realm) RequestAuthSession(userID string, req json.RawMessage) interface{}
-
    func (r *JIRARealm) Type() string
+
    func (r *Realm) Type() string
-
type JIRASession
+
type Session
-
    func (s *JIRASession) Authenticated() bool
+
    func (s *Session) Authenticated() bool
-
    func (s *JIRASession) ID() string
+
    func (s *Session) ID() string
-
    func (s *JIRASession) Info() interface{}
+
    func (s *Session) Info() interface{}
-
    func (s *JIRASession) RealmID() string
+
    func (s *Session) RealmID() string
-
    func (s *JIRASession) UserID() string
+
    func (s *Session) UserID() string
@@ -217,28 +232,125 @@
+

Constants

+ +
const RealmType = "jira"
+

+RealmType of the JIRA realm +

+ + + + + +

type AuthRequest

+
type AuthRequest struct {
+    // Optional. The URL to redirect to after authentication.
+    RedirectURL string
+}
+

+AuthRequest is a request for authenticating with JIRA +

+ + + + + + + -

type JIRARealm

-
type JIRARealm struct {
-    JIRAEndpoint   string
-    Server         string // clobbered based on /serverInfo request
-    Version        string // clobbered based on /serverInfo request
-    ConsumerName   string
-    ConsumerKey    string
+
+			
+
+			
+		
+			
+			
+			

type AuthResponse

+
type AuthResponse struct {
+    // The URL to visit to perform OAuth on this JIRA installation.
+    URL string
+}
+

+AuthResponse is a response to an AuthRequest. +

+ + + + + + + + + + + + + + + + +

type Realm

+
type Realm struct {
+
+    // The HTTPS URL of the JIRA installation to authenticate with.
+    JIRAEndpoint string
+    // The desired "Consumer Name" field of the "Application Links" admin page on JIRA.
+    // Generally this is the name of the service. Users will need to enter this string
+    // into their JIRA admin web form.
+    ConsumerName string
+    // The desired "Consumer Key" field of the "Application Links" admin page on JIRA.
+    // Generally this is the name of the service. Users will need to enter this string
+    // into their JIRA admin web form.
+    ConsumerKey string
+    // The desired "Consumer Secret" field of the "Application Links" admin page on JIRA.
+    // This should be a random long string. Users will need to enter this string into
+    // their JIRA admin web form.
     ConsumerSecret string
-    PublicKeyPEM   string // clobbered based on PrivateKeyPEM
-    PrivateKeyPEM  string
-    HasWebhook     bool // clobbered based on NEB
-    StarterLink    string
+    // A string which contains the private key for performing OAuth 1.0 requests.
+    // This MUST be in PEM format. It must NOT have a password. Go-NEB will convert this
+    // into a public key in PEM format and return this to users. Users will need to enter
+    // the *public* key into their JIRA admin web form.
+    //
+    // To generate a private key PEM: (JIRA does not support bit lengths >2048):
+    //    $ openssl genrsa -out privkey.pem 2048
+    //    $ cat privkey.pem
+    PrivateKeyPEM string
+    // Optional. If supplied, !jira commands will return this link whenever someone is
+    // prompted to login to JIRA.
+    StarterLink string
+
+    // The server name of the JIRA installation from /serverInfo.
+    // This is an informational field populated by Go-NEB post-creation.
+    Server string
+    // The JIRA version string from /serverInfo.
+    // This is an informational field populated by Go-NEB post-creation.
+    Version string
+    // The public key for the given private key. This is populated by Go-NEB.
+    PublicKeyPEM string
+
+    // Internal field. True if this realm has already registered a webhook with the JIRA installation.
+    HasWebhook bool
     // contains filtered or unexported fields
 }

-JIRARealm is an AuthRealm which can process JIRA installations +Realm is an AuthRealm which can process JIRA installations. +

+

+Example request:

+
{
+     "JIRAEndpoint": "matrix.org/jira/",
+     "ConsumerName": "goneb",
+     "ConsumerKey": "goneb",
+     "ConsumerSecret": "random_long_string",
+     "PrivateKeyPEM": "-----BEGIN RSA PRIVATE KEY-----\r\nMIIEowIBAAKCAQEA39UhbOvQHEkBP9fGnhU+eSObTAwX9req2l1NiuNaPU9rE7tf6Bk\r\n-----END RSA PRIVATE KEY-----"
+}
+
@@ -253,8 +365,8 @@ JIRARealm is an AuthRealm which can process JIRA installations -

func (*JIRARealm) AuthSession

-
func (r *JIRARealm) AuthSession(id, userID, realmID string) types.AuthSession
+

func (*Realm) AuthSession

+
func (r *Realm) AuthSession(id, userID, realmID string) types.AuthSession

AuthSession returns a JIRASession with the given parameters

@@ -264,8 +376,8 @@ AuthSession returns a JIRASession with the given parameters -

func (*JIRARealm) ID

-
func (r *JIRARealm) ID() string
+

func (*Realm) ID

+
func (r *Realm) ID() string

ID returns the ID of this JIRA realm.

@@ -275,8 +387,8 @@ ID returns the ID of this JIRA realm. -

func (*JIRARealm) Init

-
func (r *JIRARealm) Init() error
+

func (*Realm) Init

+
func (r *Realm) Init() error

Init initialises the private key for this JIRA realm.

@@ -286,8 +398,8 @@ Init initialises the private key for this JIRA realm. -

func (*JIRARealm) JIRAClient

-
func (r *JIRARealm) JIRAClient(userID string, allowUnauth bool) (*jira.Client, error)
+

func (*Realm) JIRAClient

+
func (r *Realm) JIRAClient(userID string, allowUnauth bool) (*jira.Client, error)

JIRAClient returns an authenticated jira.Client for the given userID. Returns an unauthenticated client if allowUnauth is true and no authenticated session is found, else returns an error. @@ -298,8 +410,8 @@ client if allowUnauth is true and no authenticated session is found, else return -

func (*JIRARealm) OnReceiveRedirect

-
func (r *JIRARealm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request)
+

func (*Realm) OnReceiveRedirect

+
func (r *Realm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request)

OnReceiveRedirect is called when JIRA installations redirect back to NEB

@@ -309,8 +421,8 @@ OnReceiveRedirect is called when JIRA installations redirect back to NEB -

func (*JIRARealm) ProjectKeyExists

-
func (r *JIRARealm) ProjectKeyExists(userID, projectKey string) (bool, error)
+

func (*Realm) ProjectKeyExists

+
func (r *Realm) ProjectKeyExists(userID, projectKey string) (bool, error)

ProjectKeyExists returns true if the given project key exists on this JIRA realm. An authenticated client for userID will be used if one exists, else an @@ -323,8 +435,8 @@ of projects. -

func (*JIRARealm) Register

-
func (r *JIRARealm) Register() error
+

func (*Realm) Register

+
func (r *Realm) Register() error

Register is called when this realm is being created from an external entity

@@ -334,19 +446,34 @@ Register is called when this realm is being created from an external entity -

func (*JIRARealm) RequestAuthSession

-
func (r *JIRARealm) RequestAuthSession(userID string, req json.RawMessage) interface{}
+

func (*Realm) RequestAuthSession

+
func (r *Realm) RequestAuthSession(userID string, req json.RawMessage) interface{}

-RequestAuthSession is called by a user wishing to auth with this JIRA realm +RequestAuthSession is called by a user wishing to auth with this JIRA realm. +The request body is of type "jira.AuthRequest". Returns a "jira.AuthResponse".

+

+Request example: +

+
{
+    "RedirectURL": "https://somewhere.somehow"
+}
+
+

+Response example: +

+
{
+    "URL": "https://jira.somewhere.com/plugins/servlet/oauth/authorize?oauth_token=7yeuierbgweguiegrTbOT"
+}
+
-

func (*JIRARealm) Type

-
func (r *JIRARealm) Type() string
+

func (*Realm) Type

+
func (r *Realm) Type() string

Type returns the type of realm this is.

@@ -358,16 +485,21 @@ Type returns the type of realm this is. -

type JIRASession

-
type JIRASession struct {
-    RequestSecret      string
-    AccessToken        string
-    AccessSecret       string
-    ClientsRedirectURL string // where to redirect the client to after auth
+			

type Session

+
type Session struct {
+
+    // The secret obtained when requesting an authentication session with JIRA.
+    RequestSecret string
+    // A JIRA access token for a Matrix user ID.
+    AccessToken string
+    // A JIRA access secret for a Matrix user ID.
+    AccessSecret string
+    // Optional. The URL to redirect the client to after authentication.
+    ClientsRedirectURL string
     // contains filtered or unexported fields
 }

-JIRASession represents a single authentication session between a user and a JIRA endpoint. +Session represents a single authentication session between a user and a JIRA endpoint. The endpoint is dictated by the realm ID.

@@ -384,8 +516,8 @@ The endpoint is dictated by the realm ID. -

func (*JIRASession) Authenticated

-
func (s *JIRASession) Authenticated() bool
+

func (*Session) Authenticated

+
func (s *Session) Authenticated() bool

Authenticated returns true if the user has completed the auth process

@@ -395,8 +527,8 @@ Authenticated returns true if the user has completed the auth process -

func (*JIRASession) ID

-
func (s *JIRASession) ID() string
+

func (*Session) ID

+
func (s *Session) ID() string

ID returns the OAuth1 request_token which is used when looking up sessions in the redirect handler. @@ -407,8 +539,8 @@ handler. -

func (*JIRASession) Info

-
func (s *JIRASession) Info() interface{}
+

func (*Session) Info

+
func (s *Session) Info() interface{}

Info returns nothing

@@ -418,8 +550,8 @@ Info returns nothing -

func (*JIRASession) RealmID

-
func (s *JIRASession) RealmID() string
+

func (*Session) RealmID

+
func (s *Session) RealmID() string

RealmID returns the JIRA realm ID which created this session.

@@ -429,8 +561,8 @@ RealmID returns the JIRA realm ID which created this session. -

func (*JIRASession) UserID

-
func (s *JIRASession) UserID() string
+

func (*Session) UserID

+
func (s *Session) UserID() string

UserID returns the ID of the user performing the authentication.

diff --git a/pkg/github.com/matrix-org/go-neb/services/echo/index.html b/pkg/github.com/matrix-org/go-neb/services/echo/index.html index 67da52f..7566e0a 100644 --- a/pkg/github.com/matrix-org/go-neb/services/echo/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/echo/index.html @@ -116,7 +116,7 @@ Package echo implements a Service which echoes back !commands. -
    func (e *Service) Commands(cli *matrix.Client, roomID string) []types.Command
+
    func (e *Service) Commands(cli *matrix.Client) []types.Command
@@ -211,8 +211,8 @@ Service represents the Echo service. It has no Config fields. -

func (*Service) Commands

-
func (e *Service) Commands(cli *matrix.Client, roomID string) []types.Command
+

func (*Service) Commands

+
func (e *Service) Commands(cli *matrix.Client) []types.Command

Commands supported:

diff --git a/pkg/github.com/matrix-org/go-neb/services/giphy/index.html b/pkg/github.com/matrix-org/go-neb/services/giphy/index.html index 79c9306..5a6e8fa 100644 --- a/pkg/github.com/matrix-org/go-neb/services/giphy/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/giphy/index.html @@ -116,7 +116,7 @@ Package giphy implements a Service which adds !commands for Giphy. -
    func (s *Service) Commands(client *matrix.Client, roomID string) []types.Command
+
    func (s *Service) Commands(client *matrix.Client) []types.Command
@@ -190,7 +190,7 @@ ServiceType of the Giphy service. -

type Service

+

type Service

type Service struct {
     types.DefaultService
     // The Giphy API key to use when making HTTP requests to Giphy.
@@ -201,7 +201,7 @@ ServiceType of the Giphy service.
 Service contains the Config fields for the Giphy Service.
 

-Example: +Example request:

{
     "api_key": "dc6zaTOxFJmzC"
@@ -221,8 +221,8 @@ Example:
 
 			
 				
-				

func (*Service) Commands

-
func (s *Service) Commands(client *matrix.Client, roomID string) []types.Command
+

func (*Service) Commands

+
func (s *Service) Commands(client *matrix.Client) []types.Command

Commands supported:

diff --git a/pkg/github.com/matrix-org/go-neb/services/github/index.html b/pkg/github.com/matrix-org/go-neb/services/github/index.html index 7ab3430..5aef9cd 100644 --- a/pkg/github.com/matrix-org/go-neb/services/github/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/github/index.html @@ -122,10 +122,10 @@ webhook service adds Github webhook support. -
    func (s *Service) Commands(cli *matrix.Client, roomID string) []types.Command
+
    func (s *Service) Commands(cli *matrix.Client) []types.Command
-
    func (s *Service) Expansions(cli *matrix.Client, roomID string) []types.Expansion
+
    func (s *Service) Expansions(cli *matrix.Client) []types.Expansion
    func (s *Service) Register(oldService types.Service, client *matrix.Client) error
@@ -224,7 +224,7 @@ WebhookServiceType of the Github Webhook service. -

type Service

+

type Service

type Service struct {
     types.DefaultService
     // The ID of an existing "github" realm. This realm will be used to obtain
@@ -235,8 +235,7 @@ WebhookServiceType of the Github Webhook service.
 Service contains the Config fields for the Github service.
 

-Before you can set up a Github Service, you need to set up a Github Realm. This -service requires a syncing client. +Before you can set up a Github Service, you need to set up a Github Realm.

You can set a "default repository" for a Matrix room by sending a `m.room.bot.options` state event @@ -252,7 +251,7 @@ which has the following `content`: This will allow the "owner/repo" to be omitted when creating/expanding issues.

-Example: +Example request:

{
     "RealmID": "github-realm-id"
@@ -272,8 +271,8 @@ Example:
 
 			
 				
-				

func (*Service) Commands

-
func (s *Service) Commands(cli *matrix.Client, roomID string) []types.Command
+

func (*Service) Commands

+
func (s *Service) Commands(cli *matrix.Client) []types.Command

Commands supported:

@@ -290,8 +289,8 @@ is no link, it will return a Starter Link instead. -

func (*Service) Expansions

-
func (s *Service) Expansions(cli *matrix.Client, roomID string) []types.Expansion
+

func (*Service) Expansions

+
func (s *Service) Expansions(cli *matrix.Client) []types.Expansion

Expansions expands strings of the form:

@@ -312,7 +311,7 @@ using the default repository. -

func (*Service) Register

+

func (*Service) Register

func (s *Service) Register(oldService types.Service, client *matrix.Client) error

Register makes sure that the given realm ID maps to a github realm. @@ -325,7 +324,7 @@ Register makes sure that the given realm ID maps to a github realm. -

type WebhookService

+

type WebhookService

type WebhookService struct {
     types.DefaultService
 
@@ -366,7 +365,7 @@ to it. It requires a public domain which Github can reach. Notices will be sent
 as the service user ID, not the ClientUserID.
 

-Example: +Example request:

{
     ClientUserID: "@alice:localhost",
@@ -396,7 +395,7 @@ Example:
 
 			
 				
-				

func (*WebhookService) OnReceiveWebhook

+

func (*WebhookService) OnReceiveWebhook

func (s *WebhookService) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli *matrix.Client)

OnReceiveWebhook receives requests from Github and possibly sends requests to Matrix as a result. @@ -416,7 +415,7 @@ Github. -

func (*WebhookService) PostRegister

+

func (*WebhookService) PostRegister

func (s *WebhookService) PostRegister(oldService types.Service)

PostRegister cleans up removed repositories from the old service by @@ -428,7 +427,7 @@ working out the delta between the old and new hooks. -

func (*WebhookService) Register

+

func (*WebhookService) Register

func (s *WebhookService) Register(oldService types.Service, client *matrix.Client) error

Register will create webhooks for the repos specified in Rooms diff --git a/pkg/github.com/matrix-org/go-neb/services/guggy/index.html b/pkg/github.com/matrix-org/go-neb/services/guggy/index.html index a652eff..99da79c 100644 --- a/pkg/github.com/matrix-org/go-neb/services/guggy/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/guggy/index.html @@ -116,7 +116,7 @@ Package guggy implements a Service which adds !commands for Guggy. -

    func (s *Service) Commands(client *matrix.Client, roomID string) []types.Command
+
    func (s *Service) Commands(client *matrix.Client) []types.Command
@@ -190,7 +190,7 @@ ServiceType of the Guggy service -

type Service

+

type Service

type Service struct {
     types.DefaultService
     // The Guggy API key to use when making HTTP requests to Guggy.
@@ -200,7 +200,7 @@ ServiceType of the Guggy service
 Service contains the Config fields for the Guggy service.
 

-Example: +Example request:

{
     "api_key": "fkweugfyuwegfweyg"
@@ -220,8 +220,8 @@ Example:
 
 			
 				
-				

func (*Service) Commands

-
func (s *Service) Commands(client *matrix.Client, roomID string) []types.Command
+

func (*Service) Commands

+
func (s *Service) Commands(client *matrix.Client) []types.Command

Commands supported:

diff --git a/pkg/github.com/matrix-org/go-neb/services/jira/index.html b/pkg/github.com/matrix-org/go-neb/services/jira/index.html index c0c4657..0d268aa 100644 --- a/pkg/github.com/matrix-org/go-neb/services/jira/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/jira/index.html @@ -121,10 +121,10 @@ The service adds !commands and issue expansions, in addition to JIRA webhook sup -
    func (s *Service) Commands(cli *matrix.Client, roomID string) []types.Command
+
    func (s *Service) Commands(cli *matrix.Client) []types.Command
-
    func (s *Service) Expansions(cli *matrix.Client, roomID string) []types.Expansion
+
    func (s *Service) Expansions(cli *matrix.Client) []types.Expansion
    func (s *Service) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli *matrix.Client)
@@ -204,7 +204,7 @@ ServiceType of the JIRA Service -

type Service

+

type Service

type Service struct {
     types.DefaultService
 
@@ -234,7 +234,7 @@ Service contains the Config fields for the JIRA service.
 Before you can set up a JIRA Service, you need to set up a JIRA Realm.
 

-Example: +Example request:

{
     Rooms: {
@@ -265,8 +265,8 @@ Example:
 
 			
 				
-				

func (*Service) Commands

-
func (s *Service) Commands(cli *matrix.Client, roomID string) []types.Command
+

func (*Service) Commands

+
func (s *Service) Commands(cli *matrix.Client) []types.Command

Commands supported:

@@ -287,8 +287,8 @@ if there is a known public project with that project key. -

func (*Service) Expansions

-
func (s *Service) Expansions(cli *matrix.Client, roomID string) []types.Expansion
+

func (*Service) Expansions

+
func (s *Service) Expansions(cli *matrix.Client) []types.Expansion

Expansions expands JIRA issues represented as:

@@ -306,7 +306,7 @@ be chosen arbitrarily. -

func (*Service) OnReceiveWebhook

+

func (*Service) OnReceiveWebhook

func (s *Service) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli *matrix.Client)

OnReceiveWebhook receives requests from JIRA and possibly sends requests to Matrix as a result. @@ -317,7 +317,7 @@ OnReceiveWebhook receives requests from JIRA and possibly sends requests to Matr -

func (*Service) Register

+

func (*Service) Register

func (s *Service) Register(oldService types.Service, client *matrix.Client) error

Register ensures that the given realm IDs are valid JIRA realms and registers webhooks diff --git a/pkg/github.com/matrix-org/go-neb/services/jira/webhook/index.html b/pkg/github.com/matrix-org/go-neb/services/jira/webhook/index.html index a3ac1eb..187d296 100644 --- a/pkg/github.com/matrix-org/go-neb/services/jira/webhook/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/jira/webhook/index.html @@ -109,7 +109,7 @@

func OnReceiveRequest(req *http.Request) (string, *Event, *errors.HTTPError)
-
func RegisterHook(jrealm *realms.JIRARealm, projects []string, userID, webhookEndpointURL string) error
+
func RegisterHook(jrealm *jira.Realm, projects []string, userID, webhookEndpointURL string) error
@@ -178,7 +178,7 @@ -

func OnReceiveRequest

+

func OnReceiveRequest

func OnReceiveRequest(req *http.Request) (string, *Event, *errors.HTTPError)

OnReceiveRequest is called when JIRA hits NEB with an update. @@ -191,8 +191,8 @@ Returns the project key and webhook event, or an error. -

func RegisterHook

-
func RegisterHook(jrealm *realms.JIRARealm, projects []string, userID, webhookEndpointURL string) error
+

func RegisterHook

+
func RegisterHook(jrealm *jira.Realm, projects []string, userID, webhookEndpointURL string) error

RegisterHook checks to see if this user is allowed to track the given projects and then tracks them.

@@ -204,12 +204,12 @@ RegisterHook checks to see if this user is allowed to track the given projects a -

type Event

+

type Event

type Event struct {
-    WebhookEvent string     `json:"webhookEvent"`
-    Timestamp    int64      `json:"timestamp"`
-    User         jira.User  `json:"user"`
-    Issue        jira.Issue `json:"issue"`
+    WebhookEvent string       `json:"webhookEvent"`
+    Timestamp    int64        `json:"timestamp"`
+    User         gojira.User  `json:"user"`
+    Issue        gojira.Issue `json:"issue"`
 }

Event represents an incoming JIRA webhook event diff --git a/pkg/github.com/matrix-org/go-neb/services/rssbot/index.html b/pkg/github.com/matrix-org/go-neb/services/rssbot/index.html index f6cf301..4b7c2fd 100644 --- a/pkg/github.com/matrix-org/go-neb/services/rssbot/index.html +++ b/pkg/github.com/matrix-org/go-neb/services/rssbot/index.html @@ -196,7 +196,7 @@ ServiceType of the RSS Bot service -

type Service

+

type Service

type Service struct {
     types.DefaultService
     // Feeds is a map of feed URL to configuration options for this feed.
@@ -221,7 +221,7 @@ ServiceType of the RSS Bot service
 Service contains the Config fields for this service.
 

-Example: +Example request:

{
     feeds: {
@@ -249,7 +249,7 @@ Example:
 
 			
 				
-				

func (*Service) OnPoll

+

func (*Service) OnPoll

func (s *Service) OnPoll(cli *matrix.Client) time.Time

OnPoll rechecks RSS feeds which are due to be polled. @@ -272,7 +272,7 @@ Returns a timestamp representing when this Service should have OnPoll called aga -

func (*Service) PostRegister

+

func (*Service) PostRegister

func (s *Service) PostRegister(oldService types.Service)

PostRegister deletes this service if there are no feeds remaining. @@ -283,7 +283,7 @@ PostRegister deletes this service if there are no feeds remaining. -

func (*Service) Register

+

func (*Service) Register

func (s *Service) Register(oldService types.Service, client *matrix.Client) error

Register will check the liveness of each RSS feed given. If all feeds check out okay, no error is returned. diff --git a/pkg/github.com/matrix-org/go-neb/types/index.html b/pkg/github.com/matrix-org/go-neb/types/index.html index e9ad77a..2fa30fd 100644 --- a/pkg/github.com/matrix-org/go-neb/types/index.html +++ b/pkg/github.com/matrix-org/go-neb/types/index.html @@ -152,10 +152,10 @@ -

    func (s *DefaultService) Commands(cli *matrix.Client, roomID string) []Command
+
    func (s *DefaultService) Commands(cli *matrix.Client) []Command
-
    func (s *DefaultService) Expansions(cli *matrix.Client, roomID string) []Expansion
+
    func (s *DefaultService) Expansions(cli *matrix.Client) []Expansion
    func (s *DefaultService) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli *matrix.Client)
@@ -259,7 +259,7 @@ -

func BaseURL

+

func BaseURL

func BaseURL(u string) error

BaseURL sets the base URL of NEB to the url given. This URL must be accessible from the @@ -272,7 +272,7 @@ public internet. -

func PollingServiceTypes

+

func PollingServiceTypes

func PollingServiceTypes() (types []string)

PollingServiceTypes returns a list of service types which meet the Poller interface @@ -296,7 +296,7 @@ RegisterAuthRealm registers a factory for creating AuthRealm instances. -

func RegisterService

+

func RegisterService

func RegisterService(factory func(string, string, string) Service)

RegisterService registers a factory for creating Service instances. @@ -444,7 +444,7 @@ Matches if the arguments start with the path of the command. -

type DefaultService

+

type DefaultService

type DefaultService struct {
     // contains filtered or unexported fields
 }
@@ -463,7 +463,7 @@ DefaultService NO-OPs the implementation of optional Service interface methods. -

func NewDefaultService

+

func NewDefaultService

func NewDefaultService(serviceID, serviceUserID, serviceType string) DefaultService

NewDefaultService creates a new service with implementations for ServiceID(), ServiceType() and ServiceUserID() @@ -475,8 +475,8 @@ NewDefaultService creates a new service with implementations for ServiceID(), Se -

func (*DefaultService) Commands

-
func (s *DefaultService) Commands(cli *matrix.Client, roomID string) []Command
+

func (*DefaultService) Commands

+
func (s *DefaultService) Commands(cli *matrix.Client) []Command

Commands returns no commands.

@@ -486,8 +486,8 @@ Commands returns no commands. -

func (*DefaultService) Expansions

-
func (s *DefaultService) Expansions(cli *matrix.Client, roomID string) []Expansion
+

func (*DefaultService) Expansions

+
func (s *DefaultService) Expansions(cli *matrix.Client) []Expansion

Expansions returns no expansions.

@@ -497,7 +497,7 @@ Expansions returns no expansions. -

func (*DefaultService) OnReceiveWebhook

+

func (*DefaultService) OnReceiveWebhook

func (s *DefaultService) OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli *matrix.Client)

OnReceiveWebhook does nothing but 200 OK the request. @@ -508,7 +508,7 @@ OnReceiveWebhook does nothing but 200 OK the request. -

func (*DefaultService) PostRegister

+

func (*DefaultService) PostRegister

func (s *DefaultService) PostRegister(oldService Service)

PostRegister does nothing. @@ -519,7 +519,7 @@ PostRegister does nothing. -

func (*DefaultService) Register

+

func (*DefaultService) Register

func (s *DefaultService) Register(oldService Service, client *matrix.Client) error

Register does nothing and returns no error. @@ -530,7 +530,7 @@ Register does nothing and returns no error. -

func (*DefaultService) ServiceID

+

func (*DefaultService) ServiceID

func (s *DefaultService) ServiceID() string

ServiceID returns the service's ID. In order for this to return the ID, DefaultService MUST have been @@ -542,7 +542,7 @@ initialised by NewDefaultService, the zero-initialiser is NOT enough. -

func (*DefaultService) ServiceType

+

func (*DefaultService) ServiceType

func (s *DefaultService) ServiceType() string

ServiceType returns the type of service. See each individual service package for the ServiceType constant @@ -555,7 +555,7 @@ initialised by NewDefaultService, the zero-initialiser is NOT enough. -

func (*DefaultService) ServiceUserID

+

func (*DefaultService) ServiceUserID

func (s *DefaultService) ServiceUserID() string

ServiceUserID returns the user ID that the service sends events as. In order for this to return the @@ -622,7 +622,7 @@ Poller represents a thing which can poll. Services should implement this method -

type Service

+

type Service

type Service interface {
     // Return the user ID of this service.
     ServiceUserID() string
@@ -630,8 +630,8 @@ Poller represents a thing which can poll. Services should implement this method
     ServiceID() string
     // Return the type of service. This string MUST NOT change.
     ServiceType() string
-    Commands(cli *matrix.Client, roomID string) []Command
-    Expansions(cli *matrix.Client, roomID string) []Expansion
+    Commands(cli *matrix.Client) []Command
+    Expansions(cli *matrix.Client) []Expansion
     OnReceiveWebhook(w http.ResponseWriter, req *http.Request, cli *matrix.Client)
     // A lifecycle function which is invoked when the service is being registered. The old service, if one exists, is provided,
     // along with a Client instance for ServiceUserID(). If this function returns an error, the service will not be registered
@@ -659,7 +659,7 @@ A Service is the configuration for a bot service.
 
 			
 				
-				

func CreateService

+

func CreateService

func CreateService(serviceID, serviceType, serviceUserID string, serviceJSON []byte) (Service, error)

CreateService creates a Service of the given type and serviceID. diff --git a/pkg/github.com/matrix-org/index.html b/pkg/github.com/matrix-org/index.html index c7b3988..c17c268 100644 --- a/pkg/github.com/matrix-org/index.html +++ b/pkg/github.com/matrix-org/index.html @@ -212,7 +212,7 @@ github - + Package github implements OAuth2 support for github.com @@ -223,7 +223,7 @@ jira - + Package jira implements OAuth1.0a support for arbitrary JIRA installations.