Documentation ¶
Index ¶
Constants ¶
const ( STATUS_PENDING = "pending" STATUS_ERROR = "error" STATUS_ISSUED = "issued" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIEnvelopeResponse ¶
type APIEnvelopeResponse struct { Status int `json:"status" example:"201"` Message string `json:"message" example:"use this JWT token as a bearer token to authenticate into the API"` Data interface{} `json:"data"` }
APIEnvelopeResponse is a generic API Response used only for openapi generation
type Pagination ¶
type Pagination struct { Limit int `json:"limit"` Page int `json:"page"` Sort string `json:"sort"` }
Pagination is a struct used to store pagination data for GetAll API requests
func GeneratePaginationFromRequest ¶
func GeneratePaginationFromRequest(c *gin.Context) Pagination
GeneratePaginationFromRequest is a method used to turn extract data from a http request into a Pagination struct
type Request ¶
type Request struct { Id int `json:"id" gorm:"primary_key;auto_increment;not null" example:"1"` Domain string `json:"domain" binding:"required" gorm:"not null" example:"mydomain.com"` ChallengeType string `json:"challengeType" binding:"required" gorm:"not null" example:"challenge-http"` Status string `json:"status" gorm:"not_null" example:"pending"` IssuedAt *time.Time `json:"issuedAt" gorm:"default:null" example:"2022-07-06 12:03:10.0"` CreatedAt time.Time `json:"createdAt" example:"2022-06-06 12:03:10.0"` UpdatedAt time.Time `json:"updatedAt" example:"2022-06-06 12:03:10.0"` DeletedAt gorm.DeletedAt `json:"deletedAt" swaggertype:"primitive,string" gorm:"index" example:"2022-06-06 12:03:10.0"` }
Request is a database struct that is used to store certificate requests in the database
func (*Request) GetAll ¶
GetAll is a method used for getting all certificate requests from the database in a paginated array
func (*Request) GetAllExpiringSoon ¶
GetAllExpiringSoon is a method used for getting all certificate requests from the database that are 1 month from expiration
type RequestCreate ¶
type RequestCreate struct { Domain string `json:"domain" binding:"required" example:"mydomain.com"` ChallengeType string `json:"challengeType" binding:"required" enums:"challenge-tls,challenge-http,challenge-dns"` }
RequestCreate is a struct used only for openapi documentation generation to show the input data for creating a certificate request
type User ¶
type User struct { Id int `json:"id" gorm:"primary_key;auto_increment;not null" swaggerignore:"true"` Email string `json:"email" binding:"required" gorm:"size:100;not null;unique" example:"example@chargeover.com"` Password string `json:"password" binding:"required" gorm:"size:100;not null" example:"correct-horse-battery-staple"` CreatedAt time.Time `swaggerignore:"true"` UpdatedAt time.Time `swaggerignore:"true"` DeletedAt gorm.DeletedAt `swaggerignore:"true"` }
User is a database struct used to store a record
func (*User) Authenticate ¶
Authenticate is a method used to verify a users credentials
func (*User) BeforeSave ¶
BeforeSave is an ORM lifecycle hook to hash a users password before insertion
func (*User) VerifyPassword ¶
VerifyPassword is a method compares a plaintext password against a hashed version to see if they match
type UserResponse ¶
type UserResponse struct { Status int `json:"status" binding:"required" example:"201"` Message string `json:"message" binding:"required" example:"use this JWT token as a bearer token to authenticate into the API"` Data string `json:"data" binding:"required" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6I... (truncated)"` }
UserResponse is a struct used for openapi docs generation to a api response sample from the API