response

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositResponse

type DepositResponse struct {
	Balance float64 `json:"balance"` // Updated wallet balance after the deposit transaction
}

DepositResponse represents the response body for a successful deposit transaction. It includes the updated wallet balance after the deposit.

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"` // JWT token for the authenticated user
}

LoginResponse represents the response body for a successful login operation. This includes a JWT token, which is required for subsequent authenticated requests.

type ProfileResponse

type ProfileResponse struct {
	ID      *uuid.UUID `json:"id"`      // Unique identifier for the user
	Login   string     `json:"login"`   // User's login name
	Balance float64    `json:"balance"` // User's current wallet balance
}

ProfileResponse represents the response body for retrieving a user's profile information. It includes the user's unique identifier, login, and wallet balance.

type RegisterResponse

type RegisterResponse struct {
	ID    *uuid.UUID `json:"id"`    // Unique identifier for the newly registered user
	Login string     `json:"login"` // Login name for the newly registered user
}

RegisterResponse represents the response body for a successful user registration. It includes the user's unique identifier and login information.

func RegisterFromModel

func RegisterFromModel(user *models.User) *RegisterResponse

RegisterFromModel creates a RegisterResponse instance from a User model. This function is used to generate a serializable response object upon successful user registration.

Parameters:

  • user: A pointer to a models.User instance containing user data.

Returns:

A pointer to a RegisterResponse instance containing the user's ID and login.

type SpinHistoryResponse

type SpinHistoryResponse struct {
	BetAmount float64 `json:"bet_amount"` // The amount the user bet on this spin
	WinAmount float64 `json:"win_amount"` // The amount the user won on this spin
	Date      string  `json:"date"`       // The date and time of this spin, formatted as "YYYY-MM-DD HH:MM:SS"
}

SpinHistoryResponse represents a structured response for a user's spin history. It includes essential details such as the bet amount, win amount, and the date of each spin.

func SpinHistoryFromModel

func SpinHistoryFromModel(model *models.Spin) *SpinHistoryResponse

SpinHistoryFromModel converts a Spin model instance to a SpinHistoryResponse instance. This function is used to create a serializable response object for a single spin record in history.

Parameters:

  • model: A pointer to a models.Spin instance containing the original spin data.

Returns:

A pointer to a SpinHistoryResponse instance containing the mapped data from the input model.

func SpinHistoryFromModels

func SpinHistoryFromModels(models []*models.Spin) []*SpinHistoryResponse

SpinHistoryFromModels converts a slice of Spin model instances to a slice of SpinHistoryResponse instances. This function generates a collection of serializable response objects for multiple spin records in history.

Parameters:

  • models: A slice of pointers to models.Spin instances, each representing a spin record.

Returns:

A slice of pointers to SpinHistoryResponse instances, with each entry containing mapped data
from a corresponding input model.

type SpinResponse

type SpinResponse struct {
	WinAmount float64 `json:"win_amount"` // The amount the user won on this spin
}

SpinResponse represents the response returned after a spin is completed, containing information about the amount won in that spin.

func SpinFromModel

func SpinFromModel(model *models.Spin) *SpinResponse

SpinFromModel creates a SpinResponse instance from a Spin model. This function is used to generate a response object with the winning amount from a spin.

Parameters:

  • model: A pointer to a models.Spin instance containing the spin data.

Returns:

A pointer to a SpinResponse instance with the win amount mapped from the input model.

type WithdrawResponse

type WithdrawResponse struct {
	Balance float64 `json:"balance"` // Updated wallet balance after the withdrawal transaction
}

WithdrawResponse represents the response body for a successful withdrawal transaction. It includes the updated wallet balance after the withdrawal.

Jump to

Keyboard shortcuts

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