BVMediaPost Class Reference
Inherits from | NSObject |
Declared in | BVMediaPost.h BVMediaPost.m |
Overview
BVMediaPost is used for all requests to the Bazaarvoice API which require a binary multipart post. This includes submitting photos and videos.
In the simplest case, a request might be created as follows:
BVMediaPost *photoSubmission = [[ BVMediaPost alloc ] initWithType:BVMediaPostTypePhoto ];
photoSubmission.contentType = BVMediaPostContentTypeReview;
mySubmission.userId = @“123”;
mySubmission.photo = <my_UIImage>;
[ mySubmission 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:
-
delegate
property -
requestURL
property -
contentType
property -
locale
property -
userId
property -
photo
property -
photoUrl
property -
– setVideo:withFormat:
-
– addGenericParameterWithName:value:
-
– getVideoExtensionString
-
– send
-
– sendRequestWithDelegate:
Properties
contentType
The content type for which this media is being submitted. Review, question, answer or story.
@property (assign, nonatomic) BVMediaPostContentType contentType
Declared In
BVMediaPost.h
delegate
The client delegate to receive BVDelegate notifications.
@property (weak) id<BVDelegate> delegate
Declared In
BVMediaPost.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.
@property (assign, nonatomic) NSString *locale
Declared In
BVMediaPost.h
photo
A UIImage to be submitted.
@property (assign, nonatomic) UIImage *photo
Declared In
BVMediaPost.h
photoUrl
URL of the photo to be uploaded. Use either the photo or photoUrl parameter to define the photo to upload. An error is returned if both parameters are defined. HTTP and HTTPS are the only protocols supported for the photoUrl parameter.
@property (assign, nonatomic) NSString *photoUrl
Declared In
BVMediaPost.h
Instance Methods
addGenericParameterWithName: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)addGenericParameterWithName:(id)name value:(id)value
Parameters
- name
of parameter.
- value
of parameter.
Declared In
BVMediaPost.h
getVideoExtensionString
Returns the string representation of the video file set by setVideo:withFormat:
- (NSString *)getVideoExtensionString
Declared In
BVMediaPost.h
initWithType:
Convenience initializer with type.
- (id)initWithType:(id)type
Parameters
- type
The particular type (BVMediaPostTypePhoto or BVMediaPostTypeVideo) of this request.
Declared In
BVMediaPost.h
send
Sends request asynchronously. A delegate must be set before this method is called.
- (void)send
Declared In
BVMediaPost.h
sendRequestWithDelegate:
- (void)sendRequestWithDelegate:(id)delegate
Parameters
- delegate
The client delegate to receive BVDelegate notifications.
Declared In
BVMediaPost.h
setVideo:withFormat:
A video file to be submitted.
- (void)setVideo:(id)video withFormat:(id)format
Parameters
- video
NSData representing a video file to be uploaded.
- format
Format of the video file to be uploaded. This file may be of any of the valid format types defined by BVVideoFormatType.
Declared In
BVMediaPost.h