Documentation ¶
Index ¶
- type AggregateRequestOption
- type AggregateRequestParams
- type ProductStatistics
- type Review
- type ReviewRequestOption
- func WithAsArray(asArray bool) ReviewRequestOption
- func WithFrom(from time.Time) ReviewRequestOption
- func WithLimit(limit int) ReviewRequestOption
- func WithPage(page int) ReviewRequestOption
- func WithRemoved(removed int) ReviewRequestOption
- func WithSort(sort string) ReviewRequestOption
- func WithTo(to time.Time) ReviewRequestOption
- type ReviewRequestParams
- type ShopperApprovedClient
- func (client *ShopperApprovedClient) FetchAggregateStatistics(params *AggregateRequestParams) (*ProductStatistics, error)
- func (client *ShopperApprovedClient) FetchAllProductReviews(params *ReviewRequestParams) (map[string]Review, error)
- func (client *ShopperApprovedClient) FetchReviews(params *ReviewRequestParams) (map[string]Review, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateRequestOption ¶
type AggregateRequestOption func(*AggregateRequestParams)
AggregateRequestOption defines the type of the function that will set the options.
func WithProductID ¶
func WithProductID(productID int) AggregateRequestOption
WithProductID sets the ProductID for the AggregateRequestParams.
type AggregateRequestParams ¶
type AggregateRequestParams struct { ProductID *int ByMatchKey *bool AsArray *bool SiteOnly *bool FastMode *bool }
AggregateRequestParams represents parameters for the API request to fetch aggregate product statistics.
func NewAggregateRequestParams ¶
func NewAggregateRequestParams(opts ...AggregateRequestOption) *AggregateRequestParams
NewAggregateRequestParams initializes a new AggregateRequestParams with given options.
type ProductStatistics ¶
type ProductStatistics struct { CertificateURL string `json:"certificate_url,omitempty"` ProductTotals struct { TotalReviews int `json:"total_reviews"` AverageRating float64 `json:"average_rating"` TotalWithComments int `json:"total_with_comments"` } `json:"product_totals"` SiteTotals struct { TotalReviews int `json:"total_reviews"` AverageRating float64 `json:"average_rating"` TotalWithComments int `json:"total_with_comments"` } `json:"site_totals,omitempty"` }
ProductStatistics represents aggregated product feedback statistics.
type Review ¶
type Review struct { ReviewID int64 `json:"review_id,omitempty"` ProductReviewID int64 `json:"product_review_id,omitempty"` DisplayName string `json:"display_name"` EmailAddress string `json:"email_address,omitempty"` OrderID string `json:"order_id,omitempty"` Date string `json:"date"` ReviewDate string `json:"review_date,omitempty"` LastModified string `json:"last_modified,omitempty"` ProductID string `json:"product_id"` Product string `json:"product,omitempty"` Rating float64 `json:"rating"` Comments string `json:"comments"` Public int `json:"public,omitempty"` VisibleToPublic int `json:"visible_to_public,omitempty"` Heading string `json:"heading,omitempty"` Verified int `json:"verified,omitempty"` Response string `json:"response,omitempty"` Location string `json:"location"` CustCareOpen int `json:"custcareopen"` }
Review represents a single product review. Review represents a single product review.
type ReviewRequestOption ¶
type ReviewRequestOption func(*ReviewRequestParams)
ReviewRequestOption defines the type of the function that will set the options.
func WithAsArray ¶
func WithAsArray(asArray bool) ReviewRequestOption
func WithFrom ¶
func WithFrom(from time.Time) ReviewRequestOption
func WithLimit ¶
func WithLimit(limit int) ReviewRequestOption
func WithPage ¶
func WithPage(page int) ReviewRequestOption
func WithRemoved ¶
func WithRemoved(removed int) ReviewRequestOption
func WithSort ¶
func WithSort(sort string) ReviewRequestOption
func WithTo ¶
func WithTo(to time.Time) ReviewRequestOption
type ReviewRequestParams ¶
type ReviewRequestParams struct { // ProductID represents the product ID or parent ID you would like reviews for. ProductID string // AsArray, if true, will return the response as a JSON array as opposed to the standard JSON object. AsArray *bool // Limit specifies how many reviews you want returned in the response. Larger numbers may cause a timeout. Limit *int // Page indicates which page you would like to request. The offset will be calculated by limit * page. Starts at 0. Page *int // From represents the date you would like to start the query with. It should be given in YYYY-MM-DD format. Defaults to 30 days prior to the current day. From *time.Time // To represents the date you would like to end the query with. It should be given in YYYY-MM-DD format. Defaults to the current date. To *time.Time // Sort indicates how you would like to sort the reviews. Values are newest, oldest, highest, lowest. Sort *string // Removed, if set to 1, will include reviews that have a 'removed' value equal to 1 if the review was removed and 0 if the review is active. Removed *int }
ReviewRequestParams represents parameters for the API request to fetch product reviews.
func NewReviewRequestParams ¶
func NewReviewRequestParams(productId string, opts ...ReviewRequestOption) *ReviewRequestParams
NewReviewRequestParams initializes a new ReviewRequestParams with given options.
type ShopperApprovedClient ¶
ShopperApprovedClient represents a client to access ShopperApproved API.
func (*ShopperApprovedClient) FetchAggregateStatistics ¶
func (client *ShopperApprovedClient) FetchAggregateStatistics(params *AggregateRequestParams) (*ProductStatistics, error)
func (*ShopperApprovedClient) FetchAllProductReviews ¶
func (client *ShopperApprovedClient) FetchAllProductReviews(params *ReviewRequestParams) (map[string]Review, error)
func (*ShopperApprovedClient) FetchReviews ¶
func (client *ShopperApprovedClient) FetchReviews(params *ReviewRequestParams) (map[string]Review, error)