Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
bffe25f3
Commit
bffe25f3
authored
Jul 26, 2016
by
Brent Gulanowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to get collection by handle.
parent
a353280d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
BUYClient+Storefront.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.h
+18
-0
BUYClient+Storefront.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.m
+15
-0
No files found.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.h
View file @
bffe25f3
...
...
@@ -78,6 +78,14 @@ typedef NS_ENUM(NSUInteger, BUYCollectionSort) {
typedef
void
(
^
BUYDataShopBlock
)(
BUYShop
*
_Nullable
shop
,
NSError
*
_Nullable
error
);
/**
* Return block containing a BUYCollection object and/or an NSError
*
* @param collection A BUYCollection object.
* @param error Optional NSError
*/
typedef
void
(
^
BUYDataCollectionBlock
)(
BUYCollection
*
_Nullable
collection
,
NSError
*
_Nullable
error
);
/**
* Return block containing a list of BUYCollection objects and/or an NSError
*
* @param collections An array of BUYCollection objects
...
...
@@ -191,6 +199,16 @@ typedef void (^BUYDataTagsListBlock)(NSArray <NSString *> * _Nullable tags, NSUI
-
(
NSOperation
*
)
getProductTagsPage
:(
NSUInteger
)
page
completion
:(
BUYDataTagsListBlock
)
block
;
/**
* Fetch a single collection by the handle of the collection.
*
* @param handle Collection handle
* @param block (^BUYDataCollectionBlock)(BUYCollection* _Nullable collection, NSError * _Nullable error)
*
* @return The associated operation.
*/
-
(
NSOperation
*
)
getCollectionByHandle
:(
NSString
*
)
handle
completion
:(
BUYDataCollectionBlock
)
block
;
/**
* Fetches collections based off page
*
* @param page Index of the page requested
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Storefront.m
View file @
bffe25f3
...
...
@@ -141,6 +141,21 @@ static NSString * const BUYCollectionsKey = @"collection_listings";
}];
}
-
(
NSOperation
*
)
getCollectionByHandle
:(
NSString
*
)
handle
completion
:(
BUYDataCollectionBlock
)
block
{
NSURL
*
url
=
[
self
urlForCollectionListingsWithParameters
:@{
@"handle"
:
handle
}];
return
[
self
getRequestForURL
:
url
completionHandler
:
^
(
NSDictionary
*
json
,
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
BUYCollection
*
collection
=
nil
;
if
(
json
&&
!
error
)
{
collection
=
[
self
.
modelManager
buy_objectWithEntityName
:[
BUYCollection
entityName
]
JSONDictionary
:
json
];
}
block
(
collection
,
error
);
}];
}
-
(
NSOperation
*
)
getCollectionsPage
:(
NSUInteger
)
page
completion
:(
BUYDataCollectionsListBlock
)
block
{
NSURL
*
url
=
[
self
urlForCollectionListingsWithParameters
:@{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment