Refactor API client initialization and simplify types
Streamlined API client initialization within the NewApi function by directly invoking the client creation. Additionally, removed custom type declarations and constants in model/product.go, replacing them with simpler string types to reduce complexity.
This commit is contained in:
parent
e14d4b188b
commit
25e131269d
@ -16,8 +16,7 @@ type IApi interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewApi(credentials client.Credentials) IApi {
|
func NewApi(credentials client.Credentials) IApi {
|
||||||
client := client.NewClient(credentials)
|
|
||||||
return &Api{
|
return &Api{
|
||||||
Client: client,
|
Client: client.NewClient(credentials),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
type VideosType string
|
|
||||||
type WarehouseDataIncomingType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
VideoTypeFile VideosType = "file"
|
|
||||||
VideoTypeUrl VideosType = "url"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
WarehouseDataIncomingTypeShipping WarehouseDataIncomingType = "shipping"
|
|
||||||
WarehouseDataIncomingTypeProduction WarehouseDataIncomingType = "production"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ImageVariant struct {
|
ImageVariant struct {
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
@ -42,10 +29,10 @@ type (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Video struct {
|
Video struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
Type VideosType `json:"type"`
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Software struct {
|
Software struct {
|
||||||
@ -72,10 +59,10 @@ type (
|
|||||||
WarehouseName string `json:"warehouseName"`
|
WarehouseName string `json:"warehouseName"`
|
||||||
AvailableAmount int `json:"availableAmount"`
|
AvailableAmount int `json:"availableAmount"`
|
||||||
Incoming []struct {
|
Incoming []struct {
|
||||||
DateBegan string `json:"dateBegan"`
|
DateBegan string `json:"dateBegan"`
|
||||||
DateEnd string `json:"dateEnd"`
|
DateEnd string `json:"dateEnd"`
|
||||||
Amount int `json:"amount"`
|
Amount int `json:"amount"`
|
||||||
Type WarehouseDataIncomingType `json:"type"`
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user