server

package
v0.0.0-...-f450a9d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoutes

func AddRoutes(e *gin.Engine, a Server)

AddRoutes accepts a *gin.Engine and adds all the necessary routes to it for this API.

Types

type RegistrationRequest

type RegistrationRequest struct {
	UserUUID string `json:"user_uuid" binding:"required"`
	Email    string `json:"email" binding:"required"`
}

RegistrationRequest encodes a single request for user registration

type Server

type Server interface {
	// frontend
	ServeSPA(c *gin.Context)

	// user api
	AddPlaidItem(c *gin.Context)
	GetAccounts(c *gin.Context)

	// admin api
	RegisterUser(c *gin.Context)

	// plaid webhooks
	GenericPlaidWebhook(c *gin.Context)

	// authorization code
	BackendAuthorizationMiddleware(c *gin.Context)
	FrontendAuthorizationMiddleware(c *gin.Context)
}

Server is the gin server interface for the public API

type ServerAgent

type ServerAgent struct {
	// contains filtered or unexported fields
}

ServerAgent implements Server

func NewServer

func NewServer(
	logger tools.Logger,

	serviceDomain string,

	authMgr auth.AuthorizationManager,
	renderer views.Renderer,
	authorize auth.Getter,
	plaidClient plaidapi.Client,
	dbClient db.DB,
) ServerAgent

NewServer creates a new Server.

func (ServerAgent) AddPlaidItem

func (a ServerAgent) AddPlaidItem(c *gin.Context)

AddPlaidItem adds all the accounts associated with this plaid item

func (ServerAgent) BackendAuthorizationMiddleware

func (a ServerAgent) BackendAuthorizationMiddleware(c *gin.Context)

BackendAuthorizationMiddleware callback for the backend authorization middleware

func (ServerAgent) FrontendAuthorizationMiddleware

func (a ServerAgent) FrontendAuthorizationMiddleware(c *gin.Context)

FrontendAuthorizationMiddleware callback for the frontend authorization middleware

func (ServerAgent) GenericPlaidWebhook

func (a ServerAgent) GenericPlaidWebhook(c *gin.Context)

GenericPlaidWebhook accepts all Plaid webhook requests

func (ServerAgent) GetAccounts

func (a ServerAgent) GetAccounts(c *gin.Context)

GetAccounts gets all the accounts

func (ServerAgent) RegisterUser

func (a ServerAgent) RegisterUser(c *gin.Context)

RegisterUser adds all the accounts associated with this plaid item

func (ServerAgent) ServeSPA

func (a ServerAgent) ServeSPA(c *gin.Context)

ServeSPA serves the single-page app

type WebhookCode

type WebhookCode string
const (
	InitialUpdate       WebhookCode = "INITIAL_UPDATE"
	HistoricalUpdate    WebhookCode = "HISTORICAL_UPDATE"
	DefaultUpdate       WebhookCode = "DEFAULT_UPDATE"
	TransactionsRemoved WebhookCode = "TRANSACTIONS_REMOVED"

	ItemWebhookUpdateAcknowledged WebhookCode = "WEBHOOK_UPDATE_ACKNOWLEDGED"
	ItemError                     WebhookCode = "ERROR"
)

func (WebhookCode) IsRemoval

func (t WebhookCode) IsRemoval() bool

type WebhookRequest

type WebhookRequest struct {
	Type                WebhookType     `json:"webhook_type"`
	Code                WebhookCode     `json:"webhook_code"`
	ItemID              string          `json:"item_id"`
	Error               json.RawMessage `json:"error"`
	Newtransactions     int             `json:"new_transactions"`
	RemovedTransactions []string        `json:"removed_transactions"`
	NewWebhookURL       string          `json:"new_webhook_url"`
}

type WebhookType

type WebhookType string
const (
	ItemWebhookType         WebhookType = "ITEM"
	TransactionsWebhookType WebhookType = "TRANSACTIONS"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL