handlers

package
v0.0.0-...-4543906 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivityLog

func ActivityLog(c *gin.Context)

func CreateAPIKey

func CreateAPIKey(c *gin.Context)

CreateAPIKey creates a new API key.

func DeleteAPIKey

func DeleteAPIKey(c *gin.Context)

DeleteAPIKey deletes an API key.

func GenerateAPIKey

func GenerateAPIKey(c *gin.Context)

GenerateAPIKey generates a new API key for the authenticated user with default limits.

func GetProfile

func GetProfile(c *gin.Context)

GetProfile returns the profile of the currently authenticated user.

func GetUserAPIKey

func GetUserAPIKey(c *gin.Context)

GetUserAPIKey returns the current API key for the authenticated user.

func GetUserStats

func GetUserStats(c *gin.Context)

GetUserStats returns comprehensive API statistics for the current user's API key, including total requests, average response time (ms), remaining credits, global requests, and the key details.

func ListAPIKeys

func ListAPIKeys(c *gin.Context)

ListAPIKeys returns a list of all API keys.

func ListUsers

func ListUsers(c *gin.Context)

ListUsers returns all registered users.

func Login

func Login(c *gin.Context)

Login authenticates a user and returns a JWT token.

func Logout

func Logout(c *gin.Context)

Logout invalidates the current session token by blacklisting it.

func RefreshToken

func RefreshToken(c *gin.Context)

RefreshToken generates a new JWT token.

func Register

func Register(c *gin.Context)

Register creates a new user.

func Stats

func Stats(c *gin.Context)

Stats returns usage statistics.

func UpdateAPIKey

func UpdateAPIKey(c *gin.Context)

UpdateAPIKey updates an API key's settings.

func UpdateProfile

func UpdateProfile(c *gin.Context)

UpdateProfile allows a user to update their profile.

Types

type APIKeyUpdateRequest

type APIKeyUpdateRequest struct {
	UserID      string `json:"user_id" binding:"required"`
	RateLimit   int    `json:"rate_limit" binding:"required"`
	Concurrency int    `json:"concurrency" binding:"required"`
}

APIKeyUpdateRequest represents the payload for updating an API key.

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	UserID      string `json:"user_id" binding:"required"`
	RateLimit   int    `json:"rate_limit" binding:"required"`
	Concurrency int    `json:"concurrency" binding:"required"`
}

CreateAPIKeyRequest represents the payload for creating an API key.

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

LoginRequest represents the payload for user login.

type RegistrationRequest

type RegistrationRequest struct {
	Username string `json:"username" binding:"required,min=3"`
	Password string `json:"password" binding:"required,min=6"`
}

RegistrationRequest represents the payload for user registration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL