Documentation
¶
Index ¶
- func CreateCompany(c echo.Context) error
- func CreateUser(c echo.Context) error
- func DeleteCompany(c echo.Context) error
- func FindCompanyByField(c echo.Context) error
- func ListCompanies(c echo.Context) error
- func LoginUser(c echo.Context) error
- func LogoutUser(c echo.Context) error
- func UpdateCompany(c echo.Context) error
- type AccessToken
- type CompanyRequest
- type CreateCompanyResponse
- type CreateUserResponse
- type DeleteCompanyResponse
- type LoginUserResponse
- type LogoutUserRequest
- type LogoutUserResponse
- type UpdateCompanyResponse
- type UserRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCompany ¶
CreateCompany Use curl: curl -v POST http://localhost:8080/v0.9/company/ -H 'Content-Type: application/json' -d '{"name":"my_company","code":"23323","country":"Ukraine","website":"https://something.com","phone":"23323"}'
func CreateUser ¶
CreateUser Use curl: curl -v POST http://localhost:8080/v0.9/user/register -H 'Content-Type: application/json' -d '{"userName":"my_login","password":"my_password"}'
func DeleteCompany ¶
DeleteCompany Use curl: curl -v DELETE http://localhost:8080/v0.9/company/86e9860c-d11b-4317-7625-c95ee3db87c7
func FindCompanyByField ¶
FindCompany Use curl: curl -v GET http://localhost:8080/v0.9/company?field=code&value=23323
func ListCompanies ¶
ListCompanies Use curl: curl -v GET http://localhost:8080/v0.9/company/
func LoginUser ¶
LoginUser Use curl: curl -v POST http://localhost:8080/v0.9/user/login -H 'Content-Type: application/json' -d '{"userName":"my_login","password":"my_password"}'
func LogoutUser ¶
LogoutUser Use curl: curl -v POST http://localhost:8080/v1/user/logout -H 'Content-Type: application/json' -d '{"userName":"access_token","password":"my_access_token"}'
func UpdateCompany ¶
UpdateCompanyResponse Use curl: curl -v PUT http://localhost:8080/v0.9/company/ -H 'Content-Type: application/json' -d '{"id":"6e52a033-c6e9-4305-51a6-59f00bb108b3","name":"my_company","code":"23323","country":"Ukraine","website":"https://something.com","phone":"23323"}'
Types ¶
type AccessToken ¶
type AccessToken struct {
Token string `json:"token"`
}
type CompanyRequest ¶
type CompanyRequest struct {
Token string `json:"token"`
Id string `json:"id"`
Name string `json:"name" validate:"required,min=1,max=100"`
Code string `json:"code" validate:"required,min=1,max=100"`
Country string `json:"country" validate:"required,min=1,max=20"`
Website string `json:"website" validate:"required,min=1,max=100"`
Phone string `json:"phone" validate:"required,min=1,max=16"`
}
CompanyRequest defines model for CompanyRequest.
type CreateCompanyResponse ¶
type CreateCompanyResponse struct {
Id string `json:"id"`
CompanyName string `json:"company_name"`
}
CreateCompanyResponse defines model for CreateCompanyResponse.
type CreateUserResponse ¶
CreateUserResponse defines model for CreateUserResponse.
type DeleteCompanyResponse ¶
type DeleteCompanyResponse struct {
Msg string `json:"msg"`
}
DeleteCompanyResponse defines model for DeleteCompanyResponse.
type LoginUserResponse ¶
type LoginUserResponse struct {
AccessToken string `json:"token"`
}
LoginUserResponse defines model for LoginUserResponse.
type LogoutUserRequest ¶
type LogoutUserRequest struct {
AccessToken string `json:"token"`
}
LogoutUserRequest defines model for LogoutUserRequest.
type LogoutUserResponse ¶
type LogoutUserResponse struct {
Msg string `json:"msg"`
}
LogoutUserResponse defines model for LoginUserResponse.
type UpdateCompanyResponse ¶
type UpdateCompanyResponse struct {
Id string `json:"id"`
CompanyName string `json:"company_name"`
}
UpdateCompanyResponse defines model for UpdateCompanyResponse.
type UserRequest ¶
type UserRequest struct {
UserName string `json:"user_name" validate:"required,min=4,max=100"`
Password string `json:"password" validate:"required,min=8,max=100"`
}
UserRequest defines model for UserRequest.