BVGet Class Reference
Inherits from | NSObject |
Declared in | BVGet.h BVGet.m |
Overview
BVGet is used for all requests to the Bazaarvoice API which fetch, but do not modify data on the server. This includes fetching answers, authors, categories, comments, products, questions, reviews, statistics and stories.
In the simplest case, a request might be created as follows:
BVGet *getReviewsRequest = [[ BVGet alloc ] initWithType:BVGetTypeReviews ];
[ getReviewsRequest sendRequestWithDelegate:self ];
The specified delegate will then receive BVDelegate callbacks when a response is received. Note that it is the client’s responsibility to set the delegate to nil in the case that the the delegate is deallocated before a response is received.
Tasks
-
– initWithType:
-
type
property -
delegate
property -
requestURL
property -
search
property -
locale
property -
limit
property -
offset
property -
excludeFamily
property -
– addInclude:
-
– addAttribute:
-
– addSortForAttribute:ascending:
-
– addStatsOn:
-
– setSearchOnIncludedType:search:
-
– addSortOnIncludedType:attribute:ascending:
-
– setLimitOnIncludedType:value:
-
– setFilterForAttribute:equality:value:
-
– setFilterForAttribute:equality:values:
-
– setFilterOnIncludedType:forAttribute:equality:value:
-
– setFilterOnIncludedType:forAttribute:equality:values:
-
– setGenericParameterWithName:value:
-
– send
-
– sendRequestWithDelegate:
Properties
delegate
The client delegate to receive BVDelegate notifications.
@property (weak) id<BVDelegate> delegate
Declared In
BVGet.h
excludeFamily
Boolean flag indicating whether to exclude content (reviews, questions, etc.) from other products in the same family as the requested product. This setting only affects any nested content that is returned. For example, “&filter=productid:eq:1101&include=reviews&excludeFamily=true” limits returned review content to just that of product 1101 and not any of the products in the same family. If a value is not defined, content on all products in the family is returned.
@property (assign, nonatomic) bool excludeFamily
Declared In
BVGet.h
limit
Limits the maximum number of results that may be returned.
@property (assign, nonatomic) int limit
Declared In
BVGet.h
locale
Locale to display Labels, Configuration, Product Attributes and Category Attributes in. The default value is the locale defined in the display associated with the API key. If specified, the locale value is also used as the default ContentLocale filter value.
@property (assign, nonatomic) NSString *locale
Declared In
BVGet.h
offset
Changes the offset for returned results.
@property (assign, nonatomic) int offset
Declared In
BVGet.h
requestURL
The URL that this request was sent to. Is only available after the request has been sent.
@property (assign, nonatomic) NSString *requestURL
Declared In
BVGet.h
search
Search term to query. This is an “or” search. For example, when querying for products with the search term “Electric Dryer,” the result returns products that have both “Electric” and “Dryer” in the Product Name or Product Description.
@property (assign, nonatomic) NSString *search
Declared In
BVGet.h
Instance Methods
addAttribute:
Attributes to be included when returning content. For example, if includes are requested along with the &attributes=ModeratorCodes parameter, both the includes and the results will contain moderator codes. In order to filter by ModeratorCode, you must request the ModeratorCodes attribute parameter.
- (void)addAttribute:(id)attribute
Parameters
- attribute
Attribute to include.
Declared In
BVGet.h
addInclude:
Related subjects to be included (e.g. Products, Categories, Authors, Reviews…).
- (void)addInclude:(id)includeType
Parameters
- includeType
Type to include.
Declared In
BVGet.h
addSortForAttribute:ascending:
Sort criteria for primary content type of the query. Multi-attribute sorting for each content/subject type is supported.
- (void)addSortForAttribute:(id)attribute ascending:(id)ascending
Parameters
- attribute
The attribute upon which to sort. Rating, for example.
- ascending
Sort order - ascending if true, descending if false.
Declared In
BVGet.h
addSortOnIncludedType:attribute:ascending:
Sorting option for included content.
- (void)addSortOnIncludedType:(id)type attribute:(id)attribute ascending:(id)ascending
Parameters
- type
The included type for which the sort applies.
- attribute
The attribute upon which to sort. Rating, for example.
- ascending
Sort order - ascending if true, descending if false.
Declared In
BVGet.h
addStatsOn:
Adds statistics which should be calculated for the request.
- (void)addStatsOn:(id)type
Parameters
- type
The content types for which statistics should be calculated. Note: Statistics can also be calculated on includes.
Declared In
BVGet.h
initWithType:
Convenience initializer with type.
- (id)initWithType:(id)type
Parameters
- type
The particular type (BVGetTypeReviews, BVGetTypeQuestions…) of this request.
Declared In
BVGet.h
send
Sends request asynchronously. A delegate must be set before this method is called.
- (void)send
Declared In
BVGet.h
sendRequestWithDelegate:
- (void)sendRequestWithDelegate:(id)delegate
Parameters
- delegate
The client delegate to receive BVDelegate notifications.
Declared In
BVGet.h
setFilterForAttribute:equality:value:
Filter criteria for primary content of the query.
- (void)setFilterForAttribute:(id)attribute equality:(id)equality value:(id)value
Parameters
- attribute
The attribute upon which to sort. Rating, for example.
- equality
The equality filter to apply - (equal, greater than, less than…)
- value
The value to compare against. For example, this might be @“3045” when filtering on review id 3045.
Declared In
BVGet.h
setFilterForAttribute:equality:values:
Filter criteria for primary content of the query where multiple comparison values are required.
- (void)setFilterForAttribute:(id)attribute equality:(id)equality values:(id)values
Parameters
- attribute
The attribute upon which to sort. Rating, for example.
- equality
The equality filter to apply - (equal, greater than, less than…)
- values
Array of values to compare against. For example, this array might contain values @“3045”, @“3046” and @“3047” when filtering on review ids 3045, 3046 and 3047.
Declared In
BVGet.h
setFilterOnIncludedType:forAttribute:equality:value:
Filtering option for included content.
- (void)setFilterOnIncludedType:(id)type forAttribute:(id)attribute equality:(id)equality value:(id)value
Parameters
- type
The included type for which the filter applies.
- attribute
The attribute upon which to sort. Rating, for example.
- equality
The equality filter to apply - (equal, greater than, less than…)
- value
The value to compare against. For example, this might be @“3045” when filtering on review id 3045.
Declared In
BVGet.h
setFilterOnIncludedType:forAttribute:equality:values:
Filtering option for included content.
- (void)setFilterOnIncludedType:(id)type forAttribute:(id)attribute equality:(id)equality values:(id)values
Parameters
- type
The included type for which the filter applies.
- attribute
The attribute upon which to sort. Rating, for example.
- equality
The equality filter to apply - (equal, greater than, less than…)
- values
Array of values to compare against. For example, this array might contain values @“3045”, @“3046” and @“3047” when filtering on review ids 3045, 3046 and 3047.
Declared In
BVGet.h
setGenericParameterWithName:value:
Adds a generic parameter to the request. This method should be used as a last resort when another method does not exist for a particular request you would like to make. Behavior may be undefined.
- (void)setGenericParameterWithName:(id)name value:(id)value
Parameters
- name
of parameter.
- value
of parameter.
Declared In
BVGet.h
setLimitOnIncludedType:value:
Limit option for included content.
- (void)setLimitOnIncludedType:(id)type value:(id)value
Parameters
- value
The limit to apply. An error is returned if the value passed exceeds 20.
Declared In
BVGet.h
setSearchOnIncludedType:search:
Search query for included content. This is an “or” search and must include a type. For example, when querying included products with the search term “Electric Dryer,” the result returns products that have both “Electric” and “Dryer” in the Product Name or Product Description.
- (void)setSearchOnIncludedType:(id)type search:(id)search
Declared In
BVGet.h