Documentation
¶
Overview ¶
Package classification of STLKER API
Documentation for STLKER API ¶
Schemes: http BasePath: / Version: 1.0.0
Consumes: - application/json
Produces: - application/json swagger:meta
Index ¶
- func Authenticate(next http.Handler) http.Handler
- func CompanyOverview(ticker string, client pb.WatcherClient) (*data.MoreStock, error)
- func Info(ticker, destination string, client pb.WatcherClient) (*data.Stock, error)
- type Claims
- type ControlHandler
- func (c *ControlHandler) Cache(next http.Handler) http.Handler
- func (c *ControlHandler) CreatePortfolio(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) CreateSecurity(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) DeletePortfolio(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) DeleteSecurity(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) DeleteUser(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) GetAll(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) GetInfo(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) GetPortfolio(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) LogIn(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) LogOut(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) Logger(next http.Handler) http.Handler
- func (c *ControlHandler) MoreInfo(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) ReadSecurity(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) Refresh(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) SignUp(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) UpdatePortfolio(w http.ResponseWriter, r *http.Request)
- func (c *ControlHandler) UpdateSecurity(w http.ResponseWriter, r *http.Request)
- type IsAdmin
- type NamePair
- type ReqPortfolio
- type ReqSecurity
- type ReqSecurityWrapper
- type ResponseMessage
- type Username
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompanyOverview ¶
CompanyOverview returns a pointer to a MoreStock struct and an error if one arises
Types ¶
type Claims ¶
type Claims struct { Name string `json:"Name"` Admin bool `json:"Admin"` jwt.StandardClaims }
type ControlHandler ¶
type ControlHandler struct {
// contains filtered or unexported fields
}
ControlHandler is a http.Handler
func NewControlHandler ¶
func NewControlHandler(log *slog.Logger, wc pb.WatcherClient, rOptions *redis.Ring, portRepo r.IPortfolioRepository, secRepo r.ISecurityRepository, userRepo r.IUserRepository) *ControlHandler
NewControlHandler constructs a new ControlHandler struct
func (*ControlHandler) Cache ¶
func (c *ControlHandler) Cache(next http.Handler) http.Handler
Cache is a middleware that checks if a user cached their portfolio's profits in the past 15 minutes
func (*ControlHandler) CreatePortfolio ¶
func (c *ControlHandler) CreatePortfolio(w http.ResponseWriter, r *http.Request)
swagger:route POST /portfolios portfolios createPortfolio Creates a new portfolio for a user responses:
200: messageResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) CreateSecurity ¶
func (c *ControlHandler) CreateSecurity(w http.ResponseWriter, r *http.Request)
swagger:route POST /portfolios/{name} securities createSecurity Creates a new security responses:
200: messageResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) DeletePortfolio ¶
func (c *ControlHandler) DeletePortfolio(w http.ResponseWriter, r *http.Request)
swagger:route DELETE /portfolios/{name} portfolios deletePortfolio Deletes a given portfolio for a user responses:
200: messageResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) DeleteSecurity ¶
func (c *ControlHandler) DeleteSecurity(w http.ResponseWriter, r *http.Request)
swagger:route DELETE /portfolios/{name}/{ticker} securities deleteSecurity Deletes a security from a given portfolio responses:
200: messageResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) DeleteUser ¶
func (c *ControlHandler) DeleteUser(w http.ResponseWriter, r *http.Request)
DeleteUser deletes the user from
func (*ControlHandler) GetAll ¶
func (c *ControlHandler) GetAll(w http.ResponseWriter, r *http.Request)
swagger:route GET /portfolios portfolios getPortfolios Outputs all of the portfolios for a user responses:
200: profitsResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) GetInfo ¶
func (c *ControlHandler) GetInfo(w http.ResponseWriter, r *http.Request)
swagger:route GET /stocks/{ticker}/{currency} stocks getInfo Outputs a stock's financial details to the client in the requested currency responses:
200: stockResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) GetPortfolio ¶
func (c *ControlHandler) GetPortfolio(w http.ResponseWriter, r *http.Request)
swagger:route GET /portfolios/{name} portfolios getPortfolio Outputs a particular portfolio for a user responses:
200: profitResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) LogIn ¶
func (c *ControlHandler) LogIn(w http.ResponseWriter, r *http.Request)
LogIn handles requests to /login and creates JWTs for valid users
func (*ControlHandler) LogOut ¶
func (c *ControlHandler) LogOut(w http.ResponseWriter, r *http.Request)
LogOut deletes the token cookie
func (*ControlHandler) MoreInfo ¶
func (c *ControlHandler) MoreInfo(w http.ResponseWriter, r *http.Request)
swagger:route GET /stocks/more/{ticker} stocks moreInfo Outputs more sophisticated stock information responses:
200: moreStockResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) ReadSecurity ¶
func (c *ControlHandler) ReadSecurity(w http.ResponseWriter, r *http.Request)
swagger:route GET /portfolios/{name}/{ticker} securities readSecurity Outputs a security's details to the client responses:
200: securityResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) Refresh ¶
func (c *ControlHandler) Refresh(w http.ResponseWriter, r *http.Request)
Refresh handles requests to /refresh and regenerates tokens if the current token is within a minute of expiry
func (*ControlHandler) SignUp ¶
func (c *ControlHandler) SignUp(w http.ResponseWriter, r *http.Request)
SignUp handles requests to /signup and adds new users to the db
func (*ControlHandler) UpdatePortfolio ¶
func (c *ControlHandler) UpdatePortfolio(w http.ResponseWriter, r *http.Request)
swagger:route PUT /portfolios portfolios updatePortfolio Updates a given portfolio responses:
200: messageResponse 400: errorResponse 500: errorResponse
func (*ControlHandler) UpdateSecurity ¶
func (c *ControlHandler) UpdateSecurity(w http.ResponseWriter, r *http.Request)
swagger:route PUT /portfolios/{name} securities updateSecurity Updates a security's information for a given portfolio responses:
200: messageResponse 400: errorResponse 500: errorResponse
type ReqPortfolio ¶
swagger:parameters createPortfolio updatePortfolio
type ReqSecurity ¶
type ReqSecurity struct { // ticker of the security // // required: true // example: AAPL Ticker string `json:"Ticker"` // // required: true // example: 5.32 Shares float64 `json:"Shares"` }
swagger:model
type ReqSecurityWrapper ¶
type ReqSecurityWrapper struct { // A single portfolio // in: body Body ReqSecurity }
swagger:parameters createSecurity updateSecurity
type ResponseMessage ¶
type ResponseMessage struct {
Msg string `json:"Message"`
}