Documentation ¶
Overview ¶
Package User Microservice API.
This serves as the user's microservice api definition for the CUBE Platform ¶
Terms Of Service:
there are no TOS at this moment, use at your own risk we take no responsibility
Schemes: http, https Host: localhost BasePath: /v1 Version: 1.0.0 License: MIT http://opensource.org/licenses/MIT Contact: Yoan Yomba<yoanyombapro@gmail.com.com> http://CUBE.com Consumes: - application/json Produces: - application/json Security: - api_key: Extensions: x-meta-value: value x-meta-array: - value1 - value2 x-meta-array-obj: - name: obj value: field
swagger:meta
Index ¶
- func AttachAuthTokenToHeader(token *authentication.TokenId, req *http.Request)
- func AttachIdToUrl(id uint32, req *http.Request) (map[string]string, *http.Request)
- func CheckResponseCode(t *testing.T, expected, actual int)
- func ConstructCreateTeamRequestHelper(t *testing.T, jsonStr []byte, srv *Server, adminUserId uint32) (*http.Request, bool)
- func ConstructCreateUserRequestHelper(t *testing.T, jsonStr []byte, srv *Server) (*http.Request, bool)
- func CreateTeamAndConvertToJson() (error, []byte)
- func CreateTeamAndOptionalTeamProfile(t *testing.T, srv *Server, createProfileResponse CreateTeamProfileResponse, ...) (uint32, string, error)
- func CreateTeamProfileAndConvertToJson() ([]byte, error)
- func CreateTeamSubscriptionAndConvertToJson() (error, []byte)
- func CreateToken(userId int32) (string, error)
- func CreateUserAndConvertToJson() (error, []byte)
- func CreateUserAndOptionalUserProfile(t *testing.T, srv *Server, createProfileResponse CreateUserProfileResponse, ...) (uint32, uint32, string, error)
- func CreateUserProfileAndConvertToJson() (error, []byte)
- func CreateUserSubscriptionAndConvertToJson() (error, []byte)
- func DeleteCreatedEntities(db *gorm.DB) func()
- func DeleteTeam(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func DeleteTeamProfile(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func DeleteUser(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func DeleteUserProfile(userAccountId uint32, profileId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func ExecuteRequest(req *http.Request, handle func(http.ResponseWriter, *http.Request)) *httptest.ResponseRecorder
- func ExtractIdFromToken(token string) (error, int)
- func GenerateTestTeamProfile() model.TeamProfile
- func GetAllUsers(token string, srv *Server, limit int) *httptest.ResponseRecorder
- func GetRandomString() (string, error, bool)
- func GetTeam(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func GetTeamProfile(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func GetUser(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func GetUserProfile(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
- func Initialize(connSettings string) *database.Database
- func NewUUID() (string, error)
- func SignupAndStoreTokenInHeader(t *testing.T, srv *Server, name, password string, req *http.Request) bool
- func UpdateRequestHeaders(req *http.Request, token string)
- func UpdateTeam(teamAccountId uint32, token string, payload []byte, srv *Server) *httptest.ResponseRecorder
- func UpdateTeamProfile(teamAccountId uint32, token string, payload []byte, srv *Server) *httptest.ResponseRecorder
- type ArrayResponse
- type Config
- type CreateTeamProfileRequest
- type CreateTeamProfileResponse
- type CreateTeamRequest
- type CreateTeamResponse
- type CreateTeamSubscriptionRequest
- type CreateTeamSubscriptionResponse
- type CreateUserProfileRequest
- type CreateUserProfileResponse
- type CreateUserRequest
- type CreateUserResponse
- type CreateUserSubscriptionRequest
- type CreateUserSubscriptionResponse
- type DeleteSubscriptionRequestSwagger
- type DeleteTeamProfileResponse
- type DeleteTeamResponse
- type DeleteUserByIdRequestSwagger
- type DeleteUserProfileRequestSwagger
- type FluxConfig
- type GetAllUserProfileResponse
- type GetAllUserProfilesSwagger
- type GetAllUserSubscriptionsRequestSwagger
- type GetAllUserSubscriptionsResponse
- type GetAllUserSubscriptionsResponseSwagger
- type GetAllUsersByAccountTypeRequestSwagger
- type GetAllUsersByIntentRequestSwagger
- type GetAllUsersRequestSwagger
- type GetAllUsersResponse
- type GetAllUsersResponseSwagger
- type GetTeamProfileResponse
- type GetTeamResponse
- type GetUserByIdRequestSwagger
- type GetUserProfileRequestSwagger
- type GetUserProfileResponse
- type GetUserProfileResponseSwagger
- type GetUserProfilesByNationalityRequestSwagger
- type GetUserProfilesByProfileTypeRequestSwagger
- type LoginResponse
- type LoginTeamRequest
- type LoginUserRequest
- type MapResponse
- type OperationResponse
- type OperationResponseSwagger
- type RuntimeResponse
- type Server
- func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, error string, code int)
- func (s *Server) ExtractJwtFromHeader(r *http.Request) (error, uint32)
- func (s *Server) JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})
- func (s *Server) JSONResponseCode(w http.ResponseWriter, r *http.Request, result interface{}, responseCode int)
- func (s *Server) ListenAndServe(stopCh <-chan struct{})
- func (s *Server) TeamExistsToAuthService(w http.ResponseWriter, team *model.Team) bool
- func (s *Server) UserExistsToAuthService(w http.ResponseWriter, user *model.User) bool
- type TokenResponse
- type TokenValidationResponse
- type UpdateTeamProfileRequest
- type UpdateTeamProfileRequestSwagger
- type UpdateTeamProfileResponse
- type UpdateTeamProfileResponseSwagger
- type UpdateTeamRequest
- type UpdateTeamRequestSwagger
- type UpdateTeamResponse
- type UpdateTeamResponseSwagger
- type UpdateUserProfileRequest
- type UpdateUserProfileRequestSwagger
- type UpdateUserProfileResponse
- type UpdateUserProfileResponseSwagger
- type UpdateUserRequestSwagger
- type UpdateUserSubscriptionRequest
- type UpdateUserSubscriptionResponse
- type UserOperationResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachAuthTokenToHeader ¶
func AttachAuthTokenToHeader(token *authentication.TokenId, req *http.Request)
AttachAuthTokenToHeader attaches an authorization token to a request header
func AttachIdToUrl ¶
func CheckResponseCode ¶
CheckResponseCode asserts that the expected response code matches the actual response code
func CreateTeamAndConvertToJson ¶
creates a team and marshalls to json byte string
func CreateTeamSubscriptionAndConvertToJson ¶
create a random subscription and marshalls to json byte string
func CreateToken ¶
CreateToken creates an access token (jwt) and attaches it to a jwt claims map
func CreateUserAndConvertToJson ¶
Creates a random user and marshall to json returning any error occuring as well as the marshalled json string
func CreateUserProfileAndConvertToJson ¶
Creates a random user profile and marshall to json returning any error occuring as well as the marshalled json string
func CreateUserSubscriptionAndConvertToJson ¶
create a random subscription and marshalls to json byte string
func DeleteCreatedEntities ¶
DeleteCreatedEntities sets up GORM `onCreate` hook and return a function that can be deferred to remove all the entities created after the hook was set up You can use it as
func TestSomething(t *testing.T){ db, _ := gorm.Open(...) cleaner := DeleteCreatedEntities(db) defer cleaner()
}
func DeleteTeam ¶
func DeleteTeam(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func DeleteTeamProfile ¶
func DeleteTeamProfile(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func DeleteUser ¶
func DeleteUser(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func DeleteUserProfile ¶
func ExecuteRequest ¶
func ExecuteRequest(req *http.Request, handle func(http.ResponseWriter, *http.Request)) *httptest.ResponseRecorder
ExecuteRequest executes an api request and returns a recorded response
func ExtractIdFromToken ¶
Extracts an account id from a jwt token
func GenerateTestTeamProfile ¶
func GenerateTestTeamProfile() model.TeamProfile
func GetAllUsers ¶
func GetAllUsers(token string, srv *Server, limit int) *httptest.ResponseRecorder
func GetRandomString ¶
func GetTeam ¶
func GetTeam(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func GetTeamProfile ¶
func GetTeamProfile(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func GetUser ¶
func GetUser(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func GetUserProfile ¶
func GetUserProfile(userAccountId uint32, token string, srv *Server) *httptest.ResponseRecorder
func Initialize ¶
func UpdateRequestHeaders ¶
Updates the request headers and adds a jwt token as well as content type
func UpdateTeam ¶
func UpdateTeamProfile ¶
Types ¶
type ArrayResponse ¶
type ArrayResponse []string
type Config ¶
type Config struct { HttpClientTimeout time.Duration `mapstructure:"http-client-timeout"` HttpServerTimeout time.Duration `mapstructure:"http-server-timeout"` HttpServerShutdownTimeout time.Duration `mapstructure:"http-server-shutdown-timeout"` BackendURL []string `mapstructure:"backend-url"` UILogo string `mapstructure:"ui-logo"` UIMessage string `mapstructure:"ui-message"` UIColor string `mapstructure:"ui-color"` UIPath string `mapstructure:"ui-path"` DataPath string `mapstructure:"data-path"` ConfigPath string `mapstructure:"config-path"` Port string `mapstructure:"port"` PortMetrics int `mapstructure:"port-metrics"` Hostname string `mapstructure:"hostname"` H2C bool `mapstructure:"h2c"` RandomDelay bool `mapstructure:"random-delay"` RandomError bool `mapstructure:"random-error"` Unhealthy bool `mapstructure:"unhealthy"` Unready bool `mapstructure:"unready"` JWTSecret string `mapstructure:"jwt-secret"` Production bool `mapstructure:"production"` RedirectToHttps bool `mapstructure:"redirectohttps"` ServiceName string `mapstructure:"service-name"` ZipkinServerUrl string `mapstructure:"zipkin-server-url"` AmqpServerUrl string `mapstructure:"amqp-server-url"` EnableAuthServicePrivateIntegration bool `mapstructure:"ENABLE_AUTH_SERVICE_PRIVATE_INTEGRATION"` ServiceEmail string `mapstructure:"SERVICE_EMAIL"` }
type CreateTeamProfileRequest ¶
type CreateTeamProfileRequest struct {
Profile model.TeamProfile `json:"payload"`
}
type CreateTeamRequest ¶
type CreateTeamResponse ¶
type CreateTeamSubscriptionRequest ¶
type CreateTeamSubscriptionRequest struct {
Subscription model.Subscriptions `json:"payload"`
}
type CreateUserRequest ¶
type CreateUserResponse ¶
type CreateUserSubscriptionRequest ¶
type CreateUserSubscriptionRequest struct {
Subscription model.Subscriptions `json:"result"`
}
type CreateUserSubscriptionResponse ¶
type CreateUserSubscriptionResponse struct { Error error `json:"error"` Subscription []*model.Subscriptions `json:"result"` }
type DeleteSubscriptionRequestSwagger ¶
type DeleteSubscriptionRequestSwagger struct { // user account id // in: query // required: true UserAccountId uint32 // contains filtered or unexported fields }
swagger:parameters deleteSubscription
type DeleteTeamProfileResponse ¶
type DeleteTeamProfileResponse struct {
Error error `json:"error"`
}
type DeleteTeamResponse ¶
type DeleteTeamResponse struct {
Error error `json:"error"`
}
type DeleteUserByIdRequestSwagger ¶
type DeleteUserByIdRequestSwagger struct { // id of the user account to delete // in: query // required: true Id uint32 `json:"result"` }
Delete user by id request swagger:parameters deleteUser
type DeleteUserProfileRequestSwagger ¶
type DeleteUserProfileRequestSwagger struct { // user account id // in: query // required: true UserAccountId uint32 // profile id // in: query // required: true ProfileId uint32 }
swagger:parameters deleteProfile
type FluxConfig ¶
type GetAllUserProfilesSwagger ¶
type GetAllUserProfilesSwagger struct { // in: query // required: true Limit uint32 }
swagger: response getAllUserProfiles
type GetAllUserSubscriptionsRequestSwagger ¶
type GetAllUserSubscriptionsRequestSwagger struct { // in: query AccountId uint32 }
swagger:parameters getAllSubscriptions
type GetAllUserSubscriptionsResponse ¶
type GetAllUserSubscriptionsResponse struct { Error error `json:"error"` Subscriptions []model.Subscriptions `json:"result"` }
type GetAllUserSubscriptionsResponseSwagger ¶
type GetAllUserSubscriptionsResponseSwagger struct { // in: body Body struct { // errors occuring throughout the request lifecycle // required: true Error error `json:"error"` // set of subscriptions of interest // required: true Subscriptions []model.Subscriptions `json:"result"` } }
swagger:response getSubscriptionsResponse
type GetAllUsersByAccountTypeRequestSwagger ¶
type GetAllUsersByAccountTypeRequestSwagger struct {
// contains filtered or unexported fields
}
swagger:parameters getAllUsersByAccountTypeRequest
type GetAllUsersByIntentRequestSwagger ¶
type GetAllUsersByIntentRequestSwagger struct {
// contains filtered or unexported fields
}
swagger:parameters getAllUsersByIntentRequest
type GetAllUsersRequestSwagger ¶
type GetAllUsersRequestSwagger struct {
// contains filtered or unexported fields
}
swagger:parameters getAllUsersRequest
type GetAllUsersResponse ¶
type GetAllUsersResponseSwagger ¶
type GetAllUsersResponseSwagger struct { // in: body Body struct { // error // required: true Error error `json:"error"` // set of users // required: true Users []model.User `json:"result"` } }
swagger:response getAllUsersResponse
type GetTeamProfileResponse ¶
type GetTeamProfileResponse struct { Error error `json:"error"` TeamProfile model.TeamProfile `json:"payload"` }
type GetTeamResponse ¶
type GetUserByIdRequestSwagger ¶
type GetUserByIdRequestSwagger struct { // id of the user account to get // in: query // required: true Id uint32 `json:"result"` }
Get user by id request swagger:parameters getUser
type GetUserProfileRequestSwagger ¶
type GetUserProfileRequestSwagger struct { // in: query // required: true AccountId uint32 `json:"error"` }
swagger:parameters getUserProfile
type GetUserProfileResponse ¶
type GetUserProfileResponseSwagger ¶
type GetUserProfileResponseSwagger struct { // in: body Body struct { // error // required: true Error error `json:"error"` // profile of interest // required: true UserProfile model.Profile `json:"result"` } }
swagger:response getUserProfileResponse
type GetUserProfilesByNationalityRequestSwagger ¶
type GetUserProfilesByNationalityRequestSwagger struct { // in: query // required: true Nationality string // required: true Limit uint32 }
swagger: parameters getAllUserProfilesByNationality
type GetUserProfilesByProfileTypeRequestSwagger ¶
type GetUserProfilesByProfileTypeRequestSwagger struct { // in: query // required: true ProfileType string // required: true Limit uint32 }
swagger: parameters getAllUserProfilesByProfileType
type LoginResponse ¶
type LoginTeamRequest ¶
type LoginUserRequest ¶
type MapResponse ¶
type OperationResponse ¶
type OperationResponse struct {
Error error `json:"error"`
}
type OperationResponseSwagger ¶
type OperationResponseSwagger struct { // in: body Body struct { // error // required: true // example: Error occured Error error `json:"error"` } }
swagger:response operationResponse
type RuntimeResponse ¶
type RuntimeResponse struct { Hostname string `json:"hostname"` Version string `json:"version"` Revision string `json:"revision"` Color string `json:"color"` Logo string `json:"logo"` Message string `json:"message"` GOOS string `json:"goos"` GOARCH string `json:"goarch"` Runtime string `json:"runtime"` NumGoroutine string `json:"num_goroutine"` NumCPU string `json:"num_cpu"` }
type Server ¶
type Server struct { Db *database.Database Auth *authentication.Authentication JwtConfig *authentication.JwtConfiguration Keys *authentication.JsonKeys InfraCounters *infrastructure.InfrastructureCounters MessagingClient *rabbitmq.RabbitMQClient // contains filtered or unexported fields }
func InitializeMockServer ¶
func InitializeMockServer() *Server
func InitializeMockServerAndDb ¶
func InitializeMockServerAndDb() (*Server, func())
func NewMockServer ¶
func NewMockServer() *Server
func NewServer ¶
func NewServer( config *Config, logger *zap.Logger, database *database.Database, messagingClient *rabbitmq.RabbitMQClient, infrastructureCounter *infrastructure.InfrastructureCounters, authServiceWrapper *authentication.Authentication) (*Server, error)
func (*Server) ErrorResponse ¶
func (*Server) ExtractJwtFromHeader ¶
func (*Server) JSONResponse ¶
func (s *Server) JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})
func (*Server) JSONResponseCode ¶
func (*Server) ListenAndServe ¶
func (s *Server) ListenAndServe(stopCh <-chan struct{})
func (*Server) TeamExistsToAuthService ¶
func (*Server) UserExistsToAuthService ¶
type TokenResponse ¶
type TokenValidationResponse ¶
type UpdateTeamProfileRequest ¶
type UpdateTeamProfileRequest struct {
Profile model.TeamProfile `json:"payload"`
}
type UpdateTeamProfileRequestSwagger ¶
type UpdateTeamProfileRequestSwagger struct { // in: body Body struct { // team profile to update // required: true TeamProfile model.TeamProfile `json:"payload"` } // in: query // required: true // example; 1243 TeamId uint32 `json:"teamId"` }
Update team profile request swagger:parameters updateTeamProfileRequest
type UpdateTeamProfileResponseSwagger ¶
type UpdateTeamProfileResponseSwagger struct { // in: body Body struct { // updated team profile // required: true TeamProfile model.TeamProfile `json:"result"` // error // required: true Error error `json:"error"` } }
Updated team profile response swagger:response updateTeamProfileResponse
type UpdateTeamRequest ¶
type UpdateTeamRequestSwagger ¶
type UpdateTeamRequestSwagger struct { // in: body Body struct { // team to update // required: true Team model.Team `json:"payload"` } // in: query // required: true // exmaple; 1243 TeamId uint32 `json:"teamId"` }
Update team request swagger:parameters updateTeamRequest
type UpdateTeamResponse ¶
type UpdateTeamResponseSwagger ¶
type UpdateTeamResponseSwagger struct { // in: body Body struct { // updated team // required: true Team model.Team `json:"result"` // error // required: true Error error `json:"error"` } }
Updated team response swagger:response updateTeamResponse
type UpdateUserProfileRequestSwagger ¶
type UpdateUserProfileRequestSwagger struct { // in: body Body struct { // errors // required: true Error error `json:"error"` // profile to update // required: true Profile model.Profile `json:"result"` } // user account id // in: query // required: true UserAccountId uint32 // profile id // in: query // required: true ProfileId uint32 }
swagger:parameters updateProfile
type UpdateUserProfileResponseSwagger ¶
type UpdateUserProfileResponseSwagger struct { // in: body Body struct { // error // required: true Error error `json:"error"` // profile to update // required: true Profile model.Profile `json:"result"` } }
swagger:response updateProfileResponse
type UpdateUserRequestSwagger ¶
type UpdateUserRequestSwagger struct { // user account to create // in: body Body struct { // required: true User model.User `json:"result"` } }
Update user request swagger:parameters updateUser
type UpdateUserSubscriptionRequest ¶
type UpdateUserSubscriptionRequest struct {
Subscription model.Subscriptions `json:"result"`
}
type UpdateUserSubscriptionResponse ¶
type UpdateUserSubscriptionResponse struct { Error error `json:"error"` Subscription model.Subscriptions `json:"result"` }
type UserOperationResponse ¶
Source Files ¶
- chunked.go
- configs.go
- create_team.go
- create_team_profile.go
- create_update_team_subscription.go
- create_user.go
- create_user_profile.go
- create_user_subscription.go
- delete_team.go
- delete_team_profile.go
- delete_user.go
- delete_user_profile.go
- delete_user_subscription.go
- echo.go
- echows.go
- env.go
- get_all_user_profiles.go
- get_all_user_subscriptions.go
- get_all_users.go
- get_team.go
- get_team_profile.go
- get_user.go
- get_user_profile.go
- headers.go
- health.go
- http.go
- index.go
- info.go
- login_team.go
- login_user.go
- logout.go
- mock.go
- panic.go
- server.go
- status.go
- store.go
- testutils.go
- token.go
- update_team.go
- update_team_profile.go
- update_user.go
- update_user_profile.go
- update_user_subscription.go
- version.go