📝 Create missing models for API documentation

This commit is contained in:
2024-01-18 00:09:26 +01:00
parent e0190f4bb5
commit 607682884c
6 changed files with 68 additions and 49 deletions

5
models/error.go Normal file
View File

@@ -0,0 +1,5 @@
package models
type ErrorResponse struct {
Error string `json:"error"`
}

View File

@@ -6,9 +6,16 @@ import "time"
// @Description Model of the Hostname as it
// @Description is represented in the database
type Hostname struct {
ID int `json:"id"` // Internal ID of the Hostname within the database
Category string `json:"category"` // Category / Rule that was used when generating the hostname
Hostname string `json:"hostname"` // Generated hostname
Parameters map[string]interface{} `json:"parameters"` // Parameter object of rule specific attributes
CreatedAt time.Time `json:"created_at"` // Creation Time of the entry
ID int `json:"Id" example:"25"` // Internal ID of the Hostname within the database
Category string `json:"Category" example:"notebook"` // Category / Rule that was used when generating the hostname
Hostname string `json:"Hostname" example:"ISEHENNB0009"` // Generated hostname
Parameters map[string]interface{} `json:"Parameters"` // Parameter object of rule specific attributes, see rule.* models
CreatedAt time.Time `json:"Created_at" example:"2024-01-16T12:53:59Z"` // Creation Time of the entry
}
// SimpleHostnameResponse
// @Description Model of the Hostname as returned by
// @Description POST endpoint
type SimpleHostnameResponse struct {
Hostname string `json:"Hostname"` // Name of the newly generated host
}

View File

@@ -4,6 +4,12 @@ package models
// @Description User account information used in the login process
// @Description with Username and password
type LoginCredentials struct {
Username string `json:"username"`
Password string `json:"password"`
Username string `json:"Username"`
Password string `json:"Password"`
}
// JWT Token Response Model
// @Description Model returned after successful login
type TokenResponse struct {
Token string `json:"token"`
}