CalStorePageRequest Class Reference
Inherits from | NSObject |
---|---|
Declared in | CalStorePageRequest.h |
Overview
Requests a CalStorePage from the CalendarStore, using a block-based API.
- Create a request using one of the convenience constructors, either by itemId, URL or using a CalStorePageItemPage object.
- fetch the page using fetchPageWithCompletionHandler:
AuthorizationToken
If an authorization token is not manually supplied, it will be taken from
[CalStoreController sharedController]
.authorizationToken
or from
the CalendarStoreAuthorizationToken
key in your Info.plist.
Example
CalStorePageItemPage* item = ....;
CalStorePageRequest* request = [CalStorePageRequest requestWithPageItem:];
[request fetchPageWithCompletionHandler:^(CalStorePage* page, NSError* error){
if(error != nil)
{
doSomethingWithPage(page);
}
else
{
NSLog(@"Error fetching page: %@", error);
}
}];
Searching
To perform searches, use the CalStoreSearchRequest subclass, which conveniently also returns CalStorePage objects.
Requesting Information
itemId
The itemId, if available, for the page being requested.
@property (nonatomic, readonly) NSString *itemId
Declared In
CalStorePageRequest.h
url
The url for the page being requested.
@property (nonatomic, readonly) NSURL *url
Declared In
CalStorePageRequest.h
Authorization
authorizationToken
The AuthorizationToken being used for this request. Defaults to [
[CalStoreController sharedController]](../Classes/CalStoreController.html#//api/name/sharedController).authorizationToken
.
@property (nonatomic, strong) NSString *authorizationToken
See Also
Declared In
CalStorePageRequest.h
Fetching the Page
– fetchPageWithCompletionHandler:
Fetched the requested page asynchronously.
- (void)fetchPageWithCompletionHandler:(CalStorePageRequestCompletionHandler)completionHandler
Parameters
completionHandler |
block that will be invoked on the main queue if the fetch operation finishes. Check the error parameter of the block to see if the request succeeded. |
---|
Declared In
CalStorePageRequest.h
fetching
Yes iff the request is busy fetching the page
@property (nonatomic, getter=isFetching, readonly) BOOL fetching
Declared In
CalStorePageRequest.h
Canceling
Creating Requests
+ requestWithItemId:
Creates a request for a page by its itemId, locale and location are taken from [CalStoreController sharedController]
.
+ (instancetype)requestWithItemId:(NSString *)itemId
Parameters
itemId |
the itemId of the page to request. Cannot be nil. |
---|
Return Value
CalStorePageRequest that will request the page with the given itemId if valid, nil otherwise.
Discussion
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithItemId:locale:
Creates a request for a page by its itemId. Locale can be defined manually.
+ (instancetype)requestWithItemId:(NSString *)itemId locale:(NSString *)locale
Parameters
itemId |
the itemId of the page to request. Cannot be nil. |
---|---|
locale |
locale to get the page in, ISO 639-1 code, or en_US (style). Can be nil, in which case the CalStoreController’s locale will be used. |
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithUrl:
+ (instancetype)requestWithUrl:(NSURL *)url
Parameters
url |
the URL to request the page for. Cannot be nil. |
---|
Return Value
CalStorePageRequest that will request the page with the given url if valid, nil otherwise.
Discussion
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithStartPage
Creates a request for the start page of the CalendarStore.
+ (instancetype)requestWithStartPage
Return Value
CalStorePageRequest that will request the start page of the Calendar Store.
Discussion
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithStartPageWithLocale:location:
Creates a request for the start page of the CalendarStore with a specific locale and location.
+ (instancetype)requestWithStartPageWithLocale:(NSString *)locale location:(NSString *)location
Parameters
locale |
locale to get the start page in, ISO 639-1 code, or en_US (style). Can be nil, in which case the CalStoreController’s locale will be used. |
---|---|
location |
the location of the start page, ISO3166 code. Can be nil, in which case the CalStoreController’s location will be used. |
Return Value
CalStorePageRequest that will request the start page of the Calendar Store.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch). The location defines which content (e.g.for a specific country) the page contains.
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithPageItem:
Creates a request for a page that is refered to by a CalStorePageItemPage item.
+ (instancetype)requestWithPageItem:(CalStorePageItemPage *)itemPage
Parameters
itemPage |
the itemPage that refers to another CalStorePage for which a request should be created. Cannot be nil. |
---|
Return Value
CalStorePageRequest that will request the page refered to by the itemPage object, if valid. nil otherwise.
Declared In
CalStorePageRequest.h
Creating Requests for Top Items
+ requestWithNumberOfTopItems:
Creates a request for a page that has the top sold items. Locale and location will be taken from [CalStoreController sharedController]
.
+ (instancetype)requestWithNumberOfTopItems:(NSUInteger)numberOfTopItems
Parameters
numberOfTopItems |
the number of top items that should be returned |
---|
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithNumberOfTopItems:locale:location:
Creates a request for a page that has the top sold items. Locale and location can be defined manually.
+ (instancetype)requestWithNumberOfTopItems:(NSUInteger)numberOfTopItems locale:(NSString *)locale location:(NSString *)location
Parameters
numberOfTopItems |
the number of new items that should be returned |
---|---|
locale |
locale to get the page in, ISO 639-1 code, or en_US (style). Can be nil, in which case the CalStoreController’s locale will be used. |
location |
the location of the start page, ISO3166 code. Can be nil, in which case the CalStoreController’s location will be used. |
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
Creating Requests for New items
+ requestWithNumberOfNewItems:
Creates a request for a page that has the newly added items. Locale will be taken from [CalStoreController sharedController]
.
+ (instancetype)requestWithNumberOfNewItems:(NSUInteger)numberOfNewItems
Parameters
numberOfNewItems |
the number of new items that should be returned |
---|
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithNumberOfNewItems:locale:
Creates a request for a page that has the newly added items. Locale can be defined manually.
+ (instancetype)requestWithNumberOfNewItems:(NSUInteger)numberOfNewItems locale:(NSString *)locale
Parameters
numberOfNewItems |
the number of new items that should be returned |
---|---|
locale |
locale to get the page in, ISO 639-1 code, or en_US (style). Can be nil, in which case the CalStoreController’s locale will be used. |
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
Creating Requests for Upcoming items
+ requestWithNumberOfUpcomingItems:
Creates a request for a page that has the upcoming items. Locale will be taken from [CalStoreController sharedController]
.
+ (instancetype)requestWithNumberOfUpcomingItems:(NSUInteger)numberOfUpcomingItems
Parameters
numberOfUpcomingItems |
the number of upcoming items that should be returned |
---|
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h
+ requestWithNumberOfUpcomingItems:locale:
Creates a request for a page that has the upcoming items. Locale can be defined manually.
+ (instancetype)requestWithNumberOfUpcomingItems:(NSUInteger)numberOfUpcomingItems locale:(NSString *)locale
Parameters
numberOfUpcomingItems |
the number of upcoming items that should be returned |
---|---|
locale |
locale to get the page in, ISO 639-1 code, or en_US (style). Can be nil, in which case the CalStoreController’s locale will be used. |
Return Value
CalStorePageRequest that will request the page with the given parameters if valid, nil otherwise.
Discussion
The locale of a page defines how it is localized (e.g. in English, Spanish, Dutch).
Note: this only creates a request, use fetchPageWithCompletionHandler: to start requesting the page.
Declared In
CalStorePageRequest.h