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 {
|
||||
client := client.NewClient(credentials)
|
||||
return &Api{
|
||||
Client: client,
|
||||
Client: client.NewClient(credentials),
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,5 @@
|
||||
package model
|
||||
|
||||
type VideosType string
|
||||
type WarehouseDataIncomingType string
|
||||
|
||||
const (
|
||||
VideoTypeFile VideosType = "file"
|
||||
VideoTypeUrl VideosType = "url"
|
||||
)
|
||||
|
||||
const (
|
||||
WarehouseDataIncomingTypeShipping WarehouseDataIncomingType = "shipping"
|
||||
WarehouseDataIncomingTypeProduction WarehouseDataIncomingType = "production"
|
||||
)
|
||||
|
||||
type (
|
||||
ImageVariant struct {
|
||||
Url string `json:"url"`
|
||||
@ -42,10 +29,10 @@ type (
|
||||
}
|
||||
|
||||
Video struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Url string `json:"url"`
|
||||
Type VideosType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Url string `json:"url"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
Software struct {
|
||||
@ -72,10 +59,10 @@ type (
|
||||
WarehouseName string `json:"warehouseName"`
|
||||
AvailableAmount int `json:"availableAmount"`
|
||||
Incoming []struct {
|
||||
DateBegan string `json:"dateBegan"`
|
||||
DateEnd string `json:"dateEnd"`
|
||||
Amount int `json:"amount"`
|
||||
Type WarehouseDataIncomingType `json:"type"`
|
||||
DateBegan string `json:"dateBegan"`
|
||||
DateEnd string `json:"dateEnd"`
|
||||
Amount int `json:"amount"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user