dto

package
v0.0.0-...-3248bb2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddMonitoringStep

type AddMonitoringStep struct {
	Data MonitoringData
	Step MonitoringStep
}

type Data

type Data struct {
	Entities []Entity `json:"entities"`
}

Data represents the data structure from the API

type Entity

type Entity struct {
	ID               int    `json:"id"`
	Name             string `json:"name"`
	Nation           string `json:"nation"`
	Subnation        string `json:"subnation"`
	UseSubnationFlag bool   `json:"use_subnation_flag"`
	TypeSlug         string `json:"type_slug"`
	Level            int    `json:"level"`
	RomanLevel       string `json:"roman_level"`
	UserString       string `json:"user_string"`
	ImageURL         string `json:"image_url"`
	PreviewImageURL  string `json:"preview_image_url"`
	IsPremium        bool   `json:"is_premium"`
	IsCollectible    bool   `json:"is_collectible"`
}

Entity represents the entity details in the JSON response

type MonitoringData

type MonitoringData struct {
	VehicleName  string `json:"vehicle_name"`
	ChatID       int64  `json:"chat_id"`
	MinimalCount int    `json:"minimal_count"`
}

type MonitoringStep

type MonitoringStep int
const (
	StepSelectVehicle MonitoringStep = iota
	StepEnterMinimalCount
)

type Price

type Price struct {
	Currency struct {
		Name     string   `json:"name"`
		Count    int      `json:"count"`
		Title    string   `json:"title"`
		ImageURL string   `json:"image_url"`
		Sizes    struct{} `json:"sizes"`
		Type     string   `json:"type"`
	} `json:"currency"`
	Value int `json:"value"`
}

Price represents the price details in the JSON response

type Response

type Response struct {
	Count   int      `json:"count"`
	HasNext bool     `json:"has_next"`
	Results []Result `json:"results"`
}

Response represents the entire JSON response

type Result

type Result struct {
	ID                 int    `json:"id"`
	Type               string `json:"type"`
	Countable          bool   `json:"countable"`
	Entity             Entity `json:"entity"`
	InitialCount       int    `json:"initial_count"`
	CurrentCount       int    `json:"current_count"`
	Saleable           bool   `json:"saleable"`
	AvailableFrom      string `json:"available_from"`
	AvailableBefore    string `json:"available_before"`
	Price              Price  `json:"price"`
	NextPrice          *Price `json:"next_price"`
	Available          bool   `json:"available"`
	Display            bool   `json:"display"`
	NextPriceDatetime  string `json:"next_price_datetime"`
	NextPriceTimestamp int    `json:"next_price_timestamp"`
}

Result represents each item in the "results" array in the JSON response

type Vehicle

type Vehicle struct {
	ID                 int
	Type               string
	Countable          bool
	Entity             Entity
	InitialCount       int
	CurrentCount       int
	Saleable           bool
	AvailableFrom      time.Time
	AvailableBefore    time.Time
	Price              Price
	NextPrice          *Price
	Available          bool
	Display            bool
	NextPriceDatetime  time.Time
	NextPriceTimestamp int
}

Vehicle represents a vehicle with additional information

type VehicleInfo

type VehicleInfo struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	Nation        string `json:"nation"`
	Type          string `json:"type"`
	Level         string `json:"level"`
	Img           string `json:"img"`
	InitialCount  int    `json:"initialCount"`
	CurrentCount  int    `json:"current_count"`
	Price         int    `json:"price"`
	NextPrice     int    `json:"next_price,omitempty"`
	Available     bool   `json:"available"`
	AvailableTill string `json:"available_till"`
}

func MapResultToVehicleInfo

func MapResultToVehicleInfo(result Result) VehicleInfo

func (*VehicleInfo) String

func (v *VehicleInfo) String() string

String returns a formatted string representation of the Vehicle

Jump to

Keyboard shortcuts

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