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:
Павел Синицин 2024-09-07 19:18:32 +03:00
parent e14d4b188b
commit 25e131269d
Signed by: spavelit
GPG Key ID: 2FEC8CEAE5A95DD1
2 changed files with 9 additions and 23 deletions

View File

@ -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),
}
}

View File

@ -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"`
@ -45,7 +32,7 @@ type (
Name string `json:"name"`
Description string `json:"description"`
Url string `json:"url"`
Type VideosType `json:"type"`
Type string `json:"type"`
}
Software struct {
@ -75,7 +62,7 @@ type (
DateBegan string `json:"dateBegan"`
DateEnd string `json:"dateEnd"`
Amount int `json:"amount"`
Type WarehouseDataIncomingType `json:"type"`
Type string `json:"type"`
}
}