FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
contentstack-ios/Contentstack/SyncStack.m at master · contentstack/contentstack-ios · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
contentstack
/
contentstack-ios
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
3
Code
Issues
0
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
contentstack-ios
/
Contentstack
/
SyncStack.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (60 loc) · 2.46 KB
Breadcrumbs
contentstack-ios
/
Contentstack
/
SyncStack.m
Copy path
File metadata and controls
64 lines (60 loc) · 2.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
//
SyncStack.m
//
ThirdPartyExtension
//
//
Created by Uttam Ukkoji on 02/07/18.
//
Copyright © 2018 Contentstack. All rights reserved.
//
#
import
"
SyncStack.h
"
#
import
"
CSIOInternalHeaders.h
"
@implementation
SyncStack
-(
instancetype
)
initWithParmas
:
(
NSDictionary
*)
parmas
{
self = [
super
init
];
if
(self) {
self.
params
= parmas;
if
([[
self
.params
objectForKey:
@"
sync_token
"
]
isKindOfClass:
[
NSString
class
]]) {
self.
syncToken
= [
self
.params
objectForKey:
@"
sync_token
"
];
}
self.
items
= [
NSArray
array
];
}
return
self;
}
-(
void
)
parseSyncResult
:
(
NSDictionary
*)
dictionary
{
if
(![dictionary
isKindOfClass:
[
NSNull
class
]]) {
self.
syncToken
=
nil
;
self.
paginationToken
=
nil
;
self.
hasMorePages
=
false
;
if
([dictionary
objectForKey:
@"
sync_token
"
]) {
self.
syncToken
= [dictionary
objectForKey:
@"
sync_token
"
];
}
if
([dictionary
objectForKey:
@"
pagination_token
"
]) {
self.
hasMorePages
=
true
;
self.
paginationToken
= [dictionary
objectForKey:
@"
pagination_token
"
];
}
if
([dictionary
objectForKey:
@"
total_count
"
]) {
self.
totalCount
= [[dictionary
objectForKey:
@"
total_count
"
]
unsignedIntValue
];
}
if
([dictionary
objectForKey:
@"
skip
"
] !=
nil
&& [[dictionary
objectForKey:
@"
skip
"
]
isKindOfClass:
[
NSNumber
class
]]){
self.
skip
= [[dictionary
objectForKey:
@"
skip
"
]
unsignedIntValue
];
}
if
([dictionary
objectForKey:
@"
limit
"
] !=
nil
&& [[dictionary
objectForKey:
@"
limit
"
]
isKindOfClass:
[
NSNumber
class
]]){
self.
limit
= [[dictionary
objectForKey:
@"
limit
"
]
unsignedIntValue
];
}
if
([dictionary
objectForKey:
@"
items
"
] && [[dictionary
objectForKey:
@"
items
"
]
isKindOfClass:
[
NSArray
class
]]) {
self.
items
= [dictionary
objectForKey:
@"
items
"
];
//
[[self.items mutableCopy] arrayByAddingObjectsFromArray:[dictionary objectForKey:@"items"]];
}
}
}
-(
NSDictionary
*)
getParameters
{
NSMutableDictionary
*syncParams = [
NSMutableDictionary
dictionary
];
if
(self.
syncToken
!=
nil
) {
[syncParams
setValue:
self
.syncToken
forKey:
@"
sync_token
"
];
}
else
if
(self.
paginationToken
!=
nil
) {
[syncParams
setValue:
self
.paginationToken
forKey:
@"
pagination_token
"
];
}
else
{
syncParams = [
NSMutableDictionary
dictionaryWithDictionary:
self
.params];
[syncParams
setValue:
@"
true
"
forKey:
@"
init
"
];
}
return
syncParams;
}
@end
Back
|
FazBrowse Home
|
New Git URL