Compare commits
292 Commits
1.4
...
2.0-appsto
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d35434705c | ||
|
|
512f6faf84 | ||
|
|
82195ee090 | ||
|
|
eb2e070fe3 | ||
|
|
14311dfe66 | ||
|
|
10838aad00 | ||
|
|
d340278ec5 | ||
|
|
2eb074be87 | ||
|
|
b84c9b79c8 | ||
|
|
c367d5e6cb | ||
|
|
f8973d6c52 | ||
|
|
beaf4e67e7 | ||
|
|
06a150792d | ||
|
|
9816e783e7 | ||
|
|
8b26c301cf | ||
|
|
6ddd608a3f | ||
|
|
f1a72d8160 | ||
|
|
6d4d57441b | ||
|
|
971538d6b5 | ||
|
|
34d8dc375f | ||
|
|
f294a8c9f5 | ||
|
|
2bd4d57869 | ||
|
|
c7344dbb0c | ||
|
|
97809a1bc7 | ||
|
|
5056f9e2e4 | ||
|
|
150304941c | ||
|
|
ff36f6ce87 | ||
|
|
6422084fa0 | ||
|
|
651a398798 | ||
|
|
31b667c7f7 | ||
|
|
10affd615c | ||
|
|
126c962a98 | ||
|
|
2d6a298095 | ||
|
|
cc086e2dff | ||
|
|
c5fc87b7b5 | ||
|
|
1433c0851e | ||
|
|
c60780a197 | ||
|
|
bb48771989 | ||
|
|
5466e48629 | ||
|
|
d4969a776a | ||
|
|
bb81f5bd5b | ||
|
|
c38920f238 | ||
|
|
be0ae7ff45 | ||
|
|
6808016ab7 | ||
|
|
d3c2698790 | ||
|
|
d1cc9481c3 | ||
|
|
cced75cdfe | ||
|
|
b74bc79699 | ||
|
|
585268eb0f | ||
|
|
a713a639cd | ||
|
|
113c3790fb | ||
|
|
d732b03828 | ||
|
|
cf9dabcc82 | ||
|
|
2bc357cee6 | ||
|
|
c4dca14800 | ||
|
|
d8e2707ac0 | ||
|
|
25df56f90a | ||
|
|
2006e382d4 | ||
|
|
98bffa3755 | ||
|
|
789aa26066 | ||
|
|
773058da78 | ||
|
|
339ef8d1bc | ||
|
|
db55634ab2 | ||
|
|
c3364bbbef | ||
|
|
74e8001506 | ||
|
|
c1c15ddb89 | ||
|
|
c8eb2fdde7 | ||
|
|
da7abf1030 | ||
|
|
8250e9b2c4 | ||
|
|
e97d6bded4 | ||
|
|
8805a411ba | ||
|
|
a1ca633aaf | ||
|
|
78d5fc0904 | ||
|
|
d9e251c2cd | ||
|
|
fe2b6024bc | ||
|
|
1be65c0969 | ||
|
|
557eb95c7e | ||
|
|
9941dba008 | ||
|
|
fa57b8817b | ||
|
|
943c378206 | ||
|
|
b53de7a648 | ||
|
|
09afe61a4c | ||
|
|
7e96496614 | ||
|
|
d43c19a749 | ||
|
|
989cafda71 | ||
|
|
e165c6941d | ||
|
|
9105055ff4 | ||
|
|
6345899783 | ||
|
|
b1daeaf8ed | ||
|
|
9fee4a2bbe | ||
|
|
fc82790b8c | ||
|
|
d95e5ec263 | ||
|
|
99456a35ab | ||
|
|
b4e052fc9d | ||
|
|
d3852dc78c | ||
|
|
f41b7813f9 | ||
|
|
6df4a13d93 | ||
|
|
aa461b73c8 | ||
|
|
e070082f4a | ||
|
|
079434d62b | ||
|
|
f57de77545 | ||
|
|
18657271ba | ||
|
|
11d1dc711d | ||
|
|
965d5efe7f | ||
|
|
87b01fcaaf | ||
|
|
b2624c7572 | ||
|
|
bd37f1d6a7 | ||
|
|
f475c15360 | ||
|
|
d3d4aeea41 | ||
|
|
5913ce80e5 | ||
|
|
4c8bed2826 | ||
|
|
d036b43d6f | ||
|
|
318aca4d8f | ||
|
|
060c9f91f3 | ||
|
|
4184f609d6 | ||
|
|
658d710847 | ||
|
|
3fa9843855 | ||
|
|
de3f51b447 | ||
|
|
43c32e0f4c | ||
|
|
775a6fd4ea | ||
|
|
4f594c8c1d | ||
|
|
ebadac8cd8 | ||
|
|
c48bed5ebd | ||
|
|
4f3efde6f0 | ||
|
|
5b4e86a90a | ||
|
|
2be83752db | ||
|
|
bd1a0f4e25 | ||
|
|
70cd397591 | ||
|
|
1120529e34 | ||
|
|
f57415a08b | ||
|
|
f9da568bfd | ||
|
|
39c9f8c5a0 | ||
|
|
a645e22973 | ||
|
|
eaf86d3348 | ||
|
|
2565321a4a | ||
|
|
ec828a82fd | ||
|
|
411aa41226 | ||
|
|
00b164058d | ||
|
|
9808613c75 | ||
|
|
1d20d81652 | ||
|
|
f5c66ff35a | ||
|
|
4c3d3234f5 | ||
|
|
d543173b18 | ||
|
|
d8578e0162 | ||
|
|
d665833eba | ||
|
|
33e25a5fed | ||
|
|
c0737de939 | ||
|
|
a18679eba8 | ||
|
|
ce321aeceb | ||
|
|
6074547f64 | ||
|
|
8432932cb7 | ||
|
|
f8dccc04d7 | ||
|
|
b38ef59c93 | ||
|
|
c1162c76d3 | ||
|
|
231426d5b3 | ||
|
|
783eb95438 | ||
|
|
7bdc3e153d | ||
|
|
28460d4576 | ||
|
|
396f6fa7bd | ||
|
|
e39eafee7f | ||
|
|
f1549fe922 | ||
|
|
b16c539607 | ||
|
|
b11b33da5f | ||
|
|
6e9cd5a1f5 | ||
|
|
b67132671a | ||
|
|
14e34e8e7a | ||
|
|
16f5ab29fa | ||
|
|
2af717fe5e | ||
|
|
c5be6bd742 | ||
|
|
693eddb578 | ||
|
|
46e5bc2cbf | ||
|
|
f11afaaa45 | ||
|
|
cf64ce96f2 | ||
|
|
b1eae1b06a | ||
|
|
d19af3aba8 | ||
|
|
ece5341e27 | ||
|
|
7f9aaf4642 | ||
|
|
d59c3690d4 | ||
|
|
37070e482d | ||
|
|
7fd322a5c6 | ||
|
|
07dd98823f | ||
|
|
40d6019f71 | ||
|
|
32ec0038b6 | ||
|
|
99a1d505d3 | ||
|
|
62076d8170 | ||
|
|
009b1ff996 | ||
|
|
27870c7420 | ||
|
|
7a16b47e37 | ||
|
|
48324735e1 | ||
|
|
f0dcc4c34c | ||
|
|
36386c3213 | ||
|
|
8ea0f00cf0 | ||
|
|
0921796136 | ||
|
|
ab360066e5 | ||
|
|
34645c9433 | ||
|
|
b2a608824c | ||
|
|
af56920fd9 | ||
|
|
784b741b60 | ||
|
|
ea066bd828 | ||
|
|
c5d88bd5c7 | ||
|
|
a8115fdced | ||
|
|
c0406888fc | ||
|
|
c7f04f8449 | ||
|
|
ae4be86ecf | ||
|
|
d188985823 | ||
|
|
ac0d412123 | ||
|
|
19e35dbccd | ||
|
|
3086baf523 | ||
|
|
e3d8d3c31c | ||
|
|
7589b3a048 | ||
|
|
72f0d69a71 | ||
|
|
2399156ee4 | ||
|
|
3d3f08da9b | ||
|
|
2a0abf0da7 | ||
|
|
2d8146edbd | ||
|
|
dad198f5e1 | ||
|
|
0a5329fe17 | ||
|
|
64d9f09cf6 | ||
|
|
d583d12099 | ||
|
|
17bb5706f8 | ||
|
|
d583bdfd3c | ||
|
|
9eb9667163 | ||
|
|
a315a9dfc3 | ||
|
|
8375808cdc | ||
|
|
77439af486 | ||
|
|
76f4a00738 | ||
|
|
9d615b2d4c | ||
|
|
aaffc0297e | ||
|
|
5dc5885582 | ||
|
|
7389f5bf45 | ||
|
|
b06d461a36 | ||
|
|
802f57878b | ||
|
|
bccf35d057 | ||
|
|
137a1c531c | ||
|
|
e96df9f990 | ||
|
|
691670cc43 | ||
|
|
bd64bfec67 | ||
|
|
0813fb40d0 | ||
|
|
3cb8215d5a | ||
|
|
a7fe11e8db | ||
|
|
4a9fc66b5a | ||
|
|
fb81cd61a9 | ||
|
|
13034b4184 | ||
|
|
b2345da9f3 | ||
|
|
08d3d9ad30 | ||
|
|
797060f609 | ||
|
|
ea09116929 | ||
|
|
86758b498c | ||
|
|
9115b56a42 | ||
|
|
c400868026 | ||
|
|
b4dbb15853 | ||
|
|
195f70db53 | ||
|
|
f3248f446c | ||
|
|
80cb2c8a4f | ||
|
|
35a600080b | ||
|
|
af1efe7bc6 | ||
|
|
8219ef10f5 | ||
|
|
35411c3261 | ||
|
|
e8bab69ed7 | ||
|
|
9904fb2d57 | ||
|
|
d7f369350b | ||
|
|
0df322f648 | ||
|
|
cb860cec96 | ||
|
|
14c0b2dd27 | ||
|
|
a2521483c2 | ||
|
|
fa4b2a9e54 | ||
|
|
e3963a72ad | ||
|
|
cefe8d144d | ||
|
|
076cfb1257 | ||
|
|
71e3f44c8c | ||
|
|
c36f34346d | ||
|
|
cd6b83ffe8 | ||
|
|
d110fd18c1 | ||
|
|
e45b9985c2 | ||
|
|
8f4eb6df84 | ||
|
|
809bd60169 | ||
|
|
802c5949da | ||
|
|
407c5528ee | ||
|
|
fed3a2bc10 | ||
|
|
7329353c6c | ||
|
|
a7c861d1b0 | ||
|
|
9af8ab3360 | ||
|
|
ddb5328019 | ||
|
|
96d97d95e1 | ||
|
|
ab15694d9a | ||
|
|
81312e3ff4 | ||
|
|
5e1e88bdeb | ||
|
|
9882bf408c | ||
|
|
40f34f3d77 | ||
|
|
0ee1e176ed | ||
|
|
c73f89e4a1 | ||
|
|
fe9a1cdbc4 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -27,3 +27,9 @@ Press/MasterPassword_PressKit/MasterPassword_pressrelease_*.pdf
|
||||
|
||||
# Java
|
||||
MasterPassword/Java/**/target
|
||||
|
||||
# C
|
||||
MasterPassword/C/*.o
|
||||
MasterPassword/C/mpw
|
||||
MasterPassword/C/lib/*/*
|
||||
!MasterPassword/C/lib/*/.source
|
||||
|
||||
13
.gitmodules
vendored
13
.gitmodules
vendored
@@ -3,13 +3,10 @@
|
||||
url = git://github.com/Lyndir/Pearl.git
|
||||
[submodule "External/InAppSettingsKit"]
|
||||
path = External/InAppSettingsKit
|
||||
url = git://github.com/futuretap/InAppSettingsKit.git
|
||||
[submodule "External/FontReplacer"]
|
||||
path = External/FontReplacer
|
||||
url = git://github.com/0xced/FontReplacer.git
|
||||
[submodule "Press"]
|
||||
path = Press
|
||||
url = ../Press
|
||||
url = git://github.com/lhunath/InAppSettingsKit.git
|
||||
[submodule "External/UbiquityStoreManager"]
|
||||
path = External/UbiquityStoreManager
|
||||
url = git@github.com:lhunath/UbiquityStoreManager.git
|
||||
url = git://github.com/lhunath/UbiquityStoreManager.git
|
||||
[submodule "External/RHStatusItemView"]
|
||||
path = External/RHStatusItemView
|
||||
url = git://github.com/lhunath/RHStatusItemView.git
|
||||
|
||||
2
.idea/inspectionProfiles/Project_Default.xml
generated
2
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -9,6 +9,8 @@
|
||||
<inspection_tool class="OCNotLocalizedStringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedMacroInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SignednessMismatch" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnavailableInDeploymentTarget" enabled="true" level="INFO" enabled_by_default="true" />
|
||||
<inspection_tool class="UnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnusedParameter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
|
||||
7
.travis.yml
Normal file
7
.travis.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
language: objective-c
|
||||
xcode_workspace: MasterPassword.xcworkspace
|
||||
xcode_scheme: MasterPassword iOS (Development)
|
||||
xcode_sdk: iphonesimulator
|
||||
git:
|
||||
submodules: false
|
||||
before_install: ./Scripts/updateDependencies
|
||||
Binary file not shown.
BIN
External/Crashlytics.framework/run
vendored
BIN
External/Crashlytics.framework/run
vendored
Binary file not shown.
1
External/FontReplacer
vendored
1
External/FontReplacer
vendored
Submodule External/FontReplacer deleted from 4e3dea0870
2
External/InAppSettingsKit
vendored
2
External/InAppSettingsKit
vendored
Submodule External/InAppSettingsKit updated: 3ad8735776...fcc72db0d5
21
External/Localytics/LICENSE
vendored
21
External/Localytics/LICENSE
vendored
@@ -1,21 +0,0 @@
|
||||
Copyright (c) 2009, Char Software, Inc. d/b/a Localytics
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Neither the name of Char Software, Inc., Localytics nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY CHAR SOFTWARE, INC. D/B/A LOCALYTICS ''AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL CHAR SOFTWARE, INC. D/B/A LOCALYTICS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
74
External/Localytics/LocalyticsDatabase.h
vendored
74
External/Localytics/LocalyticsDatabase.h
vendored
@@ -1,74 +0,0 @@
|
||||
//
|
||||
// LocalyticsDatabase.h
|
||||
// Copyright (C) 2013 Char Software Inc., DBA Localytics
|
||||
//
|
||||
// This code is provided under the Localytics Modified BSD License.
|
||||
// A copy of this license has been distributed in a file called LICENSE
|
||||
// with this source code.
|
||||
//
|
||||
// Please visit www.localytics.com for more information.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <sqlite3.h>
|
||||
|
||||
#define MAX_DATABASE_SIZE 500000 // The maximum allowed disk size of the primary database file at open, in bytes
|
||||
#define VACUUM_THRESHOLD 0.8 // The database is vacuumed after its size exceeds this proportion of the maximum.
|
||||
|
||||
@interface LocalyticsDatabase : NSObject {
|
||||
sqlite3 *_databaseConnection;
|
||||
}
|
||||
|
||||
- (unsigned long long)databaseSize;
|
||||
- (int)eventCount;
|
||||
- (NSTimeInterval)createdTimestamp;
|
||||
|
||||
- (BOOL)beginTransaction:(NSString *)name;
|
||||
- (BOOL)releaseTransaction:(NSString *)name;
|
||||
- (BOOL)rollbackTransaction:(NSString *)name;
|
||||
|
||||
- (BOOL)incrementLastUploadNumber:(int *)uploadNumber;
|
||||
- (BOOL)incrementLastSessionNumber:(int *)sessionNumber;
|
||||
|
||||
- (BOOL)addEventWithBlobString:(NSString *)blob;
|
||||
- (BOOL)addCloseEventWithBlobString:(NSString *)blob;
|
||||
- (BOOL)queueCloseEventWithBlobString:(NSString *)blob;
|
||||
- (NSString *)dequeueCloseEventBlobString;
|
||||
- (BOOL)addFlowEventWithBlobString:(NSString *)blob;
|
||||
- (BOOL)removeLastCloseAndFlowEvents;
|
||||
|
||||
- (BOOL)addHeaderWithSequenceNumber:(int)number blobString:(NSString *)blob rowId:(sqlite3_int64 *)insertedRowId;
|
||||
- (int)unstagedEventCount;
|
||||
- (BOOL)stageEventsForUpload:(sqlite3_int64)headerId;
|
||||
- (BOOL)updateAppKey:(NSString *)appKey;
|
||||
- (NSString *)uploadBlobString;
|
||||
- (BOOL)deleteUploadedData;
|
||||
- (BOOL)resetAnalyticsData;
|
||||
- (BOOL)vacuumIfRequired;
|
||||
|
||||
- (NSTimeInterval)lastSessionStartTimestamp;
|
||||
- (BOOL)setLastSessionStartTimestamp:(NSTimeInterval)timestamp;
|
||||
|
||||
- (BOOL)isOptedOut;
|
||||
- (BOOL)setOptedOut:(BOOL)optOut;
|
||||
- (NSString *)installId;
|
||||
- (NSString *)appKey; // Most recent app key-- may not be that used to open the session.
|
||||
|
||||
- (NSString *)customDimension:(int)dimension;
|
||||
- (BOOL)setCustomDimension:(int)dimension value:(NSString *)value;
|
||||
|
||||
- (BOOL)setValueForIdentifier:(NSString *)identifierName value:(NSString *)value;
|
||||
- (NSString *)valueForIdentifier:(NSString *)identifierName;
|
||||
- (BOOL)deleteIdentifer:(NSString *)identifierName;
|
||||
- (NSDictionary *)identifiers;
|
||||
|
||||
- (BOOL)setFacebookAttribution:(NSString *)fbAttribution;
|
||||
- (NSString *)facebookAttributionFromDb;
|
||||
- (NSString *)facebookAttributionFromPasteboard;
|
||||
|
||||
- (NSInteger)safeIntegerValueFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
|
||||
- (NSString *)safeStringValueFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
|
||||
- (NSDictionary *)safeDictionaryFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
|
||||
- (NSArray *)safeListFromDictionary:(NSDictionary *)dict forKey:(NSString *)key;
|
||||
|
||||
|
||||
@end
|
||||
1357
External/Localytics/LocalyticsDatabase.m
vendored
1357
External/Localytics/LocalyticsDatabase.m
vendored
File diff suppressed because it is too large
Load Diff
104
External/Localytics/LocalyticsSession+Private.h
vendored
104
External/Localytics/LocalyticsSession+Private.h
vendored
@@ -1,104 +0,0 @@
|
||||
// LocalyticsSession+Private.h
|
||||
// Copyright (C) 2013 Char Software Inc., DBA Localytics
|
||||
//
|
||||
// This code is provided under the Localytics Modified BSD License.
|
||||
// A copy of this license has been distributed in a file called LICENSE
|
||||
// with this source code.
|
||||
//
|
||||
// Please visit www.localytics.com for more information.
|
||||
|
||||
#import "LocalyticsSession.h"
|
||||
#import "LocalyticsUploader.h"
|
||||
#import "LocalyticsDatabase.h"
|
||||
|
||||
#define CLIENT_VERSION_PREFIX @"iOS"
|
||||
#define LOCALYTICS_LOGGING_ENABLED [[LocalyticsSession shared] loggingEnabled]
|
||||
#define LocalyticsLog(message, ...)if([[LocalyticsSession shared] loggingEnabled]) \
|
||||
[LocalyticsSession logMessage:[NSString stringWithFormat:@"%s:\n + " message "\n\n", __PRETTY_FUNCTION__, ##__VA_ARGS__]]
|
||||
|
||||
@interface LocalyticsSession()
|
||||
{
|
||||
BOOL _hasInitialized; // Whether or not the session object has been initialized.
|
||||
BOOL _isSessionOpen; // Whether or not this session has been opened.
|
||||
float _sessionTimeoutInterval; // If an App stays in the background for more
|
||||
// than this many seconds, start a new session
|
||||
// when it returns to foreground.
|
||||
@private
|
||||
#pragma mark Member Variables
|
||||
dispatch_queue_t _queue; // Queue of Localytics block objects.
|
||||
dispatch_group_t _criticalGroup; // Group of blocks the must complete before backgrounding.
|
||||
NSString *_sessionUUID; // Unique identifier for this session.
|
||||
NSString *_applicationKey; // Unique identifier for the instrumented application
|
||||
NSString *_facebookAttribution; // Facebook attribution cookie
|
||||
NSTimeInterval _lastSessionStartTimestamp; // The start time of the most recent session.
|
||||
NSDate *_sessionResumeTime; // Time session was started or resumed.
|
||||
NSDate *_sessionCloseTime; // Time session was closed.
|
||||
NSMutableString *_unstagedFlowEvents; // Comma-delimited list of app screens and events tagged during this
|
||||
// session that have NOT been staged for upload.
|
||||
NSMutableString *_stagedFlowEvents; // App screens and events tagged during this session that HAVE been staged
|
||||
// for upload.
|
||||
NSMutableString *_screens; // Comma-delimited list of screens tagged during this session.
|
||||
NSTimeInterval _sessionActiveDuration; // Duration that session open.
|
||||
BOOL _sessionHasBeenOpen; // Whether or not this session has ever been open.
|
||||
BOOL _delaySession; // Whether or not the server should delay processing on this upload
|
||||
LocalyticsDatabase *_db; // Localytics database reference
|
||||
LocalyticsUploader *_uploader; // Localytics uploader reference
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSString *applicationKey;
|
||||
@property (nonatomic, retain) NSString *facebookAttribution;
|
||||
@property (nonatomic,readonly) dispatch_queue_t queue;
|
||||
@property (nonatomic,readonly) dispatch_group_t criticalGroup;
|
||||
@property (atomic) BOOL isSessionOpen;
|
||||
@property (atomic) BOOL hasInitialized;
|
||||
@property (nonatomic, retain) NSString *sessionUUID;
|
||||
@property (nonatomic, assign) NSTimeInterval lastSessionStartTimestamp;
|
||||
@property (nonatomic, retain) NSDate *sessionResumeTime;
|
||||
@property (nonatomic, retain) NSDate *sessionCloseTime;
|
||||
@property (nonatomic, retain) NSMutableString *unstagedFlowEvents;
|
||||
@property (nonatomic, retain) NSMutableString *stagedFlowEvents;
|
||||
@property (nonatomic, retain) NSMutableString *screens;
|
||||
@property (nonatomic, assign) NSTimeInterval sessionActiveDuration;
|
||||
@property (nonatomic, assign) BOOL sessionHasBeenOpen;
|
||||
@property (nonatomic, assign) BOOL delaySession;
|
||||
@property (nonatomic, assign) NSInteger sessionNumber;
|
||||
|
||||
// Private methods.
|
||||
+ (id)allocFactory;
|
||||
- (void)reopenPreviousSession;
|
||||
- (void)addFlowEventWithName:(NSString *)name type:(NSString *)eventType;
|
||||
- (void)addScreenWithName:(NSString *)name;
|
||||
- (NSString *)blobHeaderStringWithSequenceNumber:(int)nextSequenceNumber;
|
||||
- (BOOL)ll_isOptedIn;
|
||||
- (BOOL)createOptEvent:(BOOL)optState;
|
||||
- (BOOL)saveApplicationFlowAndRemoveOnResume:(BOOL)removeOnResume;
|
||||
- (NSString *)formatAttributeWithName:(NSString *)paramName value:(NSString *)paramValue;
|
||||
- (NSString *)formatAttributeWithName:(NSString *)paramName value:(NSString *)paramValue first:(BOOL)firstAttribute;
|
||||
- (void)uploadCallback:(NSDictionary*)info;
|
||||
+ (BOOL)appKeyIsValid:(NSString *)appKey;
|
||||
- (void)ll_open;
|
||||
- (LocalyticsDatabase *)db;
|
||||
- (LocalyticsUploader *)uploader;
|
||||
- (BOOL)uploadIsNeeded;
|
||||
|
||||
|
||||
// Datapoint methods.
|
||||
- (NSString *)customDimensions;
|
||||
- (NSString *)locationDimensions;
|
||||
- (NSString *)hashString:(NSString *)input;
|
||||
- (NSString *)randomUUID;
|
||||
- (NSString *)escapeString:(NSString *)input;
|
||||
- (NSString *)installationId;
|
||||
- (NSString *)appVersion;
|
||||
- (NSTimeInterval)currentTimestamp;
|
||||
- (BOOL)isDeviceJailbroken;
|
||||
- (NSString *)deviceModel;
|
||||
- (NSString *)modelSizeString;
|
||||
- (double)availableMemory;
|
||||
- (NSString *)advertisingIdentifier;
|
||||
- (NSString *)uniqueDeviceIdentifier;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
303
External/Localytics/LocalyticsSession.h
vendored
303
External/Localytics/LocalyticsSession.h
vendored
@@ -1,303 +0,0 @@
|
||||
// LocalyticsSession.h
|
||||
// Copyright (C) 2013 Char Software Inc., DBA Localytics
|
||||
//
|
||||
// This code is provided under the Localytics Modified BSD License.
|
||||
// A copy of this license has been distributed in a file called LICENSE
|
||||
// with this source code.
|
||||
//
|
||||
// Please visit www.localytics.com for more information.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
#define CLIENT_VERSION @"2.17.3"
|
||||
#define MARKETING_PLATFORM
|
||||
|
||||
/*!
|
||||
@class LocalyticsSession
|
||||
@discussion The class which manages creating, collecting, & uploading a Localytics session.
|
||||
Please see the following guides for information on how to best use this
|
||||
library, sample code, and other useful information:
|
||||
<ul>
|
||||
<li><a href="http://wiki.localytics.com/index.php?title=Developer's_Integration_Guide">
|
||||
Main Developer's Integration Guide</a></li>
|
||||
</ul>
|
||||
|
||||
<strong>Best Practices</strong>
|
||||
<ul>
|
||||
<li>Instantiate the LocalyticsSession object in applicationDidFinishLaunching.</li>
|
||||
<li>Open your session and begin your uploads in applicationDidFinishLaunching. This way the
|
||||
upload has time to complete and it all happens before your users have a
|
||||
chance to begin any data intensive actions of their own.</li>
|
||||
<li>Close the session in applicationWillTerminate, and in applicationDidEnterBackground.</li>
|
||||
<li>Resume the session in applicationWillEnterForeground.</li>
|
||||
<li>Do not call any Localytics functions inside a loop. Instead, calls
|
||||
such as <code>tagEvent</code> should follow user actions. This limits the
|
||||
amount of data which is stored and uploaded.</li>
|
||||
<li>Do not use multiple LocalticsSession objects to upload data with
|
||||
multiple application keys. This can cause invalid state.</li>
|
||||
</ul>
|
||||
|
||||
@author Localytics
|
||||
*/
|
||||
|
||||
// Forward declaration
|
||||
@protocol LocalyticsSessionDelegate;
|
||||
|
||||
@interface LocalyticsSession : NSObject
|
||||
|
||||
|
||||
+ (void)logMessage:(NSString *)message;
|
||||
|
||||
/*!
|
||||
@property enableHTTPS
|
||||
@abstract (Optional) Determines whether or not HTTPS is used when calling the Localytics
|
||||
post URL. The default is NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL enableHTTPS;
|
||||
|
||||
/*!
|
||||
@property loggingEnabled
|
||||
@abstract (Optional) Determines whether or Localytics debugging information is shown
|
||||
to the console. The default is NO
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL loggingEnabled;
|
||||
|
||||
/*!
|
||||
@property sessionTimeoutInterval
|
||||
@abstrac (Optional) If an App stays in the background for more than this many seconds,
|
||||
start a new session when it returns to foreground.
|
||||
*/
|
||||
@property (atomic) float sessionTimeoutInterval;
|
||||
|
||||
/*!
|
||||
@property localyticsDelegate
|
||||
@abstract (Optional) Assign this delegate to the class you'd like to register to recieve
|
||||
the Localytics delegate callbacks (Defined at the end of this file)
|
||||
*/
|
||||
@property (nonatomic, assign) id<LocalyticsSessionDelegate> localyticsDelegate;
|
||||
|
||||
#pragma mark Public Methods
|
||||
/*!
|
||||
@method shared
|
||||
@abstract Accesses the Session object. This is a Singleton class which maintains
|
||||
a single session throughout your application. It is possible to manage your own
|
||||
session, but this is the easiest way to access the Localytics object throughout your code.
|
||||
The class is accessed within the code using the following syntax:
|
||||
[[LocalyticsSession shared] functionHere]
|
||||
So, to tag an event, all that is necessary, anywhere in the code is:
|
||||
[[LocalyticsSession shared] tagEvent:@"MY_EVENT"];
|
||||
*/
|
||||
+ (LocalyticsSession *)sharedLocalyticsSession;
|
||||
+ (LocalyticsSession *)shared;
|
||||
|
||||
|
||||
/*!
|
||||
@method startSession
|
||||
@abstract An optional convenience initialize method that also calls the LocalyticsSession, open &
|
||||
upload methods. Best Practice is to call open & upload immediately after Localytics Session when loading an app,
|
||||
this method fascilitates that behavior.
|
||||
It is recommended that this call be placed in <code>applicationDidFinishLaunching</code>.
|
||||
@param applicationKey The key unique for each application generated
|
||||
at www.localytics.com
|
||||
*/
|
||||
- (void)startSession:(NSString *)appKey;
|
||||
|
||||
/*!
|
||||
@method open
|
||||
@abstract Opens the Localytics session. Not necessary if you choose to use startSession.
|
||||
The session time as presented on the website is the time between <code>open</code> and the
|
||||
final <code>close</code> so it is recommended to open the session as early as possible, and close
|
||||
it at the last moment. The session must be opened before any tags can
|
||||
be written. It is recommended that this call be placed in <code>applicationDidFinishLaunching</code>.
|
||||
<br>
|
||||
If for any reason this is called more than once every subsequent open call
|
||||
will be ignored.
|
||||
*/
|
||||
- (void)open;
|
||||
|
||||
/*!
|
||||
@method resume
|
||||
@abstract Resumes the Localytics session. When the App enters the background, the session is
|
||||
closed and the time of closing is recorded. When the app returns to the foreground, the session
|
||||
is resumed. If the time since closing is greater than BACKGROUND_SESSION_TIMEOUT, (15 seconds
|
||||
by default) a new session is created, and uploading is triggered. Otherwise, the previous session
|
||||
is reopened.
|
||||
*/
|
||||
- (void)resume;
|
||||
|
||||
/*!
|
||||
@method close
|
||||
@abstract Closes the Localytics session. This should be called in
|
||||
<code>applicationWillTerminate</code>.
|
||||
<br>
|
||||
If close is not called, the session will still be uploaded but no
|
||||
events will be processed and the session time will not appear. This is
|
||||
because the session is not yet closed so it should not be used in
|
||||
comparison with sessions which are closed.
|
||||
*/
|
||||
- (void)close;
|
||||
|
||||
/*!
|
||||
@method tagEvent
|
||||
@abstract Allows a session to tag a particular event as having occurred. For
|
||||
example, if a view has three buttons, it might make sense to tag
|
||||
each button click with the name of the button which was clicked.
|
||||
For another example, in a game with many levels it might be valuable
|
||||
to create a new tag every time the user gets to a new level in order
|
||||
to determine how far the average user is progressing in the game.
|
||||
<br>
|
||||
<strong>Tagging Best Practices</strong>
|
||||
<ul>
|
||||
<li>DO NOT use tags to record personally identifiable information.</li>
|
||||
<li>The best way to use tags is to create all the tag strings as predefined
|
||||
constants and only use those. This is more efficient and removes the risk of
|
||||
collecting personal information.</li>
|
||||
<li>Do not set tags inside loops or any other place which gets called
|
||||
frequently. This can cause a lot of data to be stored and uploaded.</li>
|
||||
</ul>
|
||||
<br>
|
||||
See the tagging guide at: http://wiki.localytics.com/
|
||||
@param event The name of the event which occurred.
|
||||
@param attributes (Optional) An object/hash/dictionary of key-value pairs, contains
|
||||
contextual data specific to the event.
|
||||
@param rerportAttributes (Optional) Additional attributes used for custom reporting.
|
||||
Available to Enterprise customers, please contact services for more details.
|
||||
@param customerValueIncrease (Optional) Numeric value, added to customer lifetime value.
|
||||
Integer expected. Try to use lowest possible unit, such as cents for US currency.
|
||||
*/
|
||||
- (void)tagEvent:(NSString *)event;
|
||||
|
||||
- (void)tagEvent:(NSString *)event
|
||||
attributes:(NSDictionary *)attributes;
|
||||
|
||||
- (void)tagEvent:(NSString *)event
|
||||
attributes:(NSDictionary *)attributes
|
||||
customerValueIncrease:(NSNumber *)customerValueIncrease;
|
||||
|
||||
- (void)tagEvent:(NSString *)event
|
||||
attributes:(NSDictionary *)attributes
|
||||
reportAttributes:(NSDictionary *)reportAttributes;
|
||||
|
||||
- (void)tagEvent:(NSString *)event
|
||||
attributes:(NSDictionary *)attributes
|
||||
reportAttributes:(NSDictionary *)reportAttributes
|
||||
customerValueIncrease:(NSNumber *)customerValueIncrease;
|
||||
|
||||
|
||||
/*!
|
||||
@method tagScreen
|
||||
@abstract Allows tagging the flow of screens encountered during the session.
|
||||
@param screen The name of the screen
|
||||
*/
|
||||
- (void)tagScreen:(NSString *)screen;
|
||||
|
||||
/*!
|
||||
@method upload
|
||||
@abstract Creates a low priority thread which uploads any Localytics data already stored
|
||||
on the device. This should be done early in the process life in order to
|
||||
guarantee as much time as possible for slow connections to complete. It is also reasonable
|
||||
to upload again when the application is exiting because if the upload is cancelled the data
|
||||
will just get uploaded the next time the app comes up.
|
||||
*/
|
||||
- (void)upload;
|
||||
|
||||
/*!
|
||||
@method LocalyticsSession
|
||||
@abstract Initializes the Localytics Object. Not necessary if you choose to use startSession.
|
||||
@param applicationKey The key unique for each application generated at www.localytics.com
|
||||
*/
|
||||
- (void)LocalyticsSession:(NSString *)appKey;
|
||||
|
||||
/*!
|
||||
@method setOptIn
|
||||
@abstract (OPTIONAL) Allows the application to control whether or not it will collect user data.
|
||||
Even if this call is used, it is necessary to continue calling upload(). No new data will be
|
||||
collected, so nothing new will be uploaded but it is necessary to upload an event telling the
|
||||
server this user has opted out.
|
||||
@param optedIn True if the user is opted in, false otherwise.
|
||||
*/
|
||||
- (void)setOptIn:(BOOL)optedIn;
|
||||
|
||||
/*!
|
||||
@method setLocation
|
||||
@abstract Stores the user's location. This will be used in all event and session calls.
|
||||
If your application has already collected the user's location, it may be passed to Localytics
|
||||
via this function. This will cause all events and the session close to include the locatin
|
||||
information. It is not required that you call this function.
|
||||
@param deviceLocation The user's location.
|
||||
*/
|
||||
- (void)setLocation:(CLLocationCoordinate2D)deviceLocation;
|
||||
|
||||
|
||||
/*!
|
||||
@method setCustomDimension
|
||||
@abstract Sets the value of a custom dimension. Custom dimensions are dimensions
|
||||
which contain user defined data unlike the predefined dimensions such as carrier, model, and country.
|
||||
Once a value for a custom dimension is set, the device it was set on will continue to upload that value
|
||||
until the value is changed. To clear a value pass nil as the value.
|
||||
The proper use of custom dimensions involves defining a dimension with less than ten distinct possible
|
||||
values and assigning it to one of the four available custom dimensions. Once assigned this definition should
|
||||
never be changed without changing the App Key otherwise old installs of the application will pollute new data.
|
||||
*/
|
||||
- (void)setCustomDimension:(int)dimension value:(NSString *)value;
|
||||
|
||||
/*!
|
||||
@method customDimension
|
||||
@abstract Gets the custom dimension value for a given dimension. Avoid calling this on the main thread, as it
|
||||
may take some time for all pending database execution. */
|
||||
- (NSString *)customDimension:(int)dimension;
|
||||
|
||||
|
||||
/*!
|
||||
@method setValueForIdentifier
|
||||
@abstract Sets the value of a custom identifier. Identifiers are a form of key/value storage
|
||||
which contain custom user data. Identifiers might include things like email addresses, customer IDs, twitter
|
||||
handles, and facebook IDs.
|
||||
Once a value is set, the device it was set on will continue to upload that value until the value is changed.
|
||||
To delete a property, pass in nil as the value.
|
||||
*/
|
||||
- (void)setValueForIdentifier:(NSString *)identifierName value:(NSString *)value;
|
||||
|
||||
/*!
|
||||
@method setCustomerName
|
||||
@abstract Record the customer name
|
||||
Once this value is set, the device it was set on will continue to upload that value until the value is changed.
|
||||
To delete the value, pass in nil.
|
||||
*/
|
||||
- (void)setCustomerName:(NSString *)email;
|
||||
|
||||
/*!
|
||||
@method setCustomerId
|
||||
@abstract Record your custom customer identifier
|
||||
Once this value is set, the device it was set on will continue to upload that value until the value is changed.
|
||||
To delete the value, pass in nil.
|
||||
*/
|
||||
- (void)setCustomerId:(NSString *)customerId;
|
||||
|
||||
/*!
|
||||
@method setCustomerId
|
||||
@abstract Record the customer's email address
|
||||
Once this value is set, the device it was set on will continue to upload that value until the value is changed.
|
||||
To delete the value, pass in nil.
|
||||
*/
|
||||
- (void)setCustomerEmail:(NSString *)email;
|
||||
|
||||
@end
|
||||
|
||||
@protocol LocalyticsSessionDelegate <NSObject>
|
||||
@optional
|
||||
|
||||
/*!
|
||||
@method localyticsResumedSession
|
||||
@abstract Register for this callback to be notified when Localytics has either
|
||||
resumed a previous session or created a new one. See the on the 'resume' method
|
||||
for additional details.
|
||||
@param didResumeExistingSession This flag will indicate if Localytics restored an existing
|
||||
session or started a new one.
|
||||
*/
|
||||
- (void)localyticsResumedSession:(BOOL)didResumeExistingSession;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
1455
External/Localytics/LocalyticsSession.m
vendored
1455
External/Localytics/LocalyticsSession.m
vendored
File diff suppressed because it is too large
Load Diff
75
External/Localytics/LocalyticsUploader.h
vendored
75
External/Localytics/LocalyticsUploader.h
vendored
@@ -1,75 +0,0 @@
|
||||
// LocalyticsUploader.h
|
||||
// Copyright (C) 2013 Char Software Inc., DBA Localytics
|
||||
//
|
||||
// This code is provided under the Localytics Modified BSD License.
|
||||
// A copy of this license has been distributed in a file called LICENSE
|
||||
// with this source code.
|
||||
//
|
||||
// Please visit www.localytics.com for more information.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
extern NSString * const kLocalyticsKeyResponseBody;
|
||||
|
||||
/*!
|
||||
@class LocalyticsUploader
|
||||
@discussion Singleton class to handle data uploads
|
||||
*/
|
||||
|
||||
@interface LocalyticsUploader : NSObject {
|
||||
}
|
||||
|
||||
@property (readonly, atomic) BOOL isUploading;
|
||||
|
||||
/*!
|
||||
@method LocalyticsUploader
|
||||
@abstract Creates a thread which uploads all queued header and event data.
|
||||
All files starting with sessionFilePrefix are renamed,
|
||||
uploaded and deleted on upload. This way the sessions can continue
|
||||
writing data regardless of whether or not the upload succeeds. Files
|
||||
which have been renamed still count towards the total number of Localytics
|
||||
files which can be stored on the disk.
|
||||
|
||||
This version of the method now just calls the second version of it with a nil target and NULL callback method.
|
||||
@param localyticsApplicationKey the Localytics application ID
|
||||
@param useHTTPS Flag determining whether HTTP or HTTPS is used for the post URL.
|
||||
@param installId Install id passed to the server in the x-install-id header field.
|
||||
@param libraryVersion Library version to be passed to the server in the x-client-version header field.
|
||||
*/
|
||||
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion;
|
||||
|
||||
/*!
|
||||
@method LocalyticsUploader
|
||||
@abstract Creates a thread which uploads all queued header and event data.
|
||||
All files starting with sessionFilePrefix are renamed,
|
||||
uploaded and deleted on upload. This way the sessions can continue
|
||||
writing data regardless of whether or not the upload succeeds. Files
|
||||
which have been renamed still count towards the total number of Localytics
|
||||
files which can be stored on the disk.
|
||||
@param localyticsApplicationKey the Localytics application ID
|
||||
@param useHTTPS Flag determining whether HTTP or HTTPS is used for the post URL.
|
||||
@param installId Install id passed to the server in the x-install-id header field.
|
||||
@param libraryVersion Library version to be passed to the server in the x-client-version header field.
|
||||
@param resultTarget Result target is the target for the callback method that knows how to handle response data
|
||||
@param callback Callback is the method of the target class that is to be called with the data begin returned by an upload
|
||||
*/
|
||||
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion resultTarget:(id)target callback:(SEL)callbackMethod;
|
||||
|
||||
|
||||
/*!
|
||||
@method LocalyticsUploader
|
||||
@abstract Upload attribution data to Localytics.
|
||||
@param localyticsApplicationKey the Localytics application ID
|
||||
@param attribution Attribution cookie captured at install time
|
||||
@param installId Install id passed to the server in the x-install-id header field.
|
||||
@param advertisingIdentifier The Apple 'advertisingidentifier'
|
||||
*/
|
||||
- (void)uploaderAttributionWithApplicationKey:(NSString *)appKey attribution:(NSString *)attribution installId:(NSString *)installId advertisingIdentifier:(NSString *)advertisingIdentifier;
|
||||
|
||||
/*!
|
||||
@method uploadTimeStamp
|
||||
@abstract Retrieve upload TimeStamp.
|
||||
*/
|
||||
- (NSString *)uploadTimeStamp;
|
||||
|
||||
@end
|
||||
343
External/Localytics/LocalyticsUploader.m
vendored
343
External/Localytics/LocalyticsUploader.m
vendored
@@ -1,343 +0,0 @@
|
||||
// LocalyticsUploader.m
|
||||
// Copyright (C) 2013 Char Software Inc., DBA Localytics
|
||||
//
|
||||
// This code is provided under the Localytics Modified BSD License.
|
||||
// A copy of this license has been distributed in a file called LICENSE
|
||||
// with this source code.
|
||||
//
|
||||
// Please visit www.localytics.com for more information.
|
||||
|
||||
#import "LocalyticsUploader.h"
|
||||
#import "LocalyticsSession.h"
|
||||
#import "LocalyticsSession+Private.h"
|
||||
#import "LocalyticsDatabase.h"
|
||||
#import "WebserviceConstants.h"
|
||||
#import <zlib.h>
|
||||
|
||||
#ifndef LOCALYTICS_URL
|
||||
#define LOCALYTICS_URL @"http://analytics.localytics.com/api/v2/applications/%@/uploads"
|
||||
#endif
|
||||
|
||||
#ifndef LOCALYTICS_URL_SECURED
|
||||
#define LOCALYTICS_URL_SECURED @"https://analytics.localytics.com/api/v2/applications/%@/uploads"
|
||||
#endif
|
||||
|
||||
#ifndef LOCALYTICS_ATTRIBUTION_SERVER
|
||||
#define LOCALYTICS_ATTRIBUTION_SERVER @"http://a.localytics.com/fb_install/"
|
||||
#endif
|
||||
|
||||
NSString * const kLocalyticsKeyResponseBody = @"localytics.key.responseBody";
|
||||
|
||||
@interface LocalyticsUploader ()
|
||||
- (void)finishUpload;
|
||||
- (NSData *)gzipDeflatedDataWithData:(NSData *)data;
|
||||
|
||||
@property (readwrite) BOOL isUploading;
|
||||
|
||||
@end
|
||||
|
||||
@implementation LocalyticsUploader
|
||||
@synthesize isUploading = _isUploading;
|
||||
|
||||
#pragma mark - Class Methods
|
||||
|
||||
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion
|
||||
{
|
||||
[self uploaderWithApplicationKey:localyticsApplicationKey useHTTPS:useHTTPS installId:installId libraryVersion:libraryVersion resultTarget:nil callback:NULL];
|
||||
}
|
||||
|
||||
|
||||
- (void)uploaderWithApplicationKey:(NSString *)localyticsApplicationKey useHTTPS:(BOOL)useHTTPS installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion resultTarget:(id)target callback:(SEL)callbackMethod
|
||||
{
|
||||
|
||||
// Do nothing if already uploading.
|
||||
if (self.isUploading == true)
|
||||
{
|
||||
LocalyticsLog("Upload already in progress. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
LocalyticsLog("Beginning upload process");
|
||||
self.isUploading = true;
|
||||
|
||||
// Prepare the data for upload. The upload could take a long time, so some effort has to be made to be sure that events
|
||||
// which get written while the upload is taking place don't get lost or duplicated. To achieve this, the logic is:
|
||||
// 1) Append every header row blob string and and those of its associated events to the upload string.
|
||||
// 2) Deflate and upload the data.
|
||||
// 3) On success, delete all blob headers and staged events. Events added while an upload is in process are not
|
||||
// deleted because they are not associated a header (and cannot be until the upload completes).
|
||||
|
||||
// Step 1
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
LocalyticsDatabase *db = [[LocalyticsSession shared] db];
|
||||
NSString *blobString = [db uploadBlobString];
|
||||
|
||||
if ([blobString length] == 0) {
|
||||
// There is nothing outstanding to upload.
|
||||
LocalyticsLog("Abandoning upload. There are no new events.");
|
||||
[pool drain];
|
||||
[self finishUpload];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSData *requestData = [blobString dataUsingEncoding:NSUTF8StringEncoding];
|
||||
if(LOCALYTICS_LOGGING_ENABLED) {
|
||||
NSString *logString = [[[NSString alloc] initWithData:requestData
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
NSUInteger stringLength = [logString length];
|
||||
|
||||
logString = [logString stringByReplacingOccurrencesOfString:@"{"
|
||||
withString:@"\n\t{"];
|
||||
logString = [logString stringByReplacingOccurrencesOfString:@",\""
|
||||
withString:@",\n\t\""];
|
||||
|
||||
LocalyticsLog("Uploading data (length: %u)\n%@",
|
||||
stringLength,
|
||||
logString);
|
||||
}
|
||||
|
||||
// Step 2
|
||||
NSData *deflatedRequestData = [[self gzipDeflatedDataWithData:requestData] retain];
|
||||
|
||||
[pool drain];
|
||||
|
||||
NSString *urlStringFormat;
|
||||
if (useHTTPS) {
|
||||
urlStringFormat = LOCALYTICS_URL_SECURED;
|
||||
} else {
|
||||
urlStringFormat = LOCALYTICS_URL;
|
||||
}
|
||||
NSURL *apiUrl = [NSURL URLWithString:[NSString stringWithFormat:urlStringFormat,[localyticsApplicationKey stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
NSMutableURLRequest *submitRequest = [self createRequestWithURL:apiUrl
|
||||
installId:installId
|
||||
libraryVersion:libraryVersion
|
||||
requestData:deflatedRequestData];
|
||||
|
||||
[deflatedRequestData release];
|
||||
|
||||
// Perform synchronous upload in an async dispatch. This is necessary because the calling block will not persist to
|
||||
// receive the response data.
|
||||
dispatch_group_async([[LocalyticsSession shared] criticalGroup], [[LocalyticsSession shared] queue], ^{
|
||||
@try {
|
||||
NSURLResponse *response = nil;
|
||||
NSError *responseError = nil;
|
||||
NSData *responseData = [NSURLConnection sendSynchronousRequest:submitRequest returningResponse:&response error:&responseError];
|
||||
NSInteger responseStatusCode = [(NSHTTPURLResponse *)response statusCode];
|
||||
|
||||
if (responseError) {
|
||||
// On error, simply print the error and close the uploader. We have to assume the data was not transmited
|
||||
// so it is not deleted. In the event that we accidently store data which was succesfully uploaded, the
|
||||
// duplicate data will be ignored by the server when it is next uploaded.
|
||||
LocalyticsLog("Error Uploading. Code: %d, Description: %@",
|
||||
[responseError code],
|
||||
[responseError localizedDescription]);
|
||||
} else {
|
||||
// Step 3
|
||||
// While response status codes in the 5xx range leave upload rows intact, the default case is to delete.
|
||||
if (responseStatusCode >= 500 && responseStatusCode < 600) {
|
||||
LocalyticsLog("Upload failed with response status code %d", responseStatusCode);
|
||||
} else {
|
||||
// Because only one instance of the uploader can be running at a time it should not be possible for
|
||||
// new upload rows to appear so there is no fear of deleting data which has not yet been uploaded.
|
||||
LocalyticsLog("Upload completed successfully. Response code %d", responseStatusCode);
|
||||
[[[LocalyticsSession shared] db] deleteUploadedData];
|
||||
}
|
||||
}
|
||||
|
||||
if ([responseData length] > 0) {
|
||||
if (LOCALYTICS_LOGGING_ENABLED) {
|
||||
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
|
||||
LocalyticsLog("Response body: %@", responseString);
|
||||
[responseString release];
|
||||
}
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:responseData forKey:kLocalyticsKeyResponseBody];
|
||||
if (target) {
|
||||
[target performSelector:callbackMethod withObject:userInfo];
|
||||
}
|
||||
}
|
||||
|
||||
[self finishUpload];
|
||||
}
|
||||
@catch (NSException * e) {}
|
||||
});
|
||||
}
|
||||
|
||||
- (NSMutableURLRequest *)createRequestWithURL:(NSURL *)URL installId:(NSString *)installId libraryVersion:(NSString *)libraryVersion requestData:(NSData *)requestData
|
||||
{
|
||||
|
||||
NSMutableURLRequest *submitRequest = [NSMutableURLRequest requestWithURL:URL
|
||||
cachePolicy:NSURLRequestReloadIgnoringCacheData
|
||||
timeoutInterval:60.0];
|
||||
[submitRequest setHTTPMethod:@"POST"];
|
||||
[submitRequest setValue:[self uploadTimeStamp] forHTTPHeaderField:HEADER_CLIENT_TIME];
|
||||
[submitRequest setValue:installId forHTTPHeaderField:HEADER_INSTALL_ID];
|
||||
[submitRequest setValue:libraryVersion forHTTPHeaderField:HEADER_CLIENT_VERSION];
|
||||
[submitRequest setValue:@"application/x-gzip" forHTTPHeaderField:@"Content-Type"];
|
||||
[submitRequest setValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
|
||||
[submitRequest setValue:[NSString stringWithFormat:@"%d", requestData.length] forHTTPHeaderField:@"Content-Length"];
|
||||
|
||||
if ([LocalyticsSession shared].delaySession == YES)
|
||||
{
|
||||
[submitRequest setValue:@"true" forHTTPHeaderField:HEADER_DELAY_SESSION];
|
||||
}
|
||||
|
||||
[submitRequest setHTTPBody:requestData];
|
||||
|
||||
return submitRequest;
|
||||
}
|
||||
|
||||
- (void)finishUpload
|
||||
{
|
||||
self.isUploading = false;
|
||||
|
||||
// Upload data has been deleted. Recover the disk space if necessary.
|
||||
[[[LocalyticsSession shared] db] vacuumIfRequired];
|
||||
}
|
||||
|
||||
- (void)uploaderAttributionWithApplicationKey:(NSString *)appKey attribution:(NSString *)attribution installId:(NSString *)installId advertisingIdentifier:(NSString *)advertisingIdentifier
|
||||
{
|
||||
// Required parameters
|
||||
if(!attribution)
|
||||
return;
|
||||
|
||||
NSString *apiUrlString = [LOCALYTICS_ATTRIBUTION_SERVER stringByAppendingString:appKey];
|
||||
NSMutableURLRequest *submitRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:apiUrlString]
|
||||
cachePolicy:NSURLRequestReloadIgnoringCacheData
|
||||
timeoutInterval:60.0];
|
||||
|
||||
NSMutableString *postBody = [NSMutableString string];
|
||||
[postBody appendFormat:@"%@=%@", FB_ATTRIBUTION, attribution];
|
||||
[postBody appendFormat:@"&%@=%ld", FB_ATTRIBUTION_TIME, (long)[[[LocalyticsSession shared] db] createdTimestamp]];
|
||||
|
||||
if(advertisingIdentifier)
|
||||
{
|
||||
[postBody appendFormat:@"&%@=%@", FB_DEVICE_ID_TYPE, @"adid"];
|
||||
[postBody appendFormat:@"&%@=%@", FB_DEVICE_ID, advertisingIdentifier];
|
||||
|
||||
}
|
||||
|
||||
if(installId)
|
||||
{
|
||||
[postBody appendFormat:@"&%@=%@", FB_INSTALL_ID, installId];
|
||||
}
|
||||
|
||||
[submitRequest setHTTPMethod:@"POST"];
|
||||
[submitRequest setHTTPBody:[postBody dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
// Perform synchronous upload in an async dispatch. This is necessary because the calling block will not persist to
|
||||
// receive the response data.
|
||||
dispatch_group_async([[LocalyticsSession shared] criticalGroup], [[LocalyticsSession shared] queue], ^{
|
||||
@try {
|
||||
NSURLResponse *response = nil;
|
||||
NSError *responseError = nil;
|
||||
[NSURLConnection sendSynchronousRequest:submitRequest
|
||||
returningResponse:&response
|
||||
error:&responseError];
|
||||
NSInteger responseStatusCode = [(NSHTTPURLResponse *)response statusCode];
|
||||
|
||||
if (responseError) {
|
||||
// On error, simply print the error and close the uploader. We have to assume the data was not transmited
|
||||
// so it is not deleted.
|
||||
LocalyticsLog("Error uploading Facebook attribution. Code: %d, Description: %@",
|
||||
[responseError code],
|
||||
[responseError localizedDescription]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// While response status codes in the 5xx range leave upload rows intact, the default case is to delete.
|
||||
if (responseStatusCode >= 500 && responseStatusCode < 600) {
|
||||
LocalyticsLog("Facebook attribution upload unsuccessful. Response code %d", responseStatusCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalyticsLog("Facebook attribution upload completed successfully. Response code %d", responseStatusCode);
|
||||
[[[LocalyticsSession shared] db] setFacebookAttribution:nil];
|
||||
[LocalyticsSession shared].facebookAttribution = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
@catch (NSException * e) {}
|
||||
});
|
||||
}
|
||||
/*!
|
||||
@method gzipDeflatedDataWithData
|
||||
@abstract Deflates the provided data using gzip at the default compression level (6).
|
||||
@return the deflated data
|
||||
*/
|
||||
- (NSData *)gzipDeflatedDataWithData:(NSData *)data
|
||||
{
|
||||
if ([data length] == 0) return data;
|
||||
|
||||
z_stream strm;
|
||||
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.total_out = 0;
|
||||
strm.next_in=(Bytef *)[data bytes];
|
||||
strm.avail_in = [data length];
|
||||
|
||||
// Compresssion Levels:
|
||||
// Z_NO_COMPRESSION
|
||||
// Z_BEST_SPEED
|
||||
// Z_BEST_COMPRESSION
|
||||
// Z_DEFAULT_COMPRESSION
|
||||
|
||||
if (deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY) != Z_OK) return nil;
|
||||
|
||||
NSMutableData *compressed = [NSMutableData dataWithLength:16384]; // 16K chunks for expansion
|
||||
|
||||
do {
|
||||
|
||||
if (strm.total_out >= [compressed length])
|
||||
[compressed increaseLengthBy: 16384];
|
||||
|
||||
strm.next_out = [compressed mutableBytes] + strm.total_out;
|
||||
strm.avail_out = [compressed length] - strm.total_out;
|
||||
|
||||
deflate(&strm, Z_FINISH);
|
||||
|
||||
} while (strm.avail_out == 0);
|
||||
|
||||
deflateEnd(&strm);
|
||||
|
||||
[compressed setLength: strm.total_out];
|
||||
return [NSData dataWithData:compressed];
|
||||
}
|
||||
|
||||
/*!
|
||||
@method uploadTimeStamp
|
||||
@abstract Gets the current time, along with local timezone, formatted as a DateTime for the webservice.
|
||||
@return a DateTime of the current local time and timezone.
|
||||
*/
|
||||
- (NSString *)uploadTimeStamp {
|
||||
return [ NSString stringWithFormat:@"%ld", (long)[[NSDate date] timeIntervalSince1970] ];
|
||||
}
|
||||
|
||||
#pragma mark - System Functions
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
#pragma unused(zone)
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)retain {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (unsigned)retainCount {
|
||||
// maximum value of an unsigned int - prevents additional retains for the class
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
- (oneway void)release {
|
||||
// ignore release commands
|
||||
}
|
||||
|
||||
- (id)autorelease {
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
133
External/Localytics/WebserviceConstants.h
vendored
133
External/Localytics/WebserviceConstants.h
vendored
@@ -1,133 +0,0 @@
|
||||
// WebserviceConstants.h
|
||||
// Copyright (C) 2013 Char Software Inc., DBA Localytics
|
||||
//
|
||||
// This code is provided under the Localytics Modified BSD License.
|
||||
// A copy of this license has been distributed in a file called LICENSE
|
||||
// with this source code.
|
||||
//
|
||||
// Please visit www.localytics.com for more information.
|
||||
|
||||
// The constants which are used to make up the JSON blob
|
||||
// To save disk space and network bandwidth all the keywords have been
|
||||
// abbreviated and are exploded by the server.
|
||||
|
||||
/*****************
|
||||
* Upload Header *
|
||||
*****************/
|
||||
#define HEADER_CLIENT_TIME @"x-upload-time"
|
||||
#define HEADER_INSTALL_ID @"x-install-id"
|
||||
#define HEADER_CLIENT_VERSION @"x-client-version"
|
||||
#define HEADER_DELAY_SESSION @"ll-first-session"
|
||||
|
||||
/*********************
|
||||
* Shared Attributes *
|
||||
*********************/
|
||||
#define PARAM_UUID @"u" // UUID for JSON document
|
||||
#define PARAM_DATA_TYPE @"dt" // Data Type
|
||||
#define PARAM_CLIENT_TIME @"ct" // Client Time, seconds from Unix epoch (int)
|
||||
#define PARAM_LATITUDE @"lat" // Latitude - if available
|
||||
#define PARAM_LONGITUDE @"lon" // Longitude - if available
|
||||
#define PARAM_SESSION_UUID @"su" // UUID for an existing session
|
||||
#define PARAM_NEW_SESSION_UUID @"u" // UUID for a new session
|
||||
#define PARAM_ATTRIBUTES @"attrs" // Attributes (dictionary)
|
||||
#define PARAM_SESSION_ELAPSE_TIME @"sl" // Number of seconds since the previous session start
|
||||
|
||||
/***************
|
||||
* Blob Header *
|
||||
***************/
|
||||
|
||||
// PARAM_UUID
|
||||
// PARAM_DATA_TYPE => "h" for Header
|
||||
// PARAM_ATTRIBUTES => dictionary containing Header Common Attributes
|
||||
#define PARAM_PERSISTED_AT @"pa" // Persistent Storage Created At. A timestamp created when the app was
|
||||
// first launched and the persistent storage was created. Stores as
|
||||
// seconds from Unix epoch. (int)
|
||||
#define PARAM_SEQUENCE_NUMBER @"seq" // Sequence number - an increasing count for each blob, stored in the
|
||||
// persistent store Consistent across app starts. (int)
|
||||
|
||||
/****************************
|
||||
* Header Common Attributes *
|
||||
****************************/
|
||||
|
||||
// PARAM_DATA_TYPE
|
||||
#define PARAM_APP_KEY @"au" // Localytics Application ID
|
||||
#define PARAM_DEVICE_UUID_HASHED @"udid" // Hashed version of the UUID
|
||||
#define PARAM_DEVICE_ADID @"adid" // Advertising Identifier
|
||||
#define PARAM_INSTALL_ID @"iu" // Install ID
|
||||
#define PARAM_JAILBROKEN @"j" // Jailbroken (boolean)
|
||||
#define PARAM_LIBRARY_VERSION @"lv" // Client Version
|
||||
#define PARAM_APP_VERSION @"av" // Application Version
|
||||
#define PARAM_DEVICE_PLATFORM @"dp" // Device Platform
|
||||
#define PARAM_LOCALE_LANGUAGE @"dll" // Locale Language
|
||||
#define PARAM_LOCALE_COUNTRY @"dlc" // Locale Country
|
||||
#define PARAM_DEVICE_COUNTRY @"dc" // Device Country (iso code)
|
||||
#define PARAM_DEVICE_MODEL @"dmo" // Device Model
|
||||
#define PARAM_DEVICE_OS_VERSION @"dov" // Device OS Version
|
||||
#define PARAM_NETWORK_CARRIER @"nca" // Network Carrier
|
||||
#define PARAM_OPT_VALUE @"out" // Opt Out (boolean)
|
||||
#define PARAM_DEVICE_MEMORY @"dmem" // Device Memory
|
||||
#define PARAM_IDENTIFIERS @"ids" // Identifiers (dictionary)
|
||||
#define PARAM_BIRTH_TIME @"b" // Birth time (Since epoch)
|
||||
#define PARAM_TIMEZONE_OFFSET @"tz" // Device offset from GMT in seconds
|
||||
|
||||
/*****************
|
||||
* Session Start *
|
||||
*****************/
|
||||
|
||||
// PARAM_UUID
|
||||
// PARAM_DATA_TYPE => "s" for Start
|
||||
// PARAM_CLIENT_TIME
|
||||
#define PARAM_SESSION_NUMBER @"nth" // This is the nth session on the device, 1-indexed (int)
|
||||
|
||||
/****************
|
||||
* Session Stop *
|
||||
****************/
|
||||
|
||||
// PARAM_UUID
|
||||
// PARAM_DATA_TYPE => "c" for Close
|
||||
// PARAM_CLIENT_TIME
|
||||
// PARAM_LATITUDE
|
||||
// PARAM_LONGITUDE
|
||||
// PARAM_SESSION_UUID => UUID of session being closed
|
||||
#define PARAM_SESSION_ACTIVE @"cta" // Active time in seconds (time app was active)
|
||||
#define PARAM_SESSION_TOTAL @"ctl" // Total session length
|
||||
#define PARAM_SESSION_SCREENFLOW @"fl" // Screens encountered during this session, in order
|
||||
|
||||
/*********************
|
||||
* Application Event *
|
||||
*********************/
|
||||
|
||||
// PARAM_UUID
|
||||
// PARAM_DATA_TYPE => "e" for Event
|
||||
// PARAM_CLIENT_TIME
|
||||
// PARAM_LATITUDE
|
||||
// PARAM_LONGITUDE
|
||||
// PARAM_SESSION_UUID => UUID of session event occured in
|
||||
// PARAM_ATTRIBUTES => dictionary containing attributes for this event as key-value string pairs
|
||||
#define PARAM_EVENT_NAME @"n" // Event Name, (eg. 'Button Click')
|
||||
#define PARAM_REPORT_ATTRIBUTES @"rattrs" // Attributes used in custom reports
|
||||
#define PARAM_VALUE_NAME @"v" // Added customer value for an event, such as revenue
|
||||
|
||||
/********************
|
||||
* Application flow *
|
||||
********************/
|
||||
|
||||
// PARAM_UUID
|
||||
// PARAM_DATA_TYPE => "f" for Flow
|
||||
// PARAM_CLIENT_TIME
|
||||
#define PARAM_SESSION_START @"ss" // Start time for the current session.
|
||||
#define PARAM_NEW_FLOW_EVENTS @"nw" // Events and screens encountered during this session that have NOT been staged for upload.
|
||||
#define PARAM_OLD_FLOW_EVENTS @"od" // Events and screens encountered during this session that HAVE been staged for upload.
|
||||
|
||||
/************************
|
||||
* Partner attributions *
|
||||
***********************/
|
||||
#define FB_ATTRIBUTION @"fb_attrib_first" // Facebook attribution cookie
|
||||
#define FB_ATTRIBUTION_TIME @"fb_attrib_first_date" // Time original attribution cookie was collected
|
||||
#define FB_ATTRIBUTION_CURRENT @"fb_attrib_current" // Facebook attribution cookie
|
||||
#define FB_ATTRIBUTION_CURRENT_TIME @"fb_attrib_current_date" // Time original attribution cookie was collected
|
||||
#define FB_DEVICE_ID @"dpid" // Device unique identifiers
|
||||
#define FB_DEVICE_ID_TYPE @"dpid_type" // Either UDID or ADID (advertisingIdentifier)
|
||||
#define FB_INSTALL_ID @"install_id" // Device install ID
|
||||
|
||||
|
||||
BIN
External/Mac/Crashlytics.framework/Versions/A/Crashlytics
vendored
Normal file
BIN
External/Mac/Crashlytics.framework/Versions/A/Crashlytics
vendored
Normal file
Binary file not shown.
@@ -170,6 +170,16 @@ OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
**/
|
||||
@property (nonatomic, readonly) NSDate *crashedOnDate;
|
||||
|
||||
/**
|
||||
* Returns the os version that the application crashed on.
|
||||
**/
|
||||
@property (nonatomic, readonly) NSString *OSVersion;
|
||||
|
||||
/**
|
||||
* Returns the os build version that the application crashed on.
|
||||
**/
|
||||
@property (nonatomic, readonly) NSString *OSBuildVersion;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
30
External/Mac/Crashlytics.framework/Versions/A/Resources/Info.plist
vendored
Normal file
30
External/Mac/Crashlytics.framework/Versions/A/Resources/Info.plist
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Crashlytics</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.crashlytics.sdk.mac</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Crashlytics</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.1.2</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>macosx</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>9</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
External/Mac/Crashlytics.framework/run
vendored
Executable file
BIN
External/Mac/Crashlytics.framework/run
vendored
Executable file
Binary file not shown.
2
External/Pearl
vendored
2
External/Pearl
vendored
Submodule External/Pearl updated: e9b731dca8...bde28af789
1
External/RHStatusItemView
vendored
Submodule
1
External/RHStatusItemView
vendored
Submodule
Submodule External/RHStatusItemView added at 039dc04e66
1
External/Reveal.framework/Headers
vendored
Symbolic link
1
External/Reveal.framework/Headers
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
1
External/Reveal.framework/Reveal
vendored
Symbolic link
1
External/Reveal.framework/Reveal
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
Versions/Current/Reveal
|
||||
17
External/Reveal.framework/Versions/A/Headers/IBARevealLoader.h
vendored
Normal file
17
External/Reveal.framework/Versions/A/Headers/IBARevealLoader.h
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Copyright (c) 2013 Itty Bitty Apps. All rights reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern NSString * const IBARevealLoaderRequestStartNotification;
|
||||
extern NSString * const IBARevealLoaderRequestStopNotification;
|
||||
|
||||
extern NSString * const IBARevealLoaderSetOptionsNotification;
|
||||
extern NSString * const IBARevealLoaderOptionsLogLevelMaskKey;
|
||||
|
||||
@interface IBARevealLoader : NSObject
|
||||
|
||||
+ (void)startServer;
|
||||
+ (void)stopServer;
|
||||
|
||||
@end
|
||||
57
External/Reveal.framework/Versions/A/Headers/IBARevealLogger.h
vendored
Normal file
57
External/Reveal.framework/Versions/A/Headers/IBARevealLogger.h
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
/*!
|
||||
\brief The Reveal Log level bit flags.
|
||||
\discussion These flags are additive. i.e. you should bitwise OR them together.
|
||||
|
||||
\seealso IBARevealLoggerSetLevelMask
|
||||
\seealso IBARevealLoggerGetLevelMask
|
||||
|
||||
Example:
|
||||
|
||||
// Enable Error, Warning and Info logger levels.
|
||||
IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo);
|
||||
|
||||
*/
|
||||
typedef NS_OPTIONS(int32_t, IBARevealLogLevel)
|
||||
{
|
||||
IBARevealLogLevelNone = 0,
|
||||
IBARevealLogLevelDebug = (1 << 0),
|
||||
IBARevealLogLevelInfo = (1 << 1),
|
||||
IBARevealLogLevelWarn = (1 << 2),
|
||||
IBARevealLogLevelError = (1 << 3)
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Set the Reveal logger level mask.
|
||||
\param mask A bit mask which is a combination of the IBARevealLogLevel enum options.
|
||||
|
||||
\discussion If you do not wish to see log messages from Reveal you should call this function with an appropriate level mask as early in your application's lifecycle as possible. For example in your application's main() function.
|
||||
|
||||
Example:
|
||||
|
||||
// Enable Error, Warning and Info logger levels.
|
||||
IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo);
|
||||
|
||||
*/
|
||||
CF_EXPORT void IBARevealLoggerSetLevelMask(int32_t mask);
|
||||
|
||||
/*!
|
||||
\brief Get the current Reveal logger level mask.
|
||||
\return A bit mask representing the levels at which Reveal is currently logging.
|
||||
\discussion The default Reveal Logger level mask is IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo.
|
||||
|
||||
Example:
|
||||
|
||||
// Turn off the Info log level.
|
||||
IBARevealLoggerSetLevelMask(IBARevealLoggerGetLevelMask() & ~IBARevealLogLevelInfo);
|
||||
|
||||
*/
|
||||
CF_EXPORT int32_t IBARevealLoggerGetLevelMask(void);
|
||||
|
||||
CF_EXTERN_C_END
|
||||
5
External/Reveal.framework/Versions/A/Headers/Reveal.h
vendored
Normal file
5
External/Reveal.framework/Versions/A/Headers/Reveal.h
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IBARevealLogger.h"
|
||||
#import "IBARevealLoader.h"
|
||||
BIN
External/Reveal.framework/Versions/A/Reveal
vendored
Normal file
BIN
External/Reveal.framework/Versions/A/Reveal
vendored
Normal file
Binary file not shown.
1
External/Reveal.framework/Versions/Current
vendored
Symbolic link
1
External/Reveal.framework/Versions/Current
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
A
|
||||
221
External/TestFlight/README.md
vendored
221
External/TestFlight/README.md
vendored
@@ -1,221 +0,0 @@
|
||||
##Introduction
|
||||
|
||||
The TestFlight SDK allows you to track how beta testers are testing your application. Out of the box we track simple usage information, such as which tester is using your application, their device model/OS, how long they used the application, logs of their test session, and automatic recording of any crashes they encounter.
|
||||
|
||||
To get the most out of the SDK we have provided the Checkpoint API.
|
||||
|
||||
The Checkpoint API is used to help you track exactly how your testers are using your application. Curious about which users passed level 5 in your game, or posted their high score to Twitter, or found that obscure feature? With a single line of code you can finally gather all this information. Wondering how many times your app has crashed? Wondering who your power testers are? We've got you covered. See more information on the Checkpoint API in section 4.
|
||||
|
||||
Alongside the Checkpoint API is the Questions interface. The Questions interface is managed on a per build basis on the TestFlight website. Find out more about the Questions Interface in section 6.
|
||||
|
||||
For more detailed debugging we have a remote logging solution. Find out more about our logging system with TFLog in the Remote Logging section.
|
||||
|
||||
|
||||
##Considerations
|
||||
|
||||
Information gathered by the SDK is sent to the website in real time. When an application is put into the background (iOS 4.x) or terminated (iOS 3.x) we try to send the finalizing information for the session during the time allowed for finalizing the application. Should all of the data not get sent the remaining data will be sent the next time the application is launched. As such, to get the most out of the SDK we recommend your application support iOS 4.0 and higher.
|
||||
|
||||
This SDK can be run from both the iPhone Simulator and Device and has been tested using Xcode 4.0.
|
||||
|
||||
|
||||
##Integration
|
||||
|
||||
1. Add the files to your project: File -> Add Files to " "
|
||||
1. Find and select the folder that contains the SDK
|
||||
2. Make sure that "Copy items into destination folder (if needed)" is checked
|
||||
3. Set Folders to "Create groups for any added folders"
|
||||
4. Select all targets that you want to add the SDK to
|
||||
2. Verify that libTestFlight.a has been added to the Link Binary With Libraries Build Phase for the targets you want to use the SDK with
|
||||
1. Select your Project in the Project Navigator
|
||||
2. Select the target you want to enable the SDK for
|
||||
3. Select the Build Phases tab
|
||||
4. Open the Link Binary With Libraries Phase
|
||||
5. If libTestFlight.a is not listed, drag and drop the library from your Project Navigator to the Link Binary With Libraries area
|
||||
6. Repeat Steps 2 - 5 until all targets you want to use the SDK with have the SDK linked
|
||||
3. Add libz to your Link Binary With Libraries Build Phase
|
||||
1. Select your Project in the Project Navigator
|
||||
2. Select the target you want to enable the SDK for
|
||||
3. Select the Build Phases tab
|
||||
4. Open the Link Binary With Libraries Phase
|
||||
5. Click the + to add a new library
|
||||
6. Find libz.dylib in the list and add it
|
||||
7. Repeat Steps 2 - 6 until all targets you want to use the SDK with have libz.dylib
|
||||
|
||||
4. In your Application Delegate:
|
||||
1. Import TestFlight: `#import "TestFlight.h"`
|
||||
|
||||
***NOTE:*** Rather than importing `TestFlight.h` in every file you may add the above line into you pre-compiled header (`<projectname>_Prefix.pch`) file inside of the
|
||||
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
|
||||
section. This will give you access to the SDK across all files.
|
||||
|
||||
2. Get your Application Token which you can find at [http://testflightapp.com/dashboard/applications/](http://testflightapp.com/dashboard/applications/) select the application you are using from the list choose the SDK option and the application token for this application will be there. To ensure that your testers do not show up as anonymous place the call to setDeviceIdentifer before calling takeOff. Remove #define TESTING 1 before building your release build for the App Store.
|
||||
|
||||
3. Launch TestFlight with your Application Token
|
||||
|
||||
-(BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// start of your application:didFinishLaunchingWithOptions
|
||||
|
||||
// !!!: Use the next line only during beta
|
||||
// [TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
|
||||
|
||||
[TestFlight takeOff:@"Insert your Application Token here"];
|
||||
// The rest of your application:didFinishLaunchingWithOptions method
|
||||
// ...
|
||||
}
|
||||
|
||||
4. To report crashes to you we install our own uncaught exception handler. If you are not currently using an exception handler of your own then all you need to do is go to the next step. If you currently use an Exception Handler, or you use another framework that does please go to the section on advanced exception handling.
|
||||
|
||||
|
||||
##Beta Testing and Release Differentiation
|
||||
|
||||
In order to provide more information about your testers while beta testing you will need to provide the device's unique identifier. This identifier is not something that the SDK will collect from the device and we do not recommend using this in production. To send the device identifier to us put the following code **before your call to takeOff**.
|
||||
|
||||
[TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
|
||||
[TestFlight takeOff:@"Insert your Application Token here"];
|
||||
|
||||
This will allow you to have the best possible information during testing. **When it is time to submit to the App Store comment this line out**. Apple may reject your app if you leave this line in. If you decide to not include the device's unique identifier during your testing phase TestFlight will still collect all of the information that you send but it may be anonymized.
|
||||
|
||||
|
||||
##Checkpoint API
|
||||
|
||||
When a tester does something you care about in your app you can pass a checkpoint. For example completing a level, adding a todo item, etc. The checkpoint progress is used to provide insight into how your testers are testing your apps. The passed checkpoints are also attached to crashes, which can help when creating steps to replicate.
|
||||
|
||||
`[TestFlight passCheckpoint:@"CHECKPOINT_NAME"];` Use `passCheckpoint:` to track when a user performs certain tasks in your application. This can be useful for making sure testers are hitting all parts of your application, as well as tracking which testers are being thorough.
|
||||
|
||||
##Feedback API
|
||||
|
||||
To launch unguided feedback call the openFeedbackView method. We recommend that you call this from a GUI element.
|
||||
|
||||
-(IBAction)launchFeedback {
|
||||
[TestFlight openFeedbackView];
|
||||
}
|
||||
|
||||
If you want to create your own feedback form you can use the submitCustomFeedback method to submit the feedback that the user has entered.
|
||||
|
||||
-(IBAction)submitFeedbackPressed:(id)sender {
|
||||
NSString *feedback = [self getUserFeedback];
|
||||
[TestFlight submitFeedback:feedback];
|
||||
}
|
||||
|
||||
The above sample assumes that [self getUserFeedback] is implemented such that it obtains the users feedback from the GUI element you have created and that submitFeedbackPressed is the action for your submit button.
|
||||
|
||||
Once users have submitted feedback from inside of the application you can view it in the feedback area of your build page.
|
||||
|
||||
|
||||
##Upload your build
|
||||
|
||||
After you have integrated the SDK into your application you need to upload your build to TestFlight. You can upload from your dashboard or or using the Upload API, full documentation at [https://testflightapp.com/api/doc/](https://testflightapp.com/api/doc/)
|
||||
|
||||
##Questions Interface
|
||||
|
||||
In order to ask a question, you'll need to associate it with a checkpoint. Make sure your checkpoints are initialized by running your app and hitting them all yourself before you start adding questions.
|
||||
|
||||
There are three question types available: Yes/No, Multiple Choice, and Long Answer.
|
||||
|
||||
To create questions, visit your builds Questions page and click on 'Add Question'. If you choose Multiple Choice, you'll need to enter a list of possible answers for your testers to choose from — otherwise, you'll only need to enter your question's, well, question. If your build has no questions, you can also choose to migrate questions from another build (because seriously — who wants to do all that typing again)?
|
||||
|
||||
After restarting your application on an approved device, when you pass the checkpoint associated with your questions a TestFlight modal question form will appear on the screen asking the beta tester to answer your question.
|
||||
|
||||
After you upload a new build to TestFlight you will need to associate questions once again. However if your checkpoints and questions have remained the same you can choose "copy questions from an older build" and choose which build to copy the questions from.
|
||||
|
||||
##View the results
|
||||
|
||||
As testers install your build and start to test it you will see their session data on the web on the build report page for the build you've uploaded.
|
||||
|
||||
##Advanced Exception Handling
|
||||
|
||||
An uncaught exception means that your application is in an unknown state and there is not much that you can do but try and exit gracefully. Our SDK does its best to get the data we collect in this situation to you while it is crashing, but it is designed in such a way that the important act of saving the data occurs in as safe way a way as possible before trying to send anything. If you do use uncaught exception or signal handlers install your handlers before calling `takeOff`. Our SDK will then call your handler while ours is running. For example:
|
||||
|
||||
/*
|
||||
My Apps Custom uncaught exception catcher, we do special stuff here, and TestFlight takes care of the rest
|
||||
*/
|
||||
void HandleExceptions(NSException *exception) {
|
||||
NSLog(@"This is where we save the application data during a exception");
|
||||
// Save application data on crash
|
||||
}
|
||||
/*
|
||||
My Apps Custom signal catcher, we do special stuff here, and TestFlight takes care of the rest
|
||||
*/
|
||||
void SignalHandler(int sig) {
|
||||
NSLog(@"This is where we save the application data during a signal");
|
||||
// Save application data on crash
|
||||
}
|
||||
|
||||
-(BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// installs HandleExceptions as the Uncaught Exception Handler
|
||||
NSSetUncaughtExceptionHandler(&HandleExceptions);
|
||||
// create the signal action structure
|
||||
struct sigaction newSignalAction;
|
||||
// initialize the signal action structure
|
||||
memset(&newSignalAction, 0, sizeof(newSignalAction));
|
||||
// set SignalHandler as the handler in the signal action structure
|
||||
newSignalAction.sa_handler = &SignalHandler;
|
||||
// set SignalHandler as the handlers for SIGABRT, SIGILL and SIGBUS
|
||||
sigaction(SIGABRT, &newSignalAction, NULL);
|
||||
sigaction(SIGILL, &newSignalAction, NULL);
|
||||
sigaction(SIGBUS, &newSignalAction, NULL);
|
||||
// Call takeOff after install your own unhandled exception and signal handlers
|
||||
[TestFlight takeOff:@"Insert your Application Token here"];
|
||||
// continue with your application initialization
|
||||
}
|
||||
|
||||
You do not need to add the above code if your application does not use exception handling already.
|
||||
|
||||
##Remote Logging
|
||||
|
||||
To perform remote logging you can use the TFLog method which logs in a few different methods described below. In order to make the transition from NSLog to TFLog easy we have used the same method signature for TFLog as NSLog. You can easily switch over to TFLog by adding the following macro to your header
|
||||
|
||||
#define NSLog TFLog
|
||||
|
||||
That will do a switch from NSLog to TFLog, if you want more information, such as file name and line number you can use a macro like
|
||||
|
||||
#define NSLog(__FORMAT__, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
|
||||
Which will produce output that looks like
|
||||
|
||||
-[HTFCheckpointsController showYesNoQuestion:] [Line 45] Pressed YES/NO
|
||||
|
||||
We have implemented three different loggers.
|
||||
|
||||
1. TestFlight logger
|
||||
2. Apple System Log logger
|
||||
3. STDERR logger
|
||||
|
||||
Each of the loggers log asynchronously and all TFLog calls are non blocking. The TestFlight logger writes its data to a file which is then sent to our servers on Session End events. The Apple System Logger sends its messages to the Apple System Log and are viewable using the Organizer in Xcode when the device is attached to your computer. The ASL logger can be disabled by turning it off in your TestFlight options
|
||||
|
||||
[TestFlight setOptions:{ TFOptionLogToConsole : @NO }];
|
||||
|
||||
The default option is YES.
|
||||
|
||||
The STDERR logger sends log messages to STDERR so that you can see your log statements while debugging. The STDERR logger is only active when a debugger is attached to your application. If you do not wish to use the STDERR logger you can disable it by turning it off in your TestFlight options
|
||||
|
||||
[TestFlight setOptions:{ TFOptionLogToSTDERR : @NO }];
|
||||
|
||||
The default option is YES.
|
||||
|
||||
## Advanced Remote Logging
|
||||
|
||||
For most users we expect using TFLog to provide all of the logging functionality that they need. For the occasion where you need to provide a wrapper around TFLog we provide
|
||||
|
||||
void TFLogv(NSString *format, va_list arg_list);
|
||||
|
||||
Using TFLogv you can have your method that accepts a variable number of arguments that then passes that format and argument list to TFLog.
|
||||
|
||||
|
||||
##iOS3
|
||||
|
||||
We now require that anyone who is writing an application that supports iOS3 add the System.framework as an optional link. In order to provide a better shutdown experience we send any large log files to our servers in the background. To add System.framework as an optional link:
|
||||
|
||||
1. Select your Project in the Project Navigator
|
||||
2. Select the target you want to enable the SDK for
|
||||
3. Select the Build Phases tab
|
||||
4. Open the Link Binary With Libraries Phase
|
||||
5. Click the + to add a new library
|
||||
6. Find libSystem.dylib in the list and add it
|
||||
7. To the right of libSystem.dylib in the Link Binary With Libraries pane change "Required" to "Optional"
|
||||
114
External/TestFlight/TestFlight.h
vendored
114
External/TestFlight/TestFlight.h
vendored
@@ -1,114 +0,0 @@
|
||||
//
|
||||
// TestFlight.h
|
||||
// libTestFlight
|
||||
//
|
||||
// Created by Jonathan Janzen on 06/11/11.
|
||||
// Copyright 2011 TestFlight. All rights reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#define TESTFLIGHT_SDK_VERSION @"1.2.4"
|
||||
#undef TFLog
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void TFLog(NSString *format, ...);
|
||||
void TFLogv(NSString *format, va_list arg_list);
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TestFlight object
|
||||
* All methods are class level
|
||||
*/
|
||||
@interface TestFlight : NSObject {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom environment information
|
||||
* If you want to track custom information such as a user name from your application you can add it here
|
||||
*
|
||||
* @param information A string containing the environment you are storing
|
||||
* @param key The key to store the information with
|
||||
*/
|
||||
+ (void)addCustomEnvironmentInformation:(NSString *)information forKey:(NSString*)key;
|
||||
|
||||
|
||||
/**
|
||||
* Starts a TestFlight session using the Application Token for this Application
|
||||
*
|
||||
* @param applicationToken Will be the application token for the current application.
|
||||
* The token for this application can be retrieved by going to https://testflightapp.com/dashboard/applications/
|
||||
* selecting this application from the list then selecting SDK.
|
||||
*/
|
||||
|
||||
+ (void)takeOff:(NSString *)applicationToken;
|
||||
|
||||
/**
|
||||
* Sets custom options
|
||||
*
|
||||
* @param options NSDictionary containing the options you want to set. Available options are described below at "TestFlight Option Keys"
|
||||
*
|
||||
*/
|
||||
+ (void)setOptions:(NSDictionary*)options;
|
||||
|
||||
/**
|
||||
* Track when a user has passed a checkpoint after the flight has taken off. Eg. passed level 1, posted high score
|
||||
*
|
||||
* @param checkpointName The name of the checkpoint, this should be a static string
|
||||
*/
|
||||
+ (void)passCheckpoint:(NSString *)checkpointName;
|
||||
|
||||
/**
|
||||
* Opens a feedback window that is not attached to a checkpoint
|
||||
*/
|
||||
+ (void)openFeedbackView;
|
||||
|
||||
/**
|
||||
* Submits custom feedback to the site. Sends the data in feedback to the site. This is to be used as the method to submit
|
||||
* feedback from custom feedback forms.
|
||||
*
|
||||
* @param feedback Your users feedback, method does nothing if feedback is nil
|
||||
*/
|
||||
+ (void)submitFeedback:(NSString*)feedback;
|
||||
|
||||
/**
|
||||
* Sets the Device Identifier.
|
||||
*
|
||||
* !! DO NOT CALL IN SUBMITTED APP STORE APP.
|
||||
*
|
||||
* !! MUST BE CALLED BEFORE +takeOff:
|
||||
*
|
||||
* This method should only be used during testing so that you can identify a testers test data with them.
|
||||
* If you do not provide the identifier you will still see all session data, with checkpoints
|
||||
* and logs, but the data will be anonymized.
|
||||
*
|
||||
* It is recommended that you only use this method during testing.
|
||||
* Apple may reject your app if left in a submitted app.
|
||||
*
|
||||
* Use:
|
||||
* Only use this with the Apple device UDID. DO NOT use Open ID or your own identifier.
|
||||
* [TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];
|
||||
*
|
||||
* @param deviceIdentifer The current devices device identifier
|
||||
*/
|
||||
+ (void)setDeviceIdentifier:(NSString*)deviceIdentifer;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* TestFlight Option Keys
|
||||
*
|
||||
* Pass these as keys to the dictionary you pass to +`[TestFlight setOptions:]`.
|
||||
* The values should be NSNumber BOOLs (`[NSNumber numberWithBool:YES]` or `@YES`)
|
||||
*/
|
||||
extern NSString *const TFOptionAttachBacktraceToFeedback; // Defaults to @NO. Setting to @YES attaches the current backtrace, with symbols, to the feedback.
|
||||
extern NSString *const TFOptionDisableInAppUpdates; // Defaults to @NO. Setting to @YES, disables the in app update screen shown in BETA apps when there is a new version available on TestFlight.
|
||||
extern NSString *const TFOptionLogToConsole; // Defaults to @YES. Prints remote logs to Apple System Log.
|
||||
extern NSString *const TFOptionLogToSTDERR; // Defaults to @YES. Sends remote logs to STDERR when debugger is attached.
|
||||
extern NSString *const TFOptionReinstallCrashHandlers; // If set to @YES: Reinstalls crash handlers, to be used if a third party library installs crash handlers overtop of the TestFlight Crash Handlers.
|
||||
extern NSString *const TFOptionSendLogOnlyOnCrash; // Defaults to @NO. Setting to @YES stops remote logs from being sent when sessions end. They would only be sent in the event of a crash.
|
||||
|
||||
BIN
External/TestFlight/libTestFlight.a
vendored
BIN
External/TestFlight/libTestFlight.a
vendored
Binary file not shown.
239
External/TestFlight/release_notes.md
vendored
239
External/TestFlight/release_notes.md
vendored
@@ -1,239 +0,0 @@
|
||||
## 1.2.4 - February 19, 2013
|
||||
|
||||
- Fixed bug that caused crash reports to sometimes not send immediately (they would be resent later)
|
||||
|
||||
## 1.2.3 - January 8, 2013
|
||||
|
||||
- Fixed typos in readme
|
||||
- Fixed bug where logs not sent on crash
|
||||
- Fixed bug where empty crash files were created (but not sent)
|
||||
- Cache cache path
|
||||
- Use consts for `setOptions:`
|
||||
- Updated `setDeviceIdentifier:` comments to make them clearer
|
||||
- Remove potentially conflicting function name `UIColorFromRGB`
|
||||
- Fixed crash on bad in app update data
|
||||
|
||||
## 1.2.2 - December 26, 2012
|
||||
|
||||
- Fix typo in app token error message
|
||||
|
||||
## 1.2.1 - December 26, 2012
|
||||
|
||||
- The max number of concurrent network connections has been reduced from 4 to 2.
|
||||
|
||||
##1.2 - November 12, 2012
|
||||
|
||||
* Removed Team Token support. As of version 1.2 takeOff must be called with the Application Token, https://testflightapp.com/dashboard/applications/, choose your application, select SDK, get the Token for this Application.
|
||||
|
||||
##1.2 BETA 3 - October 11, 2012
|
||||
|
||||
* Added application token support. Application Tokens are currently optional if you do not have one you do not need one
|
||||
|
||||
##1.2 BETA 2 - October 9, 2012
|
||||
|
||||
* Resolved an instance of close_file being called on a bad file descriptor
|
||||
|
||||
##1.2 BETA 1 - October 1, 2012
|
||||
|
||||
* Removed support for armv6
|
||||
* Exception handler now returns instead of raising a SIGTRAP
|
||||
|
||||
##1.1 - September 13, 2012
|
||||
|
||||
* armv7s and iOS 6 support
|
||||
* Updated for general release
|
||||
|
||||
##1.1 BETA 3 - September 12, 2012
|
||||
|
||||
* armv7s slice added to library
|
||||
* fixed typo for in application updates, inAppUdates changed to inAppUpdates
|
||||
|
||||
##1.1 BETA 2 - September 6, 2012
|
||||
|
||||
* Re-enabled armv6 support
|
||||
* Added option to disable in application updates
|
||||
|
||||
##1.1 BETA 1 - July 13, 2012
|
||||
|
||||
* Added TFLogv to allow for log customizations. Check the README or online docs for more information.
|
||||
* Added option attachBacktraceToFeedback, which attaches a backtrace to feedback sent from the SDK. For users who use feedback in more than one location in the application.
|
||||
* Resolved issue where other exception handlers would not be called during an exception.
|
||||
* SDK now sends the device language for a session.
|
||||
* Documentation fixes.
|
||||
* Stability fixes.
|
||||
|
||||
###1.0 - March 29, 2012
|
||||
|
||||
* Resolved occurrences of exceptions with the message "No background task exists with identifier 0"
|
||||
|
||||
###1.0 BETA 1 - March 23, 2012
|
||||
|
||||
* Privacy Updates
|
||||
* UDID is no longer collected by the SDK. During testing please use `[TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]];` to send the UDID so you can identify your testers. For release do not set `+setDeviceIdentifier`. See Beta Testing and Release Differentiation in the README or online at [https://testflightapp.com/sdk/doc/1.0beta1/](http://testflightapp.com/sdk/doc/1.0beta1/)
|
||||
|
||||
###0.8.3 - February 14, 2012
|
||||
|
||||
* Rolled previous beta code into release builds
|
||||
* No longer allow in application updates to occur in applications that were obtained from the app store.
|
||||
|
||||
**Tested compiled library with:**
|
||||
|
||||
* Xcode 4.3
|
||||
* Xcode 4.2
|
||||
* Xcode 4.1
|
||||
* Xcode 3.2.6
|
||||
|
||||
###0.8.3 BETA 5 - February 10, 2012
|
||||
|
||||
* Changed logging from asynchronous to synchronous.
|
||||
* Resolved crash when looking for a log path failed.
|
||||
* Added submitFeedback to the TestFlight class to allow for custom feedback forms.
|
||||
|
||||
###0.8.3 BETA 4 - January 20, 2012
|
||||
|
||||
* Resolved an issue that occured when an application was upgraded from 0.8.3 BETA 1 to 0.8.3 BETA 3+ with unsent data from 0.8.3 BETA 1
|
||||
|
||||
###0.8.3 BETA 3 - January 19, 2012
|
||||
|
||||
* On crash log files over 64k will not be sent until next launch.
|
||||
|
||||
**Known Issues:**
|
||||
|
||||
* Logging massive amounts of data at the end of a session may prevent the application from launching in time on next launch
|
||||
|
||||
###0.8.3 BETA 2 - January 13, 2012
|
||||
|
||||
* libz.dylib is now required to be added to your "Link Binary with Libraries" build phase
|
||||
* Log file compression, The compression is done on an as needed basis rather than before sending
|
||||
* Changed all outgoing data from JSON to MessagePack
|
||||
* Added option `logToSTDERR` to disable the `STDERR` logger
|
||||
|
||||
###0.8.3 BETA 1 - December 29, 2011
|
||||
|
||||
* In rare occurrences old session data that had not been sent to our server may have been discarded or attached to the wrong build. It is now no longer discarded
|
||||
* Made sending of Session End events more robust
|
||||
* Network queuing system does better bursting of unsent data
|
||||
* Log files that are larger than 64K are now sent sometime after the next launch
|
||||
* Log files that are larger than 16MB are no longer supported and will be replaced with a message indicating the log file was too large
|
||||
* Fixed crashes while resuming from background
|
||||
|
||||
###0.8.2 - December 20, 2011
|
||||
|
||||
* Promoted 0.8.2 BETA 4 to stable
|
||||
|
||||
**Known Issues:**
|
||||
|
||||
* Under some circumstances Session End events may not be sent until the next launch.
|
||||
* With large log files Session End events may take a long time to show up.
|
||||
|
||||
**Tested compiled library with:**
|
||||
|
||||
* Xcode 4.3
|
||||
* Xcode 4.2
|
||||
* Xcode 4.1
|
||||
* Xcode 3.2.6
|
||||
|
||||
###0.8.2 BETA 4 - December 12, 2011
|
||||
|
||||
* Prevented "The string argument is NULL" from occuring during finishedHandshake in rare cases
|
||||
* Resolved issue where data recorded while offline may not be sent
|
||||
|
||||
###0.8.2 BETA 3 - December 8, 2011
|
||||
|
||||
* Added auto-release pools to background setup and tear down
|
||||
|
||||
###0.8.2 BETA 2 - December 5, 2011
|
||||
|
||||
* Fixed the "pointer being freed was not allocated" bug
|
||||
|
||||
###0.8.1 - November 18, 2011
|
||||
|
||||
* Implemented TFLog logging system, see README for more information
|
||||
* Fixed an issue where Session End events may not be sent until next launch
|
||||
* Fixed an issue where duplicate events could be sent
|
||||
* Fixed an issue with Session End events not being sent from some iPod touch models
|
||||
|
||||
**Tested compiled library with:**
|
||||
|
||||
* Xcode 4.2
|
||||
* Xcode 4.1
|
||||
* Xcode 3.2.6
|
||||
|
||||
###0.8 - November 8, 2011
|
||||
|
||||
* Added `SIGTRAP` as a signal type that we catch
|
||||
* Removed all Objective-c from crash reporting
|
||||
* Removed the use of non signal safe functions from signal handling
|
||||
* Created a signal safe way to get symbols from a stack trace
|
||||
* Changed the keyboardType for Long Answer Questions and Feedback to allow for international character input
|
||||
* Changed `TESTFLIGHT_SDK_VERSION` string to be an `NSString`
|
||||
* Changed cache folder from Library/Caches/TestFlight to Library/Caches/com.testflight.testflightsdk
|
||||
* Fixed issue with saving data when device is offline
|
||||
* Fixed compability issues with iOS 3
|
||||
* Added calling into the rootViewController shouldAutorotateToInterfaceOrientation if a rootViewController is set
|
||||
* Made the comments in TestFlight.h compatible with Appledoc
|
||||
|
||||
Tested compiled library with:
|
||||
|
||||
* Xcode 4.2
|
||||
* Xcode 4.1
|
||||
* Xcode 3.2
|
||||
|
||||
###0.7.2 - September 29, 2011
|
||||
|
||||
* Changed `TESTFLIGHT_SDK_VERSION` string to be an `NSString`
|
||||
* Fixed an issue where exiting an application while the SDK is active caused modal views to be dismissed
|
||||
|
||||
###0.7.1 - September 22, 2011
|
||||
|
||||
* Internal release
|
||||
* Refactoring
|
||||
|
||||
###0.7 - September 21, 2011
|
||||
|
||||
* Moved TestFlight images and data to the Library/Caches folder
|
||||
* Resolved an issue where sometimes the rootViewController could not be found and feedback, questions and upgrade views would not be displayed
|
||||
* In application upgrade changed to allow skipping until the next version is installed and allows upgrades to be forced
|
||||
* Fixed a memory leak when launching questions
|
||||
|
||||
###0.6 - September 2, 2011
|
||||
|
||||
* Renamed base64_encode to testflight_base64_encode to remove a conflict with other third party libraries
|
||||
* Added ability to reinstall crash handlers when they are overwritten using the setOptions API
|
||||
* Fixed an issue where crash reports might not get sent under certain circumstances
|
||||
* Fixed a deadlock when the application is put in the background and then resumed before all information can be sent
|
||||
* Fixed an issue when attempting to un-install all signal handlers during a signal
|
||||
* Added support for landscape mode on the iPad to the Questions and Feedback views
|
||||
* Crash reporting now works in versions of Xcode earlier than 4.2
|
||||
* Fixed a memory leak during handshake
|
||||
|
||||
###0.5 - August 19, 2011
|
||||
|
||||
* Feedback that is not attached to a checkpoint [TestFlight openFeedbackView]
|
||||
* Usability changes to question views
|
||||
* Removed pause and resume sessions, replaced with sessions being stopped and started
|
||||
* Added text auto correction to the Long Answer question type
|
||||
* Crash reports now send on crash instead of next launch
|
||||
|
||||
###0.4 - August 15, 2011
|
||||
|
||||
* In Application Feedback with Questions
|
||||
* In application updates
|
||||
* Custom Environment Information added
|
||||
* Networking stack reimplementation
|
||||
* Exception handling fixes
|
||||
|
||||
###0.3 - June 15, 2011
|
||||
|
||||
* Removed all mention of JSONKit from the README
|
||||
* Added support for using both the Bundle Version and the Bundle Short Version string
|
||||
|
||||
###0.2 - June 14, 2011
|
||||
|
||||
* Removed all categories this allows users to use the SDK without having to set -ObjC and -load_all
|
||||
* Prefixed JSONKit for use in TestFlight to remove reported issues where some users were already using JSONKit
|
||||
* Added support for armv6 again
|
||||
|
||||
###0.1 - June 11, 2011
|
||||
|
||||
* Initial Version
|
||||
2
External/UbiquityStoreManager
vendored
2
External/UbiquityStoreManager
vendored
Submodule External/UbiquityStoreManager updated: 9a4d52c382...5e38f25f6e
16
External/google-plus-ios-sdk/Changelog
vendored
16
External/google-plus-ios-sdk/Changelog
vendored
@@ -1,16 +0,0 @@
|
||||
2013-02-26 -- v1.2.1
|
||||
- Interactive posts on Google+ share
|
||||
- Improved sign-in and share APIs to use shared instances
|
||||
- Automatic retrieval of user identity upon sign-in
|
||||
- Expanded Google+ moments API support
|
||||
- Updated sample app
|
||||
|
||||
2012-10-12 -- v1.1.0
|
||||
- Content deep linking on Google+ share
|
||||
- iOS6 support
|
||||
- Shortened class names
|
||||
- Bug fixes
|
||||
|
||||
2012-06-25 -- v1.0.0
|
||||
- Google+ sign-in button, share plugin, and Google+ history integration library
|
||||
with sample app.
|
||||
@@ -1,25 +0,0 @@
|
||||
/* Copyright (c) 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSData *GTLDecodeBase64(NSString *base64Str);
|
||||
NSString *GTLEncodeBase64(NSData *data);
|
||||
|
||||
// "Web-safe" encoding substitutes - and _ for + and / in the encoding table,
|
||||
// per http://www.ietf.org/rfc/rfc4648.txt section 5.
|
||||
|
||||
NSData *GTLDecodeWebSafeBase64(NSString *base64Str);
|
||||
NSString *GTLEncodeWebSafeBase64(NSData *data);
|
||||
@@ -1,139 +0,0 @@
|
||||
/* Copyright (c) 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "GTLBase64.h"
|
||||
|
||||
// Based on Cyrus Najmabadi's elegent little encoder and decoder from
|
||||
// http://www.cocoadev.com/index.pl?BaseSixtyFour
|
||||
|
||||
static char gStandardEncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static char gWebSafeEncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
|
||||
#pragma mark Encode
|
||||
|
||||
static NSString *EncodeBase64StringCommon(NSData *data, const char *table) {
|
||||
if (data == nil) return nil;
|
||||
|
||||
const uint8_t* input = [data bytes];
|
||||
NSUInteger length = [data length];
|
||||
|
||||
NSUInteger bufferSize = ((length + 2) / 3) * 4;
|
||||
NSMutableData* buffer = [NSMutableData dataWithLength:bufferSize];
|
||||
|
||||
int8_t *output = [buffer mutableBytes];
|
||||
|
||||
for (NSUInteger i = 0; i < length; i += 3) {
|
||||
NSUInteger value = 0;
|
||||
for (NSUInteger j = i; j < (i + 3); j++) {
|
||||
value <<= 8;
|
||||
|
||||
if (j < length) {
|
||||
value |= (0xFF & input[j]);
|
||||
}
|
||||
}
|
||||
|
||||
NSInteger idx = (i / 3) * 4;
|
||||
output[idx + 0] = table[(value >> 18) & 0x3F];
|
||||
output[idx + 1] = table[(value >> 12) & 0x3F];
|
||||
output[idx + 2] = (i + 1) < length ? table[(value >> 6) & 0x3F] : '=';
|
||||
output[idx + 3] = (i + 2) < length ? table[(value >> 0) & 0x3F] : '=';
|
||||
}
|
||||
|
||||
NSString *result = [[[NSString alloc] initWithData:buffer
|
||||
encoding:NSASCIIStringEncoding] autorelease];
|
||||
return result;
|
||||
}
|
||||
|
||||
NSString *GTLEncodeBase64(NSData *data) {
|
||||
return EncodeBase64StringCommon(data, gStandardEncodingTable);
|
||||
}
|
||||
|
||||
NSString *GTLEncodeWebSafeBase64(NSData *data) {
|
||||
return EncodeBase64StringCommon(data, gWebSafeEncodingTable);
|
||||
}
|
||||
|
||||
#pragma mark Decode
|
||||
|
||||
static void CreateDecodingTable(const char *encodingTable,
|
||||
size_t encodingTableSize, char *decodingTable) {
|
||||
memset(decodingTable, 0, 128);
|
||||
for (unsigned int i = 0; i < encodingTableSize; i++) {
|
||||
decodingTable[(unsigned int) encodingTable[i]] = (char)i;
|
||||
}
|
||||
}
|
||||
|
||||
static NSData *DecodeBase64StringCommon(NSString *base64Str,
|
||||
char *decodingTable) {
|
||||
// The input string should be plain ASCII
|
||||
const char *cString = [base64Str cStringUsingEncoding:NSASCIIStringEncoding];
|
||||
if (cString == nil) return nil;
|
||||
|
||||
NSInteger inputLength = (NSInteger)strlen(cString);
|
||||
if (inputLength % 4 != 0) return nil;
|
||||
if (inputLength == 0) return [NSData data];
|
||||
|
||||
while (inputLength > 0 && cString[inputLength - 1] == '=') {
|
||||
inputLength--;
|
||||
}
|
||||
|
||||
NSInteger outputLength = inputLength * 3 / 4;
|
||||
NSMutableData* data = [NSMutableData dataWithLength:(NSUInteger)outputLength];
|
||||
uint8_t *output = [data mutableBytes];
|
||||
|
||||
NSInteger inputPoint = 0;
|
||||
NSInteger outputPoint = 0;
|
||||
char *table = decodingTable;
|
||||
|
||||
while (inputPoint < inputLength) {
|
||||
int i0 = cString[inputPoint++];
|
||||
int i1 = cString[inputPoint++];
|
||||
int i2 = inputPoint < inputLength ? cString[inputPoint++] : 'A'; // 'A' will decode to \0
|
||||
int i3 = inputPoint < inputLength ? cString[inputPoint++] : 'A';
|
||||
|
||||
output[outputPoint++] = (uint8_t)((table[i0] << 2) | (table[i1] >> 4));
|
||||
if (outputPoint < outputLength) {
|
||||
output[outputPoint++] = (uint8_t)(((table[i1] & 0xF) << 4) | (table[i2] >> 2));
|
||||
}
|
||||
if (outputPoint < outputLength) {
|
||||
output[outputPoint++] = (uint8_t)(((table[i2] & 0x3) << 6) | table[i3]);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
NSData *GTLDecodeBase64(NSString *base64Str) {
|
||||
static char decodingTable[128];
|
||||
static BOOL hasInited = NO;
|
||||
|
||||
if (!hasInited) {
|
||||
CreateDecodingTable(gStandardEncodingTable, sizeof(gStandardEncodingTable),
|
||||
decodingTable);
|
||||
hasInited = YES;
|
||||
}
|
||||
return DecodeBase64StringCommon(base64Str, decodingTable);
|
||||
}
|
||||
|
||||
NSData *GTLDecodeWebSafeBase64(NSString *base64Str) {
|
||||
static char decodingTable[128];
|
||||
static BOOL hasInited = NO;
|
||||
|
||||
if (!hasInited) {
|
||||
CreateDecodingTable(gWebSafeEncodingTable, sizeof(gWebSafeEncodingTable),
|
||||
decodingTable);
|
||||
hasInited = YES;
|
||||
}
|
||||
return DecodeBase64StringCommon(base64Str, decodingTable);
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLBatchQuery.h
|
||||
//
|
||||
|
||||
// Batch query documentation:
|
||||
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Batch_Operations
|
||||
|
||||
#import "GTLQuery.h"
|
||||
|
||||
@interface GTLBatchQuery : NSObject <GTLQueryProtocol> {
|
||||
@private
|
||||
NSMutableArray *queries_;
|
||||
NSMutableDictionary *requestIDMap_;
|
||||
BOOL skipAuthorization_;
|
||||
NSDictionary *additionalHTTPHeaders_;
|
||||
}
|
||||
|
||||
// Queries included in this batch. Each query should have a unique requestID.
|
||||
@property (retain) NSArray *queries;
|
||||
|
||||
// Clients may set this to YES to disallow authorization. Defaults to NO.
|
||||
@property (assign) BOOL shouldSkipAuthorization;
|
||||
|
||||
// Any additional HTTP headers for this batch.
|
||||
//
|
||||
// These headers override the same keys from the service object's
|
||||
// additionalHTTPHeaders.
|
||||
@property (copy) NSDictionary *additionalHTTPHeaders;
|
||||
|
||||
+ (id)batchQuery;
|
||||
+ (id)batchQueryWithQueries:(NSArray *)array;
|
||||
|
||||
- (void)addQuery:(GTLQuery *)query GTL_NONNULL((1));
|
||||
|
||||
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1));
|
||||
|
||||
@end
|
||||
@@ -1,133 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLBatchQuery.m
|
||||
//
|
||||
|
||||
#import "GTLBatchQuery.h"
|
||||
|
||||
@implementation GTLBatchQuery
|
||||
|
||||
@synthesize shouldSkipAuthorization = skipAuthorization_,
|
||||
additionalHTTPHeaders = additionalHTTPHeaders_;
|
||||
|
||||
+ (id)batchQuery {
|
||||
GTLBatchQuery *obj = [[[self alloc] init] autorelease];
|
||||
return obj;
|
||||
}
|
||||
|
||||
+ (id)batchQueryWithQueries:(NSArray *)queries {
|
||||
GTLBatchQuery *obj = [self batchQuery];
|
||||
obj.queries = queries;
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
// Deep copy the list of queries
|
||||
NSArray *copiesOfQueries = [[[NSArray alloc] initWithArray:self.queries
|
||||
copyItems:YES] autorelease];
|
||||
GTLBatchQuery *newBatch = [[[self class] allocWithZone:zone] init];
|
||||
newBatch.queries = copiesOfQueries;
|
||||
newBatch.shouldSkipAuthorization = self.shouldSkipAuthorization;
|
||||
newBatch.additionalHTTPHeaders = self.additionalHTTPHeaders;
|
||||
return newBatch;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[queries_ release];
|
||||
[additionalHTTPHeaders_ release];
|
||||
[requestIDMap_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSArray *queries = self.queries;
|
||||
NSArray *methodNames = [queries valueForKey:@"methodName"];
|
||||
NSArray *dedupedNames = [[NSSet setWithArray:methodNames] allObjects];
|
||||
NSString *namesStr = [dedupedNames componentsJoinedByString:@","];
|
||||
|
||||
return [NSString stringWithFormat:@"%@ %p (queries:%lu methods:%@)",
|
||||
[self class], self, (unsigned long) [queries count], namesStr];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (BOOL)isBatchQuery {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (GTLUploadParameters *)uploadParameters {
|
||||
// File upload is not supported for batches
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)executionDidStop {
|
||||
NSArray *queries = self.queries;
|
||||
[queries makeObjectsPerformSelector:@selector(executionDidStop)];
|
||||
}
|
||||
|
||||
- (GTLQuery *)queryForRequestID:(NSString *)requestID {
|
||||
GTLQuery *result = [requestIDMap_ objectForKey:requestID];
|
||||
if (result) return result;
|
||||
|
||||
// We've not before tried to look up a query, or the map is stale
|
||||
[requestIDMap_ release];
|
||||
requestIDMap_ = [[NSMutableDictionary alloc] init];
|
||||
|
||||
for (GTLQuery *query in queries_) {
|
||||
[requestIDMap_ setObject:query forKey:query.requestID];
|
||||
}
|
||||
|
||||
result = [requestIDMap_ objectForKey:requestID];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setQueries:(NSArray *)array {
|
||||
#if DEBUG
|
||||
for (id obj in array) {
|
||||
GTLQuery *query = obj;
|
||||
GTL_DEBUG_ASSERT([query isKindOfClass:[GTLQuery class]],
|
||||
@"unexpected query class: %@", [obj class]);
|
||||
GTL_DEBUG_ASSERT(query.uploadParameters == nil,
|
||||
@"batch may not contain upload: %@", query);
|
||||
}
|
||||
#endif
|
||||
|
||||
[queries_ autorelease];
|
||||
queries_ = [array mutableCopy];
|
||||
}
|
||||
|
||||
- (NSArray *)queries {
|
||||
return queries_;
|
||||
}
|
||||
|
||||
- (void)addQuery:(GTLQuery *)query {
|
||||
GTL_DEBUG_ASSERT([query isKindOfClass:[GTLQuery class]],
|
||||
@"unexpected query class: %@", [query class]);
|
||||
GTL_DEBUG_ASSERT(query.uploadParameters == nil,
|
||||
@"batch may not contain upload: %@", query);
|
||||
|
||||
if (queries_ == nil) {
|
||||
queries_ = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
[queries_ addObject:query];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,58 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLBatchResult.h
|
||||
//
|
||||
|
||||
#import "GTLObject.h"
|
||||
|
||||
@interface GTLBatchResult : GTLObject <GTLBatchItemCreationProtocol> {
|
||||
@private
|
||||
NSMutableDictionary *successes_;
|
||||
NSMutableDictionary *failures_;
|
||||
}
|
||||
|
||||
// Dictionaries of results for all queries in the batch
|
||||
//
|
||||
// Dictionary keys are requestID strings; objects are results or
|
||||
// GTLErrorObjects.
|
||||
//
|
||||
// For successes with no returned object (such as from delete operations),
|
||||
// the object for the dictionary entry is NSNull.
|
||||
//
|
||||
//
|
||||
// The original query for each result is available from the service ticket,
|
||||
// for example
|
||||
//
|
||||
// NSDictionary *successes = batchResults.successes;
|
||||
// for (NSString *requestID in successes) {
|
||||
// GTLObject *obj = [successes objectForKey:requestID];
|
||||
// GTLQuery *query = [ticket queryForRequestID:requestID];
|
||||
// NSLog(@"Query %@ returned object %@", query, obj);
|
||||
// }
|
||||
//
|
||||
// NSDictionary *failures = batchResults.failures;
|
||||
// for (NSString *requestID in failures) {
|
||||
// GTLErrorObject *errorObj = [failures objectForKey:requestID];
|
||||
// GTLQuery *query = [ticket queryForRequestID:requestID];
|
||||
// NSLog(@"Query %@ failed with error %@", query, errorObj);
|
||||
// }
|
||||
//
|
||||
|
||||
@property (retain) NSMutableDictionary *successes;
|
||||
@property (retain) NSMutableDictionary *failures;
|
||||
|
||||
@end
|
||||
@@ -1,92 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLBatchResult.m
|
||||
//
|
||||
|
||||
#import "GTLBatchResult.h"
|
||||
|
||||
#import "GTLErrorObject.h"
|
||||
|
||||
@implementation GTLBatchResult
|
||||
|
||||
@synthesize successes = successes_,
|
||||
failures = failures_;
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLBatchResult* newObject = [super copyWithZone:zone];
|
||||
newObject.successes = [[self.successes mutableCopyWithZone:zone] autorelease];
|
||||
newObject.failures = [[self.failures mutableCopyWithZone:zone] autorelease];
|
||||
return newObject;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[successes_ release];
|
||||
[failures_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@ %p (successes:%lu failures:%lu)",
|
||||
[self class], self,
|
||||
(unsigned long) [self.successes count],
|
||||
(unsigned long) [self.failures count]];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)createItemsWithClassMap:(NSDictionary *)batchClassMap {
|
||||
// This is called by GTLObject objectForJSON:defaultClass:
|
||||
// JSON is defined to be a dictionary, but for batch results, it really
|
||||
// is any array.
|
||||
id json = self.JSON;
|
||||
GTL_DEBUG_ASSERT([json isKindOfClass:[NSArray class]],
|
||||
@"didn't get an array for the batch results");
|
||||
NSArray *jsonArray = json;
|
||||
|
||||
NSMutableDictionary *successes = [NSMutableDictionary dictionary];
|
||||
NSMutableDictionary *failures = [NSMutableDictionary dictionary];
|
||||
|
||||
for (NSMutableDictionary *rpcResponse in jsonArray) {
|
||||
NSString *responseID = [rpcResponse objectForKey:@"id"];
|
||||
|
||||
NSMutableDictionary *errorJSON = [rpcResponse objectForKey:@"error"];
|
||||
if (errorJSON) {
|
||||
GTLErrorObject *errorObject = [GTLErrorObject objectWithJSON:errorJSON];
|
||||
[failures setValue:errorObject forKey:responseID];
|
||||
} else {
|
||||
NSMutableDictionary *resultJSON = [rpcResponse objectForKey:@"result"];
|
||||
|
||||
NSDictionary *surrogates = self.surrogates;
|
||||
Class defaultClass = [batchClassMap objectForKey:responseID];
|
||||
|
||||
id resultObject = [[self class] objectForJSON:resultJSON
|
||||
defaultClass:defaultClass
|
||||
surrogates:surrogates
|
||||
batchClassMap:nil];
|
||||
if (resultObject == nil) {
|
||||
// methods like delete return no object
|
||||
resultObject = [NSNull null];
|
||||
}
|
||||
[successes setValue:resultObject forKey:responseID];
|
||||
}
|
||||
}
|
||||
self.successes = successes;
|
||||
self.failures = failures;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,60 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLDateTime.h
|
||||
//
|
||||
// This is an immutable class representing a date and optionally a
|
||||
// time with time zone.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GTLDefines.h"
|
||||
|
||||
@interface GTLDateTime : NSObject <NSCopying> {
|
||||
NSDateComponents *dateComponents_;
|
||||
NSInteger milliseconds_; // This is only for the fraction of a second 0-999
|
||||
NSInteger offsetSeconds_; // may be NSUndefinedDateComponent
|
||||
BOOL isUniversalTime_; // preserves "Z"
|
||||
NSTimeZone *timeZone_; // specific time zone by name, if known
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithRFC3339String:(NSString *)str;
|
||||
|
||||
// timeZone may be nil if the time zone is not known.
|
||||
+ (GTLDateTime *)dateTimeWithDate:(NSDate *)date timeZone:(NSTimeZone *)tz;
|
||||
|
||||
// Use this method to make a dateTime for an all-day event (date only, so
|
||||
// hasTime is NO.)
|
||||
+ (GTLDateTime *)dateTimeForAllDayWithDate:(NSDate *)date;
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithDateComponents:(NSDateComponents *)date;
|
||||
|
||||
@property (nonatomic, readonly) NSDate *date;
|
||||
@property (nonatomic, readonly) NSCalendar *calendar;
|
||||
|
||||
@property (nonatomic, readonly) NSString *RFC3339String;
|
||||
@property (nonatomic, readonly) NSString *stringValue; // same as RFC3339String
|
||||
|
||||
@property (nonatomic, readonly, retain) NSTimeZone *timeZone;
|
||||
@property (nonatomic, readonly, copy) NSDateComponents *dateComponents;
|
||||
@property (nonatomic, readonly) NSInteger milliseconds; // This is only for the fraction of a second 0-999
|
||||
|
||||
@property (nonatomic, readonly) BOOL hasTime;
|
||||
@property (nonatomic, readonly) NSInteger offsetSeconds;
|
||||
@property (nonatomic, readonly, getter=isUniversalTime) BOOL universalTime;
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,471 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLDateTime.m
|
||||
//
|
||||
|
||||
#import "GTLDateTime.h"
|
||||
|
||||
@interface GTLDateTime ()
|
||||
|
||||
- (void)setFromDate:(NSDate *)date timeZone:(NSTimeZone *)tz;
|
||||
- (void)setFromRFC3339String:(NSString *)str;
|
||||
|
||||
@property (nonatomic, retain, readwrite) NSTimeZone *timeZone;
|
||||
@property (nonatomic, copy, readwrite) NSDateComponents *dateComponents;
|
||||
@property (nonatomic, assign, readwrite) NSInteger milliseconds;
|
||||
|
||||
@property (nonatomic, assign, readwrite) BOOL hasTime;
|
||||
@property (nonatomic, assign, readwrite) NSInteger offsetSeconds;
|
||||
@property (nonatomic, assign, getter=isUniversalTime, readwrite) BOOL universalTime;
|
||||
|
||||
@end
|
||||
|
||||
static NSCharacterSet *gDashSet = nil;
|
||||
static NSCharacterSet *gTSet = nil;
|
||||
static NSCharacterSet *gColonSet = nil;
|
||||
static NSCharacterSet *gPlusMinusZSet = nil;
|
||||
static NSMutableDictionary *gCalendarsForTimeZones = nil;
|
||||
|
||||
@implementation GTLDateTime
|
||||
|
||||
// A note about milliseconds_:
|
||||
// RFC 3339 has support for fractions of a second. NSDateComponents is all
|
||||
// NSInteger based, so it can't handle a fraction of a second. NSDate is
|
||||
// built on NSTimeInterval so it has sub-millisecond precision. GTL takes
|
||||
// the compromise of supporting the RFC's optional fractional second support
|
||||
// by maintaining a number of milliseconds past what fits in the
|
||||
// NSDateComponents. The parsing and string conversions will include
|
||||
// 3 decimal digits (hence milliseconds). When going to a string, the decimal
|
||||
// digits are only included if the milliseconds are non zero.
|
||||
|
||||
@dynamic date;
|
||||
@dynamic calendar;
|
||||
@dynamic RFC3339String;
|
||||
@dynamic stringValue;
|
||||
@dynamic timeZone;
|
||||
@dynamic hasTime;
|
||||
|
||||
@synthesize dateComponents = dateComponents_,
|
||||
milliseconds = milliseconds_,
|
||||
offsetSeconds = offsetSeconds_,
|
||||
universalTime = isUniversalTime_;
|
||||
|
||||
+ (void)initialize {
|
||||
// Note that initialize is guaranteed by the runtime to be called in a
|
||||
// thread-safe manner.
|
||||
if (gDashSet == nil) {
|
||||
gDashSet = [[NSCharacterSet characterSetWithCharactersInString:@"-"] retain];
|
||||
gTSet = [[NSCharacterSet characterSetWithCharactersInString:@"Tt "] retain];
|
||||
gColonSet = [[NSCharacterSet characterSetWithCharactersInString:@":"] retain];
|
||||
gPlusMinusZSet = [[NSCharacterSet characterSetWithCharactersInString:@"+-zZ"] retain];
|
||||
|
||||
gCalendarsForTimeZones = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithRFC3339String:(NSString *)str {
|
||||
if (str == nil) return nil;
|
||||
|
||||
GTLDateTime *result = [[[self alloc] init] autorelease];
|
||||
[result setFromRFC3339String:str];
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithDate:(NSDate *)date timeZone:(NSTimeZone *)tz {
|
||||
if (date == nil) return nil;
|
||||
|
||||
GTLDateTime *result = [[[self alloc] init] autorelease];
|
||||
[result setFromDate:date timeZone:tz];
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeForAllDayWithDate:(NSDate *)date {
|
||||
if (date == nil) return nil;
|
||||
|
||||
GTLDateTime *result = [[[self alloc] init] autorelease];
|
||||
[result setFromDate:date timeZone:nil];
|
||||
result.hasTime = NO;
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (GTLDateTime *)dateTimeWithDateComponents:(NSDateComponents *)components {
|
||||
NSCalendar *cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
|
||||
NSDate *date = [cal dateFromComponents:components];
|
||||
#if GTL_IPHONE
|
||||
NSTimeZone *tz = [components timeZone];
|
||||
#else
|
||||
// NSDateComponents added timeZone: in Mac OS X 10.7.
|
||||
NSTimeZone *tz = nil;
|
||||
if ([components respondsToSelector:@selector(timeZone)]) {
|
||||
tz = [components timeZone];
|
||||
}
|
||||
#endif
|
||||
return [self dateTimeWithDate:date timeZone:tz];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[dateComponents_ release];
|
||||
[timeZone_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
// Object is immutable
|
||||
return [self retain];
|
||||
}
|
||||
|
||||
// until NSDateComponent implements isEqual, we'll use this
|
||||
- (BOOL)doesDateComponents:(NSDateComponents *)dc1
|
||||
equalDateComponents:(NSDateComponents *)dc2 {
|
||||
|
||||
return [dc1 era] == [dc2 era]
|
||||
&& [dc1 year] == [dc2 year]
|
||||
&& [dc1 month] == [dc2 month]
|
||||
&& [dc1 day] == [dc2 day]
|
||||
&& [dc1 hour] == [dc2 hour]
|
||||
&& [dc1 minute] == [dc2 minute]
|
||||
&& [dc1 second] == [dc2 second]
|
||||
&& [dc1 week] == [dc2 week]
|
||||
&& [dc1 weekday] == [dc2 weekday]
|
||||
&& [dc1 weekdayOrdinal] == [dc2 weekdayOrdinal];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(GTLDateTime *)other {
|
||||
|
||||
if (self == other) return YES;
|
||||
if (![other isKindOfClass:[GTLDateTime class]]) return NO;
|
||||
|
||||
BOOL areDateComponentsEqual = [self doesDateComponents:self.dateComponents
|
||||
equalDateComponents:other.dateComponents];
|
||||
NSTimeZone *tz1 = self.timeZone;
|
||||
NSTimeZone *tz2 = other.timeZone;
|
||||
BOOL areTimeZonesEqual = (tz1 == tz2 || (tz2 && [tz1 isEqual:tz2]));
|
||||
|
||||
return self.offsetSeconds == other.offsetSeconds
|
||||
&& self.isUniversalTime == other.isUniversalTime
|
||||
&& self.milliseconds == other.milliseconds
|
||||
&& areDateComponentsEqual
|
||||
&& areTimeZonesEqual;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@ %p: {%@}",
|
||||
[self class], self, self.RFC3339String];
|
||||
}
|
||||
|
||||
- (NSTimeZone *)timeZone {
|
||||
if (timeZone_) {
|
||||
return timeZone_;
|
||||
}
|
||||
|
||||
if (self.isUniversalTime) {
|
||||
NSTimeZone *ztz = [NSTimeZone timeZoneWithName:@"Universal"];
|
||||
return ztz;
|
||||
}
|
||||
|
||||
NSInteger offsetSeconds = self.offsetSeconds;
|
||||
|
||||
if (offsetSeconds != NSUndefinedDateComponent) {
|
||||
NSTimeZone *tz = [NSTimeZone timeZoneForSecondsFromGMT:offsetSeconds];
|
||||
return tz;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setTimeZone:(NSTimeZone *)timeZone {
|
||||
[timeZone_ release];
|
||||
timeZone_ = [timeZone retain];
|
||||
|
||||
if (timeZone) {
|
||||
NSInteger offsetSeconds = [timeZone secondsFromGMTForDate:self.date];
|
||||
self.offsetSeconds = offsetSeconds;
|
||||
} else {
|
||||
self.offsetSeconds = NSUndefinedDateComponent;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSCalendar *)calendarForTimeZone:(NSTimeZone *)tz {
|
||||
NSCalendar *cal = nil;
|
||||
@synchronized(gCalendarsForTimeZones) {
|
||||
id tzKey = (tz ? tz : [NSNull null]);
|
||||
cal = [gCalendarsForTimeZones objectForKey:tzKey];
|
||||
if (cal == nil) {
|
||||
cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
|
||||
if (tz) {
|
||||
[cal setTimeZone:tz];
|
||||
}
|
||||
[gCalendarsForTimeZones setObject:cal forKey:tzKey];
|
||||
}
|
||||
}
|
||||
return cal;
|
||||
}
|
||||
|
||||
- (NSCalendar *)calendar {
|
||||
NSTimeZone *tz = self.timeZone;
|
||||
return [self calendarForTimeZone:tz];
|
||||
}
|
||||
|
||||
- (NSDate *)date {
|
||||
NSDateComponents *dateComponents = self.dateComponents;
|
||||
NSTimeInterval extraMillisecondsAsSeconds = 0.0;
|
||||
NSCalendar *cal;
|
||||
|
||||
if (!self.hasTime) {
|
||||
// We're not keeping track of a time, but NSDate always is based on
|
||||
// an absolute time. We want to avoid returning an NSDate where the
|
||||
// calendar date appears different from what was used to create our
|
||||
// date-time object.
|
||||
//
|
||||
// We'll make a copy of the date components, setting the time on our
|
||||
// copy to noon GMT, since that ensures the date renders correctly for
|
||||
// any time zone.
|
||||
NSDateComponents *noonDateComponents = [[dateComponents copy] autorelease];
|
||||
[noonDateComponents setHour:12];
|
||||
[noonDateComponents setMinute:0];
|
||||
[noonDateComponents setSecond:0];
|
||||
dateComponents = noonDateComponents;
|
||||
|
||||
NSTimeZone *gmt = [NSTimeZone timeZoneWithName:@"Universal"];
|
||||
cal = [self calendarForTimeZone:gmt];
|
||||
} else {
|
||||
cal = self.calendar;
|
||||
|
||||
// Add in the fractional seconds that don't fit into NSDateComponents.
|
||||
extraMillisecondsAsSeconds = ((NSTimeInterval)self.milliseconds) / 1000.0;
|
||||
}
|
||||
|
||||
NSDate *date = [cal dateFromComponents:dateComponents];
|
||||
|
||||
// Add in any milliseconds that didn't fit into the dateComponents.
|
||||
if (extraMillisecondsAsSeconds > 0.0) {
|
||||
#if GTL_IPHONE || (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5)
|
||||
date = [date dateByAddingTimeInterval:extraMillisecondsAsSeconds];
|
||||
#else
|
||||
date = [date addTimeInterval:extraMillisecondsAsSeconds];
|
||||
#endif
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue {
|
||||
return self.RFC3339String;
|
||||
}
|
||||
|
||||
- (NSString *)RFC3339String {
|
||||
NSDateComponents *dateComponents = self.dateComponents;
|
||||
NSInteger offset = self.offsetSeconds;
|
||||
|
||||
NSString *timeString = @""; // timeString like "T15:10:46-08:00"
|
||||
|
||||
if (self.hasTime) {
|
||||
|
||||
NSString *timeOffsetString; // timeOffsetString like "-08:00"
|
||||
|
||||
if (self.isUniversalTime) {
|
||||
timeOffsetString = @"Z";
|
||||
} else if (offset == NSUndefinedDateComponent) {
|
||||
// unknown offset is rendered as -00:00 per
|
||||
// http://www.ietf.org/rfc/rfc3339.txt section 4.3
|
||||
timeOffsetString = @"-00:00";
|
||||
} else {
|
||||
NSString *sign = @"+";
|
||||
if (offset < 0) {
|
||||
sign = @"-";
|
||||
offset = -offset;
|
||||
}
|
||||
timeOffsetString = [NSString stringWithFormat:@"%@%02ld:%02ld",
|
||||
sign, (long)(offset/(60*60)) % 24, (long)(offset / 60) % 60];
|
||||
}
|
||||
|
||||
NSString *fractionalSecondsString = @"";
|
||||
if (self.milliseconds > 0.0) {
|
||||
fractionalSecondsString = [NSString stringWithFormat:@".%03ld", (long)self.milliseconds];
|
||||
}
|
||||
|
||||
timeString = [NSString stringWithFormat:@"T%02ld:%02ld:%02ld%@%@",
|
||||
(long)[dateComponents hour], (long)[dateComponents minute],
|
||||
(long)[dateComponents second], fractionalSecondsString, timeOffsetString];
|
||||
}
|
||||
|
||||
// full dateString like "2006-11-17T15:10:46-08:00"
|
||||
NSString *dateString = [NSString stringWithFormat:@"%04ld-%02ld-%02ld%@",
|
||||
(long)[dateComponents year], (long)[dateComponents month],
|
||||
(long)[dateComponents day], timeString];
|
||||
|
||||
return dateString;
|
||||
}
|
||||
|
||||
- (void)setFromDate:(NSDate *)date timeZone:(NSTimeZone *)tz {
|
||||
NSCalendar *cal = [self calendarForTimeZone:tz];
|
||||
|
||||
NSUInteger const kComponentBits = (NSYearCalendarUnit | NSMonthCalendarUnit
|
||||
| NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit
|
||||
| NSSecondCalendarUnit);
|
||||
|
||||
NSDateComponents *components = [cal components:kComponentBits fromDate:date];
|
||||
self.dateComponents = components;
|
||||
|
||||
// Extract the fractional seconds.
|
||||
NSTimeInterval asTimeInterval = [date timeIntervalSince1970];
|
||||
NSTimeInterval worker = asTimeInterval - trunc(asTimeInterval);
|
||||
self.milliseconds = (NSInteger)round(worker * 1000.0);
|
||||
|
||||
self.universalTime = NO;
|
||||
|
||||
NSInteger offset = NSUndefinedDateComponent;
|
||||
|
||||
if (tz) {
|
||||
offset = [tz secondsFromGMTForDate:date];
|
||||
|
||||
if (offset == 0 && [tz isEqualToTimeZone:[NSTimeZone timeZoneWithName:@"Universal"]]) {
|
||||
self.universalTime = YES;
|
||||
}
|
||||
}
|
||||
self.offsetSeconds = offset;
|
||||
|
||||
// though offset seconds are authoritative, we'll retain the time zone
|
||||
// since we can't regenerate it reliably from just the offset
|
||||
timeZone_ = [tz retain];
|
||||
}
|
||||
|
||||
- (void)setFromRFC3339String:(NSString *)str {
|
||||
|
||||
NSInteger year = NSUndefinedDateComponent;
|
||||
NSInteger month = NSUndefinedDateComponent;
|
||||
NSInteger day = NSUndefinedDateComponent;
|
||||
NSInteger hour = NSUndefinedDateComponent;
|
||||
NSInteger minute = NSUndefinedDateComponent;
|
||||
NSInteger sec = NSUndefinedDateComponent;
|
||||
NSInteger milliseconds = 0;
|
||||
double secDouble = -1.0;
|
||||
NSString* sign = nil;
|
||||
NSInteger offsetHour = 0;
|
||||
NSInteger offsetMinute = 0;
|
||||
|
||||
if ([str length] > 0) {
|
||||
NSScanner* scanner = [NSScanner scannerWithString:str];
|
||||
// There should be no whitespace, so no skip characters.
|
||||
[scanner setCharactersToBeSkipped:nil];
|
||||
|
||||
// for example, scan 2006-11-17T15:10:46-08:00
|
||||
// or 2006-11-17T15:10:46Z
|
||||
if (// yyyy-mm-dd
|
||||
[scanner scanInteger:&year] &&
|
||||
[scanner scanCharactersFromSet:gDashSet intoString:NULL] &&
|
||||
[scanner scanInteger:&month] &&
|
||||
[scanner scanCharactersFromSet:gDashSet intoString:NULL] &&
|
||||
[scanner scanInteger:&day] &&
|
||||
// Thh:mm:ss
|
||||
[scanner scanCharactersFromSet:gTSet intoString:NULL] &&
|
||||
[scanner scanInteger:&hour] &&
|
||||
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
|
||||
[scanner scanInteger:&minute] &&
|
||||
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
|
||||
[scanner scanDouble:&secDouble]) {
|
||||
|
||||
// At this point we got secDouble, pull it apart.
|
||||
sec = (NSInteger)secDouble;
|
||||
double worker = secDouble - ((double)sec);
|
||||
milliseconds = (NSInteger)round(worker * 1000.0);
|
||||
|
||||
// Finish parsing, now the offset info.
|
||||
if (// Z or +hh:mm
|
||||
[scanner scanCharactersFromSet:gPlusMinusZSet intoString:&sign] &&
|
||||
[scanner scanInteger:&offsetHour] &&
|
||||
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
|
||||
[scanner scanInteger:&offsetMinute]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSDateComponents *dateComponents = [[[NSDateComponents alloc] init] autorelease];
|
||||
[dateComponents setYear:year];
|
||||
[dateComponents setMonth:month];
|
||||
[dateComponents setDay:day];
|
||||
[dateComponents setHour:hour];
|
||||
[dateComponents setMinute:minute];
|
||||
[dateComponents setSecond:sec];
|
||||
|
||||
self.dateComponents = dateComponents;
|
||||
self.milliseconds = milliseconds;
|
||||
|
||||
// determine the offset, like from Z, or -08:00:00.0
|
||||
|
||||
self.timeZone = nil;
|
||||
|
||||
NSInteger totalOffset = NSUndefinedDateComponent;
|
||||
self.universalTime = NO;
|
||||
|
||||
if ([sign caseInsensitiveCompare:@"Z"] == NSOrderedSame) {
|
||||
|
||||
self.universalTime = YES;
|
||||
totalOffset = 0;
|
||||
|
||||
} else if (sign != nil) {
|
||||
|
||||
totalOffset = (60 * offsetMinute) + (60 * 60 * offsetHour);
|
||||
|
||||
if ([sign isEqual:@"-"]) {
|
||||
|
||||
if (totalOffset == 0) {
|
||||
// special case: offset of -0.00 means undefined offset
|
||||
totalOffset = NSUndefinedDateComponent;
|
||||
} else {
|
||||
totalOffset *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.offsetSeconds = totalOffset;
|
||||
}
|
||||
|
||||
- (BOOL)hasTime {
|
||||
NSDateComponents *dateComponents = self.dateComponents;
|
||||
|
||||
BOOL hasTime = ([dateComponents hour] != NSUndefinedDateComponent
|
||||
&& [dateComponents minute] != NSUndefinedDateComponent);
|
||||
|
||||
return hasTime;
|
||||
}
|
||||
|
||||
- (void)setHasTime:(BOOL)shouldHaveTime {
|
||||
|
||||
// we'll set time values to zero or NSUndefinedDateComponent as appropriate
|
||||
BOOL hadTime = self.hasTime;
|
||||
|
||||
if (shouldHaveTime && !hadTime) {
|
||||
[dateComponents_ setHour:0];
|
||||
[dateComponents_ setMinute:0];
|
||||
[dateComponents_ setSecond:0];
|
||||
milliseconds_ = 0;
|
||||
offsetSeconds_ = NSUndefinedDateComponent;
|
||||
isUniversalTime_ = NO;
|
||||
|
||||
} else if (hadTime && !shouldHaveTime) {
|
||||
[dateComponents_ setHour:NSUndefinedDateComponent];
|
||||
[dateComponents_ setMinute:NSUndefinedDateComponent];
|
||||
[dateComponents_ setSecond:NSUndefinedDateComponent];
|
||||
milliseconds_ = 0;
|
||||
offsetSeconds_ = NSUndefinedDateComponent;
|
||||
isUniversalTime_ = NO;
|
||||
self.timeZone = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,144 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLDefines.h
|
||||
//
|
||||
|
||||
// Ensure Apple's conditionals we depend on are defined.
|
||||
#import <TargetConditionals.h>
|
||||
#import <AvailabilityMacros.h>
|
||||
|
||||
//
|
||||
// The developer may choose to define these in the project:
|
||||
//
|
||||
// #define GTL_TARGET_NAMESPACE Xxx // preface all GTL class names with Xxx (recommended for building plug-ins)
|
||||
// #define GTL_FOUNDATION_ONLY 1 // builds without AppKit or Carbon (default for iPhone builds)
|
||||
// #define STRIP_GTM_FETCH_LOGGING 1 // omit http logging code (default for iPhone release builds)
|
||||
//
|
||||
// Mac developers may find GTL_SIMPLE_DESCRIPTIONS and STRIP_GTM_FETCH_LOGGING useful for
|
||||
// reducing code size.
|
||||
//
|
||||
|
||||
// Define later OS versions when building on earlier versions
|
||||
#ifdef MAC_OS_X_VERSION_10_0
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GTL_TARGET_NAMESPACE
|
||||
// prefix all GTL class names with GTL_TARGET_NAMESPACE for this target
|
||||
#import "GTLTargetNamespace.h"
|
||||
#endif
|
||||
|
||||
// Provide a common definition for externing constants/functions
|
||||
#if defined(__cplusplus)
|
||||
#define GTL_EXTERN extern "C"
|
||||
#else
|
||||
#define GTL_EXTERN extern
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE // iPhone SDK
|
||||
|
||||
#define GTL_IPHONE 1
|
||||
|
||||
#endif
|
||||
|
||||
#if GTL_IPHONE
|
||||
|
||||
#define GTL_FOUNDATION_ONLY 1
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// GTL_ASSERT is like NSAssert, but takes a variable number of arguments:
|
||||
//
|
||||
// GTL_ASSERT(condition, @"Problem in argument %@", argStr);
|
||||
//
|
||||
// GTL_DEBUG_ASSERT is similar, but compiles in only for debug builds
|
||||
//
|
||||
|
||||
#ifndef GTL_ASSERT
|
||||
// we directly invoke the NSAssert handler so we can pass on the varargs
|
||||
#if !defined(NS_BLOCK_ASSERTIONS)
|
||||
#define GTL_ASSERT(condition, ...) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
[[NSAssertionHandler currentHandler] \
|
||||
handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
|
||||
file:[NSString stringWithUTF8String:__FILE__] \
|
||||
lineNumber:__LINE__ \
|
||||
description:__VA_ARGS__]; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define GTL_ASSERT(condition, ...) do { } while (0)
|
||||
#endif // !defined(NS_BLOCK_ASSERTIONS)
|
||||
#endif // GTL_ASSERT
|
||||
|
||||
#ifndef GTL_DEBUG_ASSERT
|
||||
#if DEBUG
|
||||
#define GTL_DEBUG_ASSERT(condition, ...) GTL_ASSERT(condition, __VA_ARGS__)
|
||||
#else
|
||||
#define GTL_DEBUG_ASSERT(condition, ...) do { } while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GTL_DEBUG_LOG
|
||||
#if DEBUG
|
||||
#define GTL_DEBUG_LOG(...) NSLog(__VA_ARGS__)
|
||||
#else
|
||||
#define GTL_DEBUG_LOG(...) do { } while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef STRIP_GTM_FETCH_LOGGING
|
||||
#if GTL_IPHONE && !DEBUG
|
||||
#define STRIP_GTM_FETCH_LOGGING 1
|
||||
#else
|
||||
#define STRIP_GTM_FETCH_LOGGING 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Some support for advanced clang static analysis functionality
|
||||
// See http://clang-analyzer.llvm.org/annotations.html
|
||||
#ifndef __has_feature // Optional.
|
||||
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
|
||||
#endif
|
||||
#ifndef NS_RETURNS_NOT_RETAINED
|
||||
#if __has_feature(attribute_ns_returns_not_retained)
|
||||
#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
|
||||
#else
|
||||
#define NS_RETURNS_NOT_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
// We will start using nonnull declarations once the static analyzer seems
|
||||
// to support it without false positives.
|
||||
#define GTL_NONNULL(x)
|
||||
#else
|
||||
#if __has_attribute(nonnull)
|
||||
#define GTL_NONNULL(x) __attribute__((nonnull x))
|
||||
#else
|
||||
#define GTL_NONNULL(x)
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLErrorObject.h
|
||||
//
|
||||
|
||||
#import "GTLObject.h"
|
||||
|
||||
@class GTLErrorObjectData;
|
||||
|
||||
@interface GTLErrorObject : GTLObject
|
||||
@property (retain) NSNumber *code;
|
||||
@property (retain) NSString *message;
|
||||
@property (retain) NSArray *data; // of GTLErrorObjectData
|
||||
|
||||
// Convenience accessor for creating an NSError from a GTLErrorObject.
|
||||
@property (readonly) NSError *foundationError;
|
||||
|
||||
// Convenience accessor for extracting the GTLErrorObject that was used to
|
||||
// create an NSError.
|
||||
//
|
||||
// Returns nil if the error was not originally from a GTLErrorObject.
|
||||
+ (GTLErrorObject *)underlyingObjectForError:(NSError *)foundationError;
|
||||
|
||||
@end
|
||||
|
||||
@interface GTLErrorObjectData : GTLObject
|
||||
@property (retain) NSString *domain;
|
||||
@property (retain) NSString *reason;
|
||||
@property (retain) NSString *message;
|
||||
@property (retain) NSString *location;
|
||||
@end
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLErrorObject.m
|
||||
//
|
||||
|
||||
#import "GTLErrorObject.h"
|
||||
#import "GTLService.h"
|
||||
|
||||
@implementation GTLErrorObject
|
||||
|
||||
@dynamic code;
|
||||
@dynamic message;
|
||||
@dynamic data;
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map = [NSDictionary dictionaryWithObject:[GTLErrorObjectData class]
|
||||
forKey:@"data"];
|
||||
return map;
|
||||
}
|
||||
|
||||
- (NSError *)foundationError {
|
||||
NSMutableDictionary *userInfo;
|
||||
|
||||
// This structured GTLErrorObject will be available in the error's userInfo
|
||||
// dictionary
|
||||
userInfo = [NSMutableDictionary dictionaryWithObject:self
|
||||
forKey:kGTLStructuredErrorKey];
|
||||
|
||||
NSString *reasonStr = self.message;
|
||||
if (reasonStr) {
|
||||
// We always store an error in the userInfo key "error"
|
||||
[userInfo setObject:reasonStr
|
||||
forKey:kGTLServerErrorStringKey];
|
||||
|
||||
// Store a user-readable "reason" to show up when an error is logged,
|
||||
// in parentheses like NSError does it
|
||||
NSString *parenthesized = [NSString stringWithFormat:@"(%@)", reasonStr];
|
||||
[userInfo setObject:parenthesized
|
||||
forKey:NSLocalizedFailureReasonErrorKey];
|
||||
}
|
||||
|
||||
NSInteger code = [self.code integerValue];
|
||||
NSError *error = [NSError errorWithDomain:kGTLJSONRPCErrorDomain
|
||||
code:code
|
||||
userInfo:userInfo];
|
||||
return error;
|
||||
}
|
||||
|
||||
+ (GTLErrorObject *)underlyingObjectForError:(NSError *)foundationError {
|
||||
NSDictionary *userInfo = [foundationError userInfo];
|
||||
GTLErrorObject *errorObj = [userInfo objectForKey:kGTLStructuredErrorKey];
|
||||
return errorObj;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTLErrorObjectData
|
||||
@dynamic domain;
|
||||
@dynamic reason;
|
||||
@dynamic message;
|
||||
@dynamic location;
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _GTLFRAMEWORK_H_
|
||||
#define _GTLFRAMEWORK_H_
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTLDefines.h"
|
||||
|
||||
|
||||
// Returns the version of the framework. Major and minor should
|
||||
// match the bundle version in the Info.plist file.
|
||||
//
|
||||
// Pass NULL to ignore any of the parameters.
|
||||
|
||||
void GTLFrameworkVersion(NSUInteger* major, NSUInteger* minor, NSUInteger* release);
|
||||
|
||||
// Returns the version in @"a.b" or @"a.b.c" format
|
||||
NSString *GTLFrameworkVersionString(void);
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "GTLFramework.h"
|
||||
|
||||
void GTLFrameworkVersion(NSUInteger* major, NSUInteger* minor, NSUInteger* release) {
|
||||
// version 2.0.0
|
||||
if (major) *major = 2;
|
||||
if (minor) *minor = 0;
|
||||
if (release) *release = 0;
|
||||
}
|
||||
|
||||
NSString *GTLFrameworkVersionString(void) {
|
||||
NSUInteger major, minor, release;
|
||||
NSString *libVersionString;
|
||||
|
||||
GTLFrameworkVersion(&major, &minor, &release);
|
||||
|
||||
// most library releases will have a release value of zero
|
||||
if (release != 0) {
|
||||
libVersionString = [NSString stringWithFormat:@"%d.%d.%d",
|
||||
(int)major, (int)minor, (int)release];
|
||||
} else {
|
||||
libVersionString = [NSString stringWithFormat:@"%d.%d",
|
||||
(int)major, (int)minor];
|
||||
}
|
||||
return libVersionString;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLJSONParser.h
|
||||
//
|
||||
|
||||
// This class is a thin wrapper around the JSON parser. It uses
|
||||
// NSJSONSerialization when available, and SBJSON otherwise.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTLDefines.h"
|
||||
|
||||
@interface GTLJSONParser : NSObject
|
||||
+ (NSString*)stringWithObject:(id)value
|
||||
humanReadable:(BOOL)humanReadable
|
||||
error:(NSError**)error;
|
||||
|
||||
+ (NSData *)dataWithObject:(id)obj
|
||||
humanReadable:(BOOL)humanReadable
|
||||
error:(NSError**)error;
|
||||
|
||||
+ (id)objectWithString:(NSString *)jsonStr
|
||||
error:(NSError **)error;
|
||||
|
||||
+ (id)objectWithData:(NSData *)jsonData
|
||||
error:(NSError **)error;
|
||||
@end
|
||||
@@ -1,150 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLJSONParser.m
|
||||
//
|
||||
|
||||
#import "GTLJSONParser.h"
|
||||
|
||||
// We can assume NSJSONSerialization is present on Mac OS X 10.7 and iOS 5
|
||||
#if !defined(GTL_REQUIRES_NSJSONSERIALIZATION)
|
||||
#if (!TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) || \
|
||||
(TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED >= 50000))
|
||||
#define GTL_REQUIRES_NSJSONSERIALIZATION 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If GTMNSJSONSerialization is available, it is used for parsing and
|
||||
// formatting JSON
|
||||
#if !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
@interface GTMNSJSONSerialization : NSObject
|
||||
+ (NSData *)dataWithJSONObject:(id)obj options:(NSUInteger)opt error:(NSError **)error;
|
||||
+ (id)JSONObjectWithData:(NSData *)data options:(NSUInteger)opt error:(NSError **)error;
|
||||
@end
|
||||
|
||||
// As a fallback, SBJSON is used for parsing and formatting JSON
|
||||
@interface GTLSBJSON
|
||||
- (void)setHumanReadable:(BOOL)flag;
|
||||
- (NSString*)stringWithObject:(id)value error:(NSError**)error;
|
||||
- (id)objectWithString:(NSString*)jsonrep error:(NSError**)error;
|
||||
@end
|
||||
#endif // !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
|
||||
@implementation GTLJSONParser
|
||||
|
||||
#if DEBUG && !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
// When compiling for iOS 4 compatibility, SBJSON must be available
|
||||
+ (void)load {
|
||||
Class writer = NSClassFromString(@"SBJsonWriter");
|
||||
Class parser = NSClassFromString(@"SBJsonParser");
|
||||
Class oldParser = NSClassFromString(@"SBJSON");
|
||||
GTL_ASSERT((oldParser != Nil)
|
||||
|| (writer != Nil && parser != Nil),
|
||||
@"No parsing class found");
|
||||
}
|
||||
#endif // DEBUG && !GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
|
||||
+ (NSString*)stringWithObject:(id)obj
|
||||
humanReadable:(BOOL)humanReadable
|
||||
error:(NSError**)error {
|
||||
NSData *data = [self dataWithObject:obj
|
||||
humanReadable:humanReadable
|
||||
error:error];
|
||||
if (data) {
|
||||
NSString *jsonStr = [[[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
return jsonStr;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSData *)dataWithObject:(id)obj
|
||||
humanReadable:(BOOL)humanReadable
|
||||
error:(NSError**)error {
|
||||
const NSUInteger kOpts = humanReadable ? (1UL << 0) : 0; // NSJSONWritingPrettyPrinted
|
||||
|
||||
#if GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
NSData *data = [NSJSONSerialization dataWithJSONObject:obj
|
||||
options:kOpts
|
||||
error:error];
|
||||
return data;
|
||||
#else
|
||||
Class serializer = NSClassFromString(@"NSJSONSerialization");
|
||||
if (serializer) {
|
||||
NSData *data = [serializer dataWithJSONObject:obj
|
||||
options:kOpts
|
||||
error:error];
|
||||
return data;
|
||||
} else {
|
||||
Class jsonWriteClass = NSClassFromString(@"SBJsonWriter");
|
||||
if (!jsonWriteClass) {
|
||||
jsonWriteClass = NSClassFromString(@"SBJSON");
|
||||
}
|
||||
|
||||
if (error) *error = nil;
|
||||
|
||||
GTLSBJSON *writer = [[[jsonWriteClass alloc] init] autorelease];
|
||||
[writer setHumanReadable:humanReadable];
|
||||
NSString *jsonStr = [writer stringWithObject:obj
|
||||
error:error];
|
||||
NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (id)objectWithString:(NSString *)jsonStr
|
||||
error:(NSError **)error {
|
||||
NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
|
||||
return [self objectWithData:data
|
||||
error:error];
|
||||
}
|
||||
|
||||
+ (id)objectWithData:(NSData *)jsonData
|
||||
error:(NSError **)error {
|
||||
#if GTL_REQUIRES_NSJSONSERIALIZATION
|
||||
NSMutableDictionary *obj = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||
options:NSJSONReadingMutableContainers
|
||||
error:error];
|
||||
return obj;
|
||||
#else
|
||||
Class serializer = NSClassFromString(@"NSJSONSerialization");
|
||||
if (serializer) {
|
||||
const NSUInteger kOpts = (1UL << 0); // NSJSONReadingMutableContainers
|
||||
NSMutableDictionary *obj = [serializer JSONObjectWithData:jsonData
|
||||
options:kOpts
|
||||
error:error];
|
||||
return obj;
|
||||
} else {
|
||||
Class jsonParseClass = NSClassFromString(@"SBJsonParser");
|
||||
if (!jsonParseClass) {
|
||||
jsonParseClass = NSClassFromString(@"SBJSON");
|
||||
}
|
||||
|
||||
if (error) *error = nil;
|
||||
|
||||
GTLSBJSON *parser = [[[jsonParseClass alloc] init] autorelease];
|
||||
|
||||
NSString *jsonrep = [[[NSString alloc] initWithData:jsonData
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
id obj = [parser objectWithString:jsonrep
|
||||
error:error];
|
||||
return obj;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,208 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLObject.h
|
||||
//
|
||||
|
||||
// GTLObject documentation:
|
||||
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Objects_and_Queries
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTLDefines.h"
|
||||
#import "GTLUtilities.h"
|
||||
#import "GTLDateTime.h"
|
||||
|
||||
#undef _EXTERN
|
||||
#undef _INITIALIZE_AS
|
||||
#ifdef GTLOBJECT_DEFINE_GLOBALS
|
||||
#define _EXTERN
|
||||
#define _INITIALIZE_AS(x) =x
|
||||
#else
|
||||
#define _EXTERN extern
|
||||
#define _INITIALIZE_AS(x)
|
||||
#endif
|
||||
|
||||
@protocol GTLCollectionProtocol
|
||||
@optional
|
||||
@property (retain) NSArray *items;
|
||||
@end
|
||||
|
||||
@protocol GTLBatchItemCreationProtocol
|
||||
- (void)createItemsWithClassMap:(NSDictionary *)batchClassMap;
|
||||
@end
|
||||
|
||||
@interface GTLObject : NSObject <NSCopying> {
|
||||
|
||||
@private
|
||||
|
||||
NSMutableDictionary *json_;
|
||||
|
||||
// Used when creating the subobjects from this one.
|
||||
NSDictionary *surrogates_;
|
||||
|
||||
// Any complex object hung off this object goes into the cache so the
|
||||
// next fetch will get the same object back instead of having to recreate
|
||||
// it.
|
||||
NSMutableDictionary *childCache_;
|
||||
|
||||
// Anything defined by the client; retained but not used internally; not
|
||||
// copied by copyWithZone:
|
||||
NSMutableDictionary *userProperties_;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSMutableDictionary *JSON;
|
||||
@property (nonatomic, retain) NSDictionary *surrogates;
|
||||
@property (nonatomic, retain) NSMutableDictionary *userProperties;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Public methods
|
||||
//
|
||||
// These methods are intended for users of the library
|
||||
//
|
||||
|
||||
+ (id)object;
|
||||
+ (id)objectWithJSON:(NSMutableDictionary *)dict;
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone;
|
||||
|
||||
- (NSString *)JSONString;
|
||||
|
||||
// generic access to json; also creates it if necessary
|
||||
- (void)setJSONValue:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
|
||||
- (id)JSONValueForKey:(NSString *)key;
|
||||
|
||||
// Returns the list of keys in this object's JSON that aren't listed as
|
||||
// properties on the object.
|
||||
- (NSArray *)additionalJSONKeys;
|
||||
|
||||
// Any keys in the JSON that aren't listed as @properties on the object
|
||||
// are counted as "additional properties". These allow you to get/set them.
|
||||
- (id)additionalPropertyForName:(NSString *)name;
|
||||
- (void)setAdditionalProperty:(id)obj forName:(NSString *)name GTL_NONNULL((2));
|
||||
- (NSDictionary *)additionalProperties;
|
||||
|
||||
// User properties are supported for client convenience, but are not copied by
|
||||
// copyWithZone. User Properties keys beginning with _ are reserved by the library.
|
||||
//
|
||||
// Set nil for obj to remove the property.
|
||||
- (void)setProperty:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
|
||||
- (id)propertyForKey:(NSString *)key GTL_NONNULL((1));
|
||||
|
||||
// userData is stored as a property with key "_userData"
|
||||
- (void)setUserData:(id)obj;
|
||||
- (id)userData;
|
||||
|
||||
// Makes a partial query-compatible string describing the fields present
|
||||
// in this object. (Note: only the first element of any array is examined.)
|
||||
//
|
||||
// http://code.google.com/apis/tasks/v1/performance.html#partial
|
||||
//
|
||||
- (NSString *)fieldsDescription;
|
||||
|
||||
// Makes an object containing only the changes needed to do a partial update
|
||||
// (patch), where the patch would be to change an object from the original
|
||||
// to the receiver, such as
|
||||
//
|
||||
// GTLSomeObject *patchObject = [newVersion patchObjectFromOriginal:oldVersion];
|
||||
//
|
||||
// http://code.google.com/apis/tasks/v1/performance.html#patch
|
||||
//
|
||||
// NOTE: this method returns nil if there are no changes between the original
|
||||
// and the receiver.
|
||||
- (id)patchObjectFromOriginal:(GTLObject *)original;
|
||||
|
||||
// Method creating a null value to set object properties for patch queries that
|
||||
// delete fields. Do not use this except when setting an object property for
|
||||
// a patch query.
|
||||
+ (id)nullValue;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Protected methods
|
||||
//
|
||||
// These methods are intended for subclasses of GTLObject
|
||||
//
|
||||
|
||||
// class registration ("kind" strings) for subclasses
|
||||
+ (Class)registeredObjectClassForKind:(NSString *)kind;
|
||||
+ (void)registerObjectClassForKind:(NSString *)kind;
|
||||
|
||||
// creation of objects from a JSON dictionary
|
||||
+ (GTLObject *)objectForJSON:(NSMutableDictionary *)json
|
||||
defaultClass:(Class)defaultClass
|
||||
surrogates:(NSDictionary *)surrogates
|
||||
batchClassMap:(NSDictionary *)batchClassMap;
|
||||
|
||||
// property-to-key mapping (for JSON keys which are not used as method names)
|
||||
+ (NSDictionary *)propertyToJSONKeyMap;
|
||||
|
||||
// property-to-Class mapping for array properties (to say what is in the array)
|
||||
+ (NSDictionary *)arrayPropertyToClassMap;
|
||||
|
||||
// The default class for additional JSON keys
|
||||
+ (Class)classForAdditionalProperties;
|
||||
|
||||
@end
|
||||
|
||||
// Collection objects with an "items" property should derive from GTLCollection
|
||||
// object. This provides support for fast object enumeration, the
|
||||
// itemAtIndex: convenience method, and indexed subscripts.
|
||||
//
|
||||
// Subclasses must implement the items method dynamically.
|
||||
@interface GTLCollectionObject : GTLObject <GTLCollectionProtocol, NSFastEnumeration> {
|
||||
@private
|
||||
NSDictionary *identifierMap_;
|
||||
}
|
||||
|
||||
// itemAtIndex: and objectAtIndexedSubscript: return nil when the index exceeds
|
||||
// the bounds of the items array.
|
||||
- (id)itemAtIndex:(NSUInteger)idx;
|
||||
|
||||
- (id)objectAtIndexedSubscript:(NSInteger)idx;
|
||||
|
||||
// itemForIdentifier: looks up items from the collection object by identifier,
|
||||
// and returns the first one.
|
||||
//
|
||||
// Typically, items will have a unique identifier (with key "id" in the
|
||||
// object's JSON). This method returns the first item found in the collection
|
||||
// with the specified identifier.
|
||||
//
|
||||
// The first time this method is used, the collection will cache a map of
|
||||
// identifiers to items. If the items list for the instance somehow changes,
|
||||
// use the reset method below to force a new cache to be created for this
|
||||
// collection.
|
||||
- (id)itemForIdentifier:(NSString *)key GTL_NONNULL((1));
|
||||
|
||||
// Identifiers for all items are cached when the first one is obtained.
|
||||
// This method resets the cache. It is needed only if the item list has
|
||||
// changed.
|
||||
- (void)resetIdentifierMap;
|
||||
|
||||
@end
|
||||
|
||||
@interface GTLCollectionObject (DynamicMethods)
|
||||
- (NSArray *)items;
|
||||
@end
|
||||
|
||||
// Base object use for when an service method directly returns an array instead
|
||||
// of an object. Normally methods should return an object with an 'items'
|
||||
// property, but this exists for the methods not up to spec.
|
||||
@interface GTLResultArray : GTLCollectionObject
|
||||
// This method should only be called by subclasses.
|
||||
- (NSArray *)itemsWithItemClass:(Class)itemClass;
|
||||
@end
|
||||
@@ -1,722 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLObject.m
|
||||
//
|
||||
|
||||
#define GTLOBJECT_DEFINE_GLOBALS 1
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
#import "GTLObject.h"
|
||||
#import "GTLRuntimeCommon.h"
|
||||
#import "GTLJSONParser.h"
|
||||
|
||||
static NSString *const kUserDataPropertyKey = @"_userData";
|
||||
|
||||
@interface GTLObject () <GTLRuntimeCommon>
|
||||
+ (NSMutableArray *)allDeclaredProperties;
|
||||
+ (NSArray *)allKnownKeys;
|
||||
|
||||
+ (NSArray *)fieldsElementsForJSON:(NSDictionary *)targetJSON;
|
||||
+ (NSString *)fieldsDescriptionForJSON:(NSDictionary *)targetJSON;
|
||||
|
||||
+ (NSMutableDictionary *)patchDictionaryForJSON:(NSDictionary *)newJSON
|
||||
fromOriginalJSON:(NSDictionary *)originalJSON;
|
||||
@end
|
||||
|
||||
@implementation GTLObject
|
||||
|
||||
@synthesize JSON = json_,
|
||||
surrogates = surrogates_,
|
||||
userProperties = userProperties_;
|
||||
|
||||
+ (id)object {
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
+ (id)objectWithJSON:(NSMutableDictionary *)dict {
|
||||
GTLObject *obj = [self object];
|
||||
obj.JSON = dict;
|
||||
return obj;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (Class)classForAdditionalProperties {
|
||||
return Nil;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(GTLObject *)other {
|
||||
if (self == other) return YES;
|
||||
if (other == nil) return NO;
|
||||
|
||||
// The objects should be the same class, or one should be a subclass of the
|
||||
// other's class
|
||||
if (![other isKindOfClass:[self class]]
|
||||
&& ![self isKindOfClass:[other class]]) return NO;
|
||||
|
||||
// What we're not comparing here:
|
||||
// properties
|
||||
return GTL_AreEqualOrBothNil(json_, [other JSON]);
|
||||
}
|
||||
|
||||
// By definition, for two objects to potentially be considered equal,
|
||||
// they must have the same hash value. The hash is mostly ignored,
|
||||
// but removeObjectsInArray: in Leopard does seem to check the hash,
|
||||
// and NSObject's default hash method just returns the instance pointer.
|
||||
// We'll define hash here for all of our GTLObjects.
|
||||
- (NSUInteger)hash {
|
||||
return (NSUInteger) (void *) [GTLObject class];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLObject* newObject = [[[self class] allocWithZone:zone] init];
|
||||
CFPropertyListRef ref = CFPropertyListCreateDeepCopy(kCFAllocatorDefault,
|
||||
json_, kCFPropertyListMutableContainers);
|
||||
GTL_DEBUG_ASSERT(ref != NULL, @"GTLObject: copy failed (probably a non-plist type in the JSON)");
|
||||
newObject.JSON = [NSMakeCollectable(ref) autorelease];
|
||||
newObject.surrogates = self.surrogates;
|
||||
|
||||
// What we're not copying:
|
||||
// userProperties
|
||||
return newObject;
|
||||
}
|
||||
|
||||
- (NSString *)descriptionWithLocale:(id)locale {
|
||||
return [self description];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[json_ release];
|
||||
[surrogates_ release];
|
||||
[childCache_ release];
|
||||
[userProperties_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark JSON values
|
||||
|
||||
- (void)setJSONValue:(id)obj forKey:(NSString *)key {
|
||||
NSMutableDictionary *dict = self.JSON;
|
||||
if (dict == nil && obj != nil) {
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
self.JSON = dict;
|
||||
}
|
||||
[dict setValue:obj forKey:key];
|
||||
}
|
||||
|
||||
- (id)JSONValueForKey:(NSString *)key {
|
||||
id obj = [self.JSON objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (NSString *)JSONString {
|
||||
NSError *error = nil;
|
||||
NSString *str = [GTLJSONParser stringWithObject:[self JSON]
|
||||
humanReadable:YES
|
||||
error:&error];
|
||||
if (error) {
|
||||
return [error description];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
- (NSArray *)additionalJSONKeys {
|
||||
NSArray *knownKeys = [[self class] allKnownKeys];
|
||||
NSMutableArray *result = [NSMutableArray arrayWithArray:[json_ allKeys]];
|
||||
[result removeObjectsInArray:knownKeys];
|
||||
// Return nil instead of an empty array.
|
||||
if ([result count] == 0) {
|
||||
result = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Partial - Fields
|
||||
|
||||
- (NSString *)fieldsDescription {
|
||||
NSString *str = [GTLObject fieldsDescriptionForJSON:self.JSON];
|
||||
return str;
|
||||
}
|
||||
|
||||
+ (NSString *)fieldsDescriptionForJSON:(NSDictionary *)targetJSON {
|
||||
// Internal routine: recursively generate a string field description
|
||||
// by joining elements
|
||||
NSArray *array = [self fieldsElementsForJSON:targetJSON];
|
||||
NSString *str = [array componentsJoinedByString:@","];
|
||||
return str;
|
||||
}
|
||||
|
||||
+ (NSArray *)fieldsElementsForJSON:(NSDictionary *)targetJSON {
|
||||
// Internal routine: recursively generate an array of field description
|
||||
// element strings
|
||||
NSMutableArray *resultFields = [NSMutableArray array];
|
||||
|
||||
// Sorting the dictionary keys gives us deterministic results when iterating
|
||||
NSArray *sortedKeys = [[targetJSON allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||
for (NSString *key in sortedKeys) {
|
||||
// We'll build a comma-separated list of fields
|
||||
id value = [targetJSON objectForKey:key];
|
||||
if ([value isKindOfClass:[NSString class]]
|
||||
|| [value isKindOfClass:[NSNumber class]]) {
|
||||
// Basic type (string, number), so the key is what we want
|
||||
[resultFields addObject:key];
|
||||
} else if ([value isKindOfClass:[NSDictionary class]]) {
|
||||
// Object (dictionary): "parent/child1,parent/child2,parent/child3"
|
||||
NSArray *subElements = [self fieldsElementsForJSON:value];
|
||||
for (NSString *subElem in subElements) {
|
||||
NSString *prepended = [NSString stringWithFormat:@"%@/%@",
|
||||
key, subElem];
|
||||
[resultFields addObject:prepended];
|
||||
}
|
||||
} else if ([value isKindOfClass:[NSArray class]]) {
|
||||
// Array; we'll generate from the first array entry:
|
||||
// "parent(child1,child2,child3)"
|
||||
//
|
||||
// Open question: should this instead create the union of elements for
|
||||
// all items in the array, rather than just get fields from the first
|
||||
// array object?
|
||||
if ([(NSArray *)value count] > 0) {
|
||||
id firstObj = [value objectAtIndex:0];
|
||||
if ([firstObj isKindOfClass:[NSDictionary class]]) {
|
||||
// An array of objects
|
||||
NSString *contentsStr = [self fieldsDescriptionForJSON:firstObj];
|
||||
NSString *encapsulated = [NSString stringWithFormat:@"%@(%@)",
|
||||
key, contentsStr];
|
||||
[resultFields addObject:encapsulated];
|
||||
} else {
|
||||
// An array of some basic type, or of arrays
|
||||
[resultFields addObject:key];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GTL_ASSERT(0, @"GTLObject unknown field element for %@ (%@)",
|
||||
key, NSStringFromClass([value class]));
|
||||
}
|
||||
}
|
||||
return resultFields;
|
||||
}
|
||||
|
||||
#pragma mark Partial - Patch
|
||||
|
||||
- (id)patchObjectFromOriginal:(GTLObject *)original {
|
||||
id resultObj;
|
||||
NSMutableDictionary *resultJSON = [GTLObject patchDictionaryForJSON:self.JSON
|
||||
fromOriginalJSON:original.JSON];
|
||||
if ([resultJSON count] > 0) {
|
||||
resultObj = [[self class] objectWithJSON:resultJSON];
|
||||
} else {
|
||||
// Client apps should not attempt to patch with an object containing
|
||||
// empty JSON
|
||||
resultObj = nil;
|
||||
}
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
+ (NSMutableDictionary *)patchDictionaryForJSON:(NSDictionary *)newJSON
|
||||
fromOriginalJSON:(NSDictionary *)originalJSON {
|
||||
// Internal recursive routine to create an object suitable for
|
||||
// our patch semantics
|
||||
NSMutableDictionary *resultJSON = [NSMutableDictionary dictionary];
|
||||
|
||||
// Iterate through keys present in the old object
|
||||
NSArray *originalKeys = [originalJSON allKeys];
|
||||
for (NSString *key in originalKeys) {
|
||||
id originalValue = [originalJSON objectForKey:key];
|
||||
id newValue = [newJSON valueForKey:key];
|
||||
if (newValue == nil) {
|
||||
// There is no new value for this key, so set the value to NSNull
|
||||
[resultJSON setValue:[NSNull null] forKey:key];
|
||||
} else if (!GTL_AreEqualOrBothNil(originalValue, newValue)) {
|
||||
// The values for this key differ
|
||||
if ([originalValue isKindOfClass:[NSDictionary class]]
|
||||
&& [newValue isKindOfClass:[NSDictionary class]]) {
|
||||
// Both are objects; recurse
|
||||
NSMutableDictionary *subDict = [self patchDictionaryForJSON:newValue
|
||||
fromOriginalJSON:originalValue];
|
||||
[resultJSON setValue:subDict forKey:key];
|
||||
} else {
|
||||
// They are non-object values; the new replaces the old. Per the
|
||||
// documentation for patch, this replaces entire arrays.
|
||||
[resultJSON setValue:newValue forKey:key];
|
||||
}
|
||||
} else {
|
||||
// The values are the same; omit this key-value pair
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through keys present only in the new object, and add them to the
|
||||
// result
|
||||
NSMutableArray *newKeys = [NSMutableArray arrayWithArray:[newJSON allKeys]];
|
||||
[newKeys removeObjectsInArray:originalKeys];
|
||||
|
||||
for (NSString *key in newKeys) {
|
||||
id value = [newJSON objectForKey:key];
|
||||
[resultJSON setValue:value forKey:key];
|
||||
}
|
||||
return resultJSON;
|
||||
}
|
||||
|
||||
+ (id)nullValue {
|
||||
return [NSNull null];
|
||||
}
|
||||
|
||||
#pragma mark Additional Properties
|
||||
|
||||
- (id)additionalPropertyForName:(NSString *)name {
|
||||
// Return the cached object, if any, before creating one.
|
||||
id result = [self cacheChildForKey:name];
|
||||
if (result != nil) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Class defaultClass = [[self class] classForAdditionalProperties];
|
||||
id jsonObj = [self JSONValueForKey:name];
|
||||
BOOL shouldCache = NO;
|
||||
if (jsonObj != nil) {
|
||||
NSDictionary *surrogates = self.surrogates;
|
||||
result = [GTLRuntimeCommon objectFromJSON:jsonObj
|
||||
defaultClass:defaultClass
|
||||
surrogates:surrogates
|
||||
isCacheable:&shouldCache];
|
||||
}
|
||||
|
||||
[self setCacheChild:(shouldCache ? result : nil)
|
||||
forKey:name];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)setAdditionalProperty:(id)obj forName:(NSString *)name {
|
||||
BOOL shouldCache = NO;
|
||||
Class defaultClass = [[self class] classForAdditionalProperties];
|
||||
id json = [GTLRuntimeCommon jsonFromAPIObject:obj
|
||||
expectedClass:defaultClass
|
||||
isCacheable:&shouldCache];
|
||||
[self setJSONValue:json forKey:name];
|
||||
[self setCacheChild:(shouldCache ? obj : nil)
|
||||
forKey:name];
|
||||
}
|
||||
|
||||
- (NSDictionary *)additionalProperties {
|
||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||
|
||||
NSArray *propertyNames = [self additionalJSONKeys];
|
||||
for (NSString *name in propertyNames) {
|
||||
id obj = [self additionalPropertyForName:name];
|
||||
[result setObject:obj forKey:name];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Child Cache methods
|
||||
|
||||
// There is no property for childCache_ as there shouldn't be KVC/KVO
|
||||
// support for it, it's an implementation detail.
|
||||
|
||||
- (void)setCacheChild:(id)obj forKey:(NSString *)key {
|
||||
if (childCache_ == nil && obj != nil) {
|
||||
childCache_ = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
|
||||
obj, key, nil];
|
||||
} else {
|
||||
[childCache_ setValue:obj forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)cacheChildForKey:(NSString *)key {
|
||||
id obj = [childCache_ objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
#pragma mark userData and user properties
|
||||
|
||||
- (void)setUserData:(id)userData {
|
||||
[self setProperty:userData forKey:kUserDataPropertyKey];
|
||||
}
|
||||
|
||||
- (id)userData {
|
||||
// be sure the returned pointer has the life of the autorelease pool,
|
||||
// in case self is released immediately
|
||||
return [[[self propertyForKey:kUserDataPropertyKey] retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)setProperty:(id)obj forKey:(NSString *)key {
|
||||
if (obj == nil) {
|
||||
// user passed in nil, so delete the property
|
||||
[userProperties_ removeObjectForKey:key];
|
||||
} else {
|
||||
// be sure the property dictionary exists
|
||||
if (userProperties_ == nil) {
|
||||
self.userProperties = [NSMutableDictionary dictionary];
|
||||
}
|
||||
[userProperties_ setObject:obj forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)propertyForKey:(NSString *)key {
|
||||
id obj = [userProperties_ objectForKey:key];
|
||||
|
||||
// be sure the returned pointer has the life of the autorelease pool,
|
||||
// in case self is released immediately
|
||||
return [[obj retain] autorelease];
|
||||
}
|
||||
|
||||
#pragma mark Support methods
|
||||
|
||||
+ (NSMutableArray *)allDeclaredProperties {
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
||||
// walk from this class up the hierarchy to GTLObject
|
||||
Class topClass = class_getSuperclass([GTLObject class]);
|
||||
for (Class currClass = self;
|
||||
currClass != topClass;
|
||||
currClass = class_getSuperclass(currClass)) {
|
||||
// step through this class's properties, and add the property names to the
|
||||
// array
|
||||
objc_property_t *properties = class_copyPropertyList(currClass, NULL);
|
||||
if (properties) {
|
||||
for (objc_property_t *prop = properties;
|
||||
*prop != NULL;
|
||||
++prop) {
|
||||
const char *propName = property_getName(*prop);
|
||||
// We only want dynamic properties; their attributes contain ",D".
|
||||
const char *attr = property_getAttributes(*prop);
|
||||
const char *dynamicMarker = strstr(attr, ",D");
|
||||
if (dynamicMarker &&
|
||||
(dynamicMarker[2] == 0 || dynamicMarker[2] == ',' )) {
|
||||
[array addObject:[NSString stringWithUTF8String:propName]];
|
||||
}
|
||||
}
|
||||
free(properties);
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
+ (NSArray *)allKnownKeys {
|
||||
NSArray *allProps = [self allDeclaredProperties];
|
||||
NSMutableArray *knownKeys = [NSMutableArray arrayWithArray:allProps];
|
||||
|
||||
NSDictionary *propMap = [GTLObject propertyToJSONKeyMapForClass:[self class]];
|
||||
|
||||
NSUInteger idx = 0;
|
||||
for (NSString *propName in allProps) {
|
||||
NSString *jsonKey = [propMap objectForKey:propName];
|
||||
if (jsonKey) {
|
||||
[knownKeys replaceObjectAtIndex:idx
|
||||
withObject:jsonKey];
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
return knownKeys;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
// find the list of declared and otherwise known JSON keys for this class
|
||||
NSArray *knownKeys = [[self class] allKnownKeys];
|
||||
|
||||
NSMutableString *descStr = [NSMutableString string];
|
||||
|
||||
NSString *spacer = @"";
|
||||
for (NSString *key in json_) {
|
||||
NSString *value = nil;
|
||||
// show question mark for JSON keys not supported by a declared property:
|
||||
// foo?:"Hi mom."
|
||||
NSString *qmark = [knownKeys containsObject:key] ? @"" : @"?";
|
||||
|
||||
// determine property value to dislay
|
||||
id rawValue = [json_ valueForKey:key];
|
||||
if ([rawValue isKindOfClass:[NSDictionary class]]) {
|
||||
// for dictionaries, show the list of keys:
|
||||
// {key1,key2,key3}
|
||||
NSString *subkeyList = [[rawValue allKeys] componentsJoinedByString:@","];
|
||||
value = [NSString stringWithFormat:@"{%@}", subkeyList];
|
||||
} else if ([rawValue isKindOfClass:[NSArray class]]) {
|
||||
// for arrays, show the number of items in the array:
|
||||
// [3]
|
||||
value = [NSString stringWithFormat:@"[%lu]", (unsigned long)[(NSArray *)rawValue count]];
|
||||
} else if ([rawValue isKindOfClass:[NSString class]]) {
|
||||
// for strings, show the string in quotes:
|
||||
// "Hi mom."
|
||||
value = [NSString stringWithFormat:@"\"%@\"", rawValue];
|
||||
} else {
|
||||
// for numbers, show just the number
|
||||
value = [rawValue description];
|
||||
}
|
||||
[descStr appendFormat:@"%@%@%@:%@", spacer, key, qmark, value];
|
||||
spacer = @" ";
|
||||
}
|
||||
|
||||
NSString *str = [NSString stringWithFormat:@"%@ %p: {%@}",
|
||||
[self class], self, descStr];
|
||||
return str;
|
||||
}
|
||||
|
||||
#pragma mark Class Registration
|
||||
|
||||
static NSMutableDictionary *gKindMap = nil;
|
||||
|
||||
+ (Class)registeredObjectClassForKind:(NSString *)kind {
|
||||
Class resultClass = [gKindMap objectForKey:kind];
|
||||
return resultClass;
|
||||
}
|
||||
|
||||
+ (void)registerObjectClassForKind:(NSString *)kind {
|
||||
// there's no autorelease pool in place at +load time, so we'll create our own
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (gKindMap == nil) {
|
||||
gKindMap = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
|
||||
Class selfClass = [self class];
|
||||
|
||||
#if DEBUG
|
||||
// ensure this is a unique registration
|
||||
if ([gKindMap objectForKey:kind] != nil ) {
|
||||
GTL_DEBUG_LOG(@"%@ (%@) registration conflicts with %@",
|
||||
selfClass, kind, [gKindMap objectForKey:kind]);
|
||||
}
|
||||
if ([[gKindMap allKeysForObject:selfClass] count] != 0) {
|
||||
GTL_DEBUG_LOG(@"%@ (%@) registration conflicts with %@",
|
||||
selfClass, kind, [gKindMap allKeysForObject:selfClass]);
|
||||
}
|
||||
#endif
|
||||
|
||||
[gKindMap setValue:selfClass forKey:kind];
|
||||
|
||||
// we drain here to keep the clang static analyzer quiet
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
#pragma mark Object Instantiation
|
||||
|
||||
+ (GTLObject *)objectForJSON:(NSMutableDictionary *)json
|
||||
defaultClass:(Class)defaultClass
|
||||
surrogates:(NSDictionary *)surrogates
|
||||
batchClassMap:(NSDictionary *)batchClassMap {
|
||||
if ([json count] == 0 || [json isEqual:[NSNull null]]) {
|
||||
// no actual result, such as the response from a delete
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Determine the class to instantiate, based on the original fetch
|
||||
// request or by looking up "kind" string from the registration at
|
||||
// +load time of GTLObject subclasses
|
||||
//
|
||||
// We're letting the dynamic kind override the default class so
|
||||
// feeds of heterogenous entries can use the defaultClass as a
|
||||
// fallback
|
||||
Class classToCreate = defaultClass;
|
||||
NSString *kind = nil;
|
||||
if ([json isKindOfClass:[NSDictionary class]]) {
|
||||
kind = [json valueForKey:@"kind"];
|
||||
if ([kind isKindOfClass:[NSString class]] && [kind length] > 0) {
|
||||
Class dynamicClass = [GTLObject registeredObjectClassForKind:kind];
|
||||
if (dynamicClass) {
|
||||
classToCreate = dynamicClass;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Warn the developer that no specific class of GTLObject
|
||||
// was requested with the fetch call, and no class is found
|
||||
// compiled in to match the "kind" attribute of the JSON
|
||||
// returned by the server
|
||||
GTL_ASSERT(classToCreate != nil,
|
||||
@"Could not find registered GTLObject subclass to "
|
||||
"match JSON with kind \"%@\"", kind);
|
||||
|
||||
if (classToCreate == nil) {
|
||||
classToCreate = [self class];
|
||||
}
|
||||
|
||||
// See if the top-level class for the JSON is listed in the surrogates;
|
||||
// if so, instantiate the surrogate class instead
|
||||
Class baseSurrogate = [surrogates objectForKey:classToCreate];
|
||||
if (baseSurrogate) {
|
||||
classToCreate = baseSurrogate;
|
||||
}
|
||||
|
||||
// now instantiate the GTLObject
|
||||
GTLObject *parsedObject = [classToCreate object];
|
||||
|
||||
parsedObject.surrogates = surrogates;
|
||||
parsedObject.JSON = json;
|
||||
|
||||
// it's time to instantiate inner items
|
||||
if ([parsedObject conformsToProtocol:@protocol(GTLBatchItemCreationProtocol)]) {
|
||||
id <GTLBatchItemCreationProtocol> batch =
|
||||
(id <GTLBatchItemCreationProtocol>) parsedObject;
|
||||
[batch createItemsWithClassMap:batchClassMap];
|
||||
}
|
||||
|
||||
return parsedObject;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Utilities
|
||||
|
||||
static NSMutableDictionary *gJSONKeyMapCache = nil;
|
||||
static NSMutableDictionary *gArrayPropertyToClassMapCache = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
// Note that initialize is guaranteed by the runtime to be called in a
|
||||
// thread-safe manner
|
||||
if (gJSONKeyMapCache == nil) {
|
||||
gJSONKeyMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
if (gArrayPropertyToClassMapCache == nil) {
|
||||
gArrayPropertyToClassMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(propertyToJSONKeyMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLObject class]
|
||||
cache:gJSONKeyMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(arrayPropertyToClassMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLObject class]
|
||||
cache:gArrayPropertyToClassMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Support
|
||||
|
||||
+ (Class<GTLRuntimeCommon>)ancestorClass {
|
||||
return [GTLObject class];
|
||||
}
|
||||
|
||||
+ (BOOL)resolveInstanceMethod:(SEL)sel {
|
||||
BOOL resolved = [GTLRuntimeCommon resolveInstanceMethod:sel onClass:self];
|
||||
if (resolved)
|
||||
return YES;
|
||||
|
||||
return [super resolveInstanceMethod:sel];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTLCollectionObject
|
||||
// Subclasses must implement the items method dynamically.
|
||||
|
||||
- (void)dealloc {
|
||||
[identifierMap_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)itemAtIndex:(NSUInteger)idx {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
if (idx < [items count]) {
|
||||
return [items objectAtIndex:idx];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)objectAtIndexedSubscript:(NSInteger)idx {
|
||||
if (idx >= 0) {
|
||||
return [self itemAtIndex:(NSUInteger)idx];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)itemForIdentifier:(NSString *)key {
|
||||
if (identifierMap_ == nil) {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
NSMutableDictionary *dict =
|
||||
[NSMutableDictionary dictionaryWithCapacity:[items count]];
|
||||
for (id item in items) {
|
||||
id identifier = [item valueForKey:@"identifier"];
|
||||
if (identifier != nil && identifier != [NSNull null]) {
|
||||
if ([dict objectForKey:identifier] == nil) {
|
||||
[dict setObject:item forKey:identifier];
|
||||
}
|
||||
}
|
||||
}
|
||||
identifierMap_ = [dict copy];
|
||||
}
|
||||
return [identifierMap_ objectForKey:key];
|
||||
}
|
||||
|
||||
- (void)resetIdentifierMap {
|
||||
[identifierMap_ release];
|
||||
identifierMap_ = nil;
|
||||
}
|
||||
|
||||
// NSFastEnumeration protocol
|
||||
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
|
||||
objects:(id *)stackbuf
|
||||
count:(NSUInteger)len {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
NSUInteger result = [items countByEnumeratingWithState:state
|
||||
objects:stackbuf
|
||||
count:len];
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTLResultArray
|
||||
|
||||
- (NSArray *)itemsWithItemClass:(Class)itemClass {
|
||||
// Return the cached array before creating on demand.
|
||||
NSString *cacheKey = @"result_array_items";
|
||||
NSMutableArray *cachedArray = [self cacheChildForKey:cacheKey];
|
||||
if (cachedArray != nil) {
|
||||
return cachedArray;
|
||||
}
|
||||
NSArray *result = nil;
|
||||
NSArray *array = (NSArray *)[self JSON];
|
||||
if (array != nil) {
|
||||
if ([array isKindOfClass:[NSArray class]]) {
|
||||
NSDictionary *surrogates = self.surrogates;
|
||||
result = [GTLRuntimeCommon objectFromJSON:array
|
||||
defaultClass:itemClass
|
||||
surrogates:surrogates
|
||||
isCacheable:NULL];
|
||||
} else {
|
||||
#if DEBUG
|
||||
if (![array isKindOfClass:[NSNull class]]) {
|
||||
GTL_DEBUG_LOG(@"GTLObject: unexpected JSON: %@ should be an array, actually is a %@:\n%@",
|
||||
NSStringFromClass([self class]),
|
||||
NSStringFromClass([array class]),
|
||||
array);
|
||||
}
|
||||
#endif
|
||||
result = array;
|
||||
}
|
||||
}
|
||||
|
||||
[self setCacheChild:result forKey:cacheKey];
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,44 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlus.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
|
||||
#import "GTLPlusConstants.h"
|
||||
|
||||
#import "GTLPlusAcl.h"
|
||||
#import "GTLPlusAclentryResource.h"
|
||||
#import "GTLPlusActivity.h"
|
||||
#import "GTLPlusActivityFeed.h"
|
||||
#import "GTLPlusComment.h"
|
||||
#import "GTLPlusCommentFeed.h"
|
||||
#import "GTLPlusItemScope.h"
|
||||
#import "GTLPlusMoment.h"
|
||||
#import "GTLPlusMomentsFeed.h"
|
||||
#import "GTLPlusPeopleFeed.h"
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
#import "GTLQueryPlus.h"
|
||||
#import "GTLServicePlus.h"
|
||||
@@ -1,60 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusAcl.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusAcl (0 custom class methods, 3 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusAclentryResource;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusAcl
|
||||
//
|
||||
|
||||
// This class supports NSFastEnumeration over its "items" property. It also
|
||||
// supports -itemAtIndex: to retrieve individual objects from "items".
|
||||
|
||||
@interface GTLPlusAcl : GTLCollectionObject
|
||||
|
||||
// Description of the access granted, suitable for display.
|
||||
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
|
||||
@property (copy) NSString *descriptionProperty;
|
||||
|
||||
// The list of access entries.
|
||||
@property (retain) NSArray *items; // of GTLPlusAclentryResource
|
||||
|
||||
// Identifies this resource as a collection of access controls. Value:
|
||||
// "plus#acl".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
@end
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusAcl.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusAcl (0 custom class methods, 3 custom properties)
|
||||
|
||||
#import "GTLPlusAcl.h"
|
||||
|
||||
#import "GTLPlusAclentryResource.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusAcl
|
||||
//
|
||||
|
||||
@implementation GTLPlusAcl
|
||||
@dynamic descriptionProperty, items, kind;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"description"
|
||||
forKey:@"descriptionProperty"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusAclentryResource class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#acl"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusAclentryResource.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusAclentryResource (0 custom class methods, 3 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusAclentryResource
|
||||
//
|
||||
|
||||
@interface GTLPlusAclentryResource : GTLObject
|
||||
|
||||
// A descriptive name for this entry. Suitable for display.
|
||||
@property (copy) NSString *displayName;
|
||||
|
||||
// The ID of the entry. For entries of type "person" or "circle", this is the ID
|
||||
// of the resource. For other types, this property is not set.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The type of entry describing to whom access is granted. Possible values are:
|
||||
// - "person" - Access to an individual.
|
||||
// - "circle" - Access to members of a circle.
|
||||
// - "myCircles" - Access to members of all the person's circles.
|
||||
// - "extendedCircles" - Access to members of everyone in a person's circles,
|
||||
// plus all of the people in their circles.
|
||||
// - "public" - Access to anyone on the web.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
@end
|
||||
@@ -1,48 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusAclentryResource.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusAclentryResource (0 custom class methods, 3 custom properties)
|
||||
|
||||
#import "GTLPlusAclentryResource.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusAclentryResource
|
||||
//
|
||||
|
||||
@implementation GTLPlusAclentryResource
|
||||
@dynamic displayName, identifier, type;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,493 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusActivity.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusActivity (0 custom class methods, 19 custom properties)
|
||||
// GTLPlusActivityActor (0 custom class methods, 5 custom properties)
|
||||
// GTLPlusActivityObject (0 custom class methods, 10 custom properties)
|
||||
// GTLPlusActivityProvider (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusActivityActorImage (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusActivityActorName (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectActor (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItem (0 custom class methods, 9 custom properties)
|
||||
// GTLPlusActivityObjectPlusoners (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectReplies (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectResharers (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectActorImage (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemEmbed (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemFullImage (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemImage (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage (0 custom class methods, 4 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusAcl;
|
||||
@class GTLPlusActivityActor;
|
||||
@class GTLPlusActivityActorImage;
|
||||
@class GTLPlusActivityActorName;
|
||||
@class GTLPlusActivityObject;
|
||||
@class GTLPlusActivityObjectActor;
|
||||
@class GTLPlusActivityObjectActorImage;
|
||||
@class GTLPlusActivityObjectAttachmentsItem;
|
||||
@class GTLPlusActivityObjectAttachmentsItemEmbed;
|
||||
@class GTLPlusActivityObjectAttachmentsItemFullImage;
|
||||
@class GTLPlusActivityObjectAttachmentsItemImage;
|
||||
@class GTLPlusActivityObjectAttachmentsItemThumbnailsItem;
|
||||
@class GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage;
|
||||
@class GTLPlusActivityObjectPlusoners;
|
||||
@class GTLPlusActivityObjectReplies;
|
||||
@class GTLPlusActivityObjectResharers;
|
||||
@class GTLPlusActivityProvider;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivity
|
||||
//
|
||||
|
||||
@interface GTLPlusActivity : GTLObject
|
||||
|
||||
// Identifies who has access to see this activity.
|
||||
@property (retain) GTLPlusAcl *access;
|
||||
|
||||
// The person who performed this activity.
|
||||
@property (retain) GTLPlusActivityActor *actor;
|
||||
|
||||
// Street address where this activity occurred.
|
||||
@property (copy) NSString *address;
|
||||
|
||||
// Additional content added by the person who shared this activity, applicable
|
||||
// only when resharing an activity.
|
||||
@property (copy) NSString *annotation;
|
||||
|
||||
// If this activity is a crosspost from another system, this property specifies
|
||||
// the ID of the original activity.
|
||||
@property (copy) NSString *crosspostSource;
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// Latitude and longitude where this activity occurred. Format is latitude
|
||||
// followed by longitude, space separated.
|
||||
@property (copy) NSString *geocode;
|
||||
|
||||
// The ID of this activity.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// Identifies this resource as an activity. Value: "plus#activity".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// The object of this activity.
|
||||
@property (retain) GTLPlusActivityObject *object;
|
||||
|
||||
// ID of the place where this activity occurred.
|
||||
@property (copy) NSString *placeId;
|
||||
|
||||
// Name of the place where this activity occurred.
|
||||
@property (copy) NSString *placeName;
|
||||
|
||||
// The service provider that initially published this activity.
|
||||
@property (retain) GTLPlusActivityProvider *provider;
|
||||
|
||||
// The time at which this activity was initially published. Formatted as an RFC
|
||||
// 3339 timestamp.
|
||||
@property (retain) GTLDateTime *published;
|
||||
|
||||
// Radius, in meters, of the region where this activity occurred, centered at
|
||||
// the latitude and longitude identified in geocode.
|
||||
@property (copy) NSString *radius;
|
||||
|
||||
// Title of this activity.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
// The time at which this activity was last updated. Formatted as an RFC 3339
|
||||
// timestamp.
|
||||
@property (retain) GTLDateTime *updated;
|
||||
|
||||
// The link to this activity.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// This activity's verb, indicating what action was performed. Possible values
|
||||
// are:
|
||||
// - "post" - Publish content to the stream.
|
||||
// - "share" - Reshare an activity.
|
||||
@property (copy) NSString *verb;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActor
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityActor : GTLObject
|
||||
|
||||
// The name of the actor, suitable for display.
|
||||
@property (copy) NSString *displayName;
|
||||
|
||||
// The ID of the actor's person resource.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The image representation of the actor.
|
||||
@property (retain) GTLPlusActivityActorImage *image;
|
||||
|
||||
// An object representation of the individual components of name.
|
||||
@property (retain) GTLPlusActivityActorName *name;
|
||||
|
||||
// The link to the actor's Google profile.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObject
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObject : GTLObject
|
||||
|
||||
// If this activity's object is itself another activity (for example, when a
|
||||
// person reshares an activity), this property specifies the original activity's
|
||||
// actor.
|
||||
@property (retain) GTLPlusActivityObjectActor *actor;
|
||||
|
||||
// The media objects attached to this activity.
|
||||
@property (retain) NSArray *attachments; // of GTLPlusActivityObjectAttachmentsItem
|
||||
|
||||
// The HTML-formatted content, suitable for display.
|
||||
@property (copy) NSString *content;
|
||||
|
||||
// The ID of the object. When resharing an activity, this is the ID of the
|
||||
// activity being reshared.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The type of the object. Possible values are:
|
||||
// - "note" - Textual content.
|
||||
// - "activity" - A Google+ activity.
|
||||
@property (copy) NSString *objectType;
|
||||
|
||||
// The content (text) as provided by the author, stored without any HTML
|
||||
// formatting. When creating or updating an activity, this value must be
|
||||
// supplied as plain text in the request.
|
||||
@property (copy) NSString *originalContent;
|
||||
|
||||
// People who +1'd this activity.
|
||||
@property (retain) GTLPlusActivityObjectPlusoners *plusoners;
|
||||
|
||||
// Comments in reply to this activity.
|
||||
@property (retain) GTLPlusActivityObjectReplies *replies;
|
||||
|
||||
// People who reshared this activity.
|
||||
@property (retain) GTLPlusActivityObjectResharers *resharers;
|
||||
|
||||
// The URL that points to the linked resource.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityProvider
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityProvider : GTLObject
|
||||
|
||||
// Name of the service provider.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActorImage
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityActorImage : GTLObject
|
||||
|
||||
// The URL of the actor's profile photo. To re-size the image and crop it to a
|
||||
// square, append the query string ?sz=x, where x is the dimension in pixels of
|
||||
// each side.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActorName
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityActorName : GTLObject
|
||||
|
||||
// The family name (last name) of the actor.
|
||||
@property (copy) NSString *familyName;
|
||||
|
||||
// The given name (first name) of the actor.
|
||||
@property (copy) NSString *givenName;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectActor
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectActor : GTLObject
|
||||
|
||||
// The original actor's name, suitable for display.
|
||||
@property (copy) NSString *displayName;
|
||||
|
||||
// ID of the original actor.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The image representation of the original actor.
|
||||
@property (retain) GTLPlusActivityObjectActorImage *image;
|
||||
|
||||
// A link to the original actor's Google profile.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItem
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectAttachmentsItem : GTLObject
|
||||
|
||||
// If the attachment is an article, this property contains a snippet of text
|
||||
// from the article. It can also include descriptions for other types.
|
||||
@property (copy) NSString *content;
|
||||
|
||||
// The title of the attachment (such as a photo caption or an article title).
|
||||
@property (copy) NSString *displayName;
|
||||
|
||||
// If the attachment is a video, the embeddable link.
|
||||
@property (retain) GTLPlusActivityObjectAttachmentsItemEmbed *embed;
|
||||
|
||||
// The full image URL for photo attachments.
|
||||
@property (retain) GTLPlusActivityObjectAttachmentsItemFullImage *fullImage;
|
||||
|
||||
// The ID of the attachment.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The preview image for photos or videos.
|
||||
@property (retain) GTLPlusActivityObjectAttachmentsItemImage *image;
|
||||
|
||||
// The type of media object. Possible values are:
|
||||
// - "photo" - A photo.
|
||||
// - "album" - A photo album.
|
||||
// - "video" - A video.
|
||||
// - "article" - An article, specified by a link.
|
||||
@property (copy) NSString *objectType;
|
||||
|
||||
// If the attachment is an album, potential additional thumbnails from the
|
||||
// album.
|
||||
@property (retain) NSArray *thumbnails; // of GTLPlusActivityObjectAttachmentsItemThumbnailsItem
|
||||
|
||||
// The link to the attachment, should be of type text/html.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectPlusoners
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectPlusoners : GTLObject
|
||||
|
||||
// The URL for the collection of people who +1'd this activity.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// Total number of people who +1'd this activity.
|
||||
@property (retain) NSNumber *totalItems; // unsignedIntValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectReplies
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectReplies : GTLObject
|
||||
|
||||
// The URL for the collection of comments in reply to this activity.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// Total number of comments on this activity.
|
||||
@property (retain) NSNumber *totalItems; // unsignedIntValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectResharers
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectResharers : GTLObject
|
||||
|
||||
// The URL for the collection of resharers.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// Total number of people who reshared this activity.
|
||||
@property (retain) NSNumber *totalItems; // unsignedIntValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectActorImage
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectActorImage : GTLObject
|
||||
|
||||
// A URL that points to a thumbnail photo of the original actor.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemEmbed
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectAttachmentsItemEmbed : GTLObject
|
||||
|
||||
// Media type of the link.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// URL of the link.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemFullImage
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectAttachmentsItemFullImage : GTLObject
|
||||
|
||||
// The height, in pixels, of the linked resource.
|
||||
@property (retain) NSNumber *height; // unsignedIntValue
|
||||
|
||||
// Media type of the link.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// URL to the image.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// The width, in pixels, of the linked resource.
|
||||
@property (retain) NSNumber *width; // unsignedIntValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemImage
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectAttachmentsItemImage : GTLObject
|
||||
|
||||
// The height, in pixels, of the linked resource.
|
||||
@property (retain) NSNumber *height; // unsignedIntValue
|
||||
|
||||
// Media type of the link.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// Image url.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// The width, in pixels, of the linked resource.
|
||||
@property (retain) NSNumber *width; // unsignedIntValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectAttachmentsItemThumbnailsItem : GTLObject
|
||||
|
||||
// Potential name of the thumbnail.
|
||||
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
|
||||
@property (copy) NSString *descriptionProperty;
|
||||
|
||||
// Image resource.
|
||||
@property (retain) GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage *image;
|
||||
|
||||
// URL to the webpage containing the image.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage
|
||||
//
|
||||
|
||||
@interface GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage : GTLObject
|
||||
|
||||
// The height, in pixels, of the linked resource.
|
||||
@property (retain) NSNumber *height; // unsignedIntValue
|
||||
|
||||
// Media type of the link.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// Image url.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// The width, in pixels, of the linked resource.
|
||||
@property (retain) NSNumber *width; // unsignedIntValue
|
||||
|
||||
@end
|
||||
@@ -1,290 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusActivity.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusActivity (0 custom class methods, 19 custom properties)
|
||||
// GTLPlusActivityActor (0 custom class methods, 5 custom properties)
|
||||
// GTLPlusActivityObject (0 custom class methods, 10 custom properties)
|
||||
// GTLPlusActivityProvider (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusActivityActorImage (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusActivityActorName (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectActor (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItem (0 custom class methods, 9 custom properties)
|
||||
// GTLPlusActivityObjectPlusoners (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectReplies (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectResharers (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectActorImage (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemEmbed (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemFullImage (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemImage (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage (0 custom class methods, 4 custom properties)
|
||||
|
||||
#import "GTLPlusActivity.h"
|
||||
|
||||
#import "GTLPlusAcl.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivity
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivity
|
||||
@dynamic access, actor, address, annotation, crosspostSource, ETag, geocode,
|
||||
identifier, kind, object, placeId, placeName, provider, published,
|
||||
radius, title, updated, url, verb;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#activity"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActor
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityActor
|
||||
@dynamic displayName, identifier, image, name, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObject
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObject
|
||||
@dynamic actor, attachments, content, identifier, objectType, originalContent,
|
||||
plusoners, replies, resharers, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusActivityObjectAttachmentsItem class]
|
||||
forKey:@"attachments"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityProvider
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityProvider
|
||||
@dynamic title;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActorImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityActorImage
|
||||
@dynamic url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityActorName
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityActorName
|
||||
@dynamic familyName, givenName;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectActor
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectActor
|
||||
@dynamic displayName, identifier, image, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItem
|
||||
@dynamic content, displayName, embed, fullImage, identifier, image, objectType,
|
||||
thumbnails, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusActivityObjectAttachmentsItemThumbnailsItem class]
|
||||
forKey:@"thumbnails"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectPlusoners
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectPlusoners
|
||||
@dynamic selfLink, totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectReplies
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectReplies
|
||||
@dynamic selfLink, totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectResharers
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectResharers
|
||||
@dynamic selfLink, totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectActorImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectActorImage
|
||||
@dynamic url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemEmbed
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemEmbed
|
||||
@dynamic type, url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemFullImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemFullImage
|
||||
@dynamic height, type, url, width;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemImage
|
||||
@dynamic height, type, url, width;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemThumbnailsItem
|
||||
@dynamic descriptionProperty, image, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"description"
|
||||
forKey:@"descriptionProperty"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityObjectAttachmentsItemThumbnailsItemImage
|
||||
@dynamic height, type, url, width;
|
||||
@end
|
||||
@@ -1,81 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusActivityFeed.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusActivityFeed (0 custom class methods, 9 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusActivity;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityFeed
|
||||
//
|
||||
|
||||
// This class supports NSFastEnumeration over its "items" property. It also
|
||||
// supports -itemAtIndex: to retrieve individual objects from "items".
|
||||
|
||||
@interface GTLPlusActivityFeed : GTLCollectionObject
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// The ID of this collection of activities. Deprecated.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The activities in this page of results.
|
||||
@property (retain) NSArray *items; // of GTLPlusActivity
|
||||
|
||||
// Identifies this resource as a collection of activities. Value:
|
||||
// "plus#activityFeed".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// Link to the next page of activities.
|
||||
@property (copy) NSString *nextLink;
|
||||
|
||||
// The continuation token, which is used to page through large result sets.
|
||||
// Provide this value in a subsequent request to return the next page of
|
||||
// results.
|
||||
@property (copy) NSString *nextPageToken;
|
||||
|
||||
// Link to this activity resource.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// The title of this collection of activities.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
// The time at which this collection of activities was last updated. Formatted
|
||||
// as an RFC 3339 timestamp.
|
||||
@property (retain) GTLDateTime *updated;
|
||||
|
||||
@end
|
||||
@@ -1,64 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusActivityFeed.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusActivityFeed (0 custom class methods, 9 custom properties)
|
||||
|
||||
#import "GTLPlusActivityFeed.h"
|
||||
|
||||
#import "GTLPlusActivity.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusActivityFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusActivityFeed
|
||||
@dynamic ETag, identifier, items, kind, nextLink, nextPageToken, selfLink,
|
||||
title, updated;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusActivity class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#activityFeed"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,183 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusComment.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusComment (0 custom class methods, 11 custom properties)
|
||||
// GTLPlusCommentActor (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusCommentInReplyToItem (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusCommentObject (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusCommentPlusoners (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusCommentActorImage (0 custom class methods, 1 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusCommentActor;
|
||||
@class GTLPlusCommentActorImage;
|
||||
@class GTLPlusCommentInReplyToItem;
|
||||
@class GTLPlusCommentObject;
|
||||
@class GTLPlusCommentPlusoners;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusComment
|
||||
//
|
||||
|
||||
@interface GTLPlusComment : GTLObject
|
||||
|
||||
// The person who posted this comment.
|
||||
@property (retain) GTLPlusCommentActor *actor;
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// The ID of this comment.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The activity this comment replied to.
|
||||
@property (retain) NSArray *inReplyTo; // of GTLPlusCommentInReplyToItem
|
||||
|
||||
// Identifies this resource as a comment. Value: "plus#comment".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// The object of this comment.
|
||||
@property (retain) GTLPlusCommentObject *object;
|
||||
|
||||
// People who +1'd this comment.
|
||||
@property (retain) GTLPlusCommentPlusoners *plusoners;
|
||||
|
||||
// The time at which this comment was initially published. Formatted as an RFC
|
||||
// 3339 timestamp.
|
||||
@property (retain) GTLDateTime *published;
|
||||
|
||||
// Link to this comment resource.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// The time at which this comment was last updated. Formatted as an RFC 3339
|
||||
// timestamp.
|
||||
@property (retain) GTLDateTime *updated;
|
||||
|
||||
// This comment's verb, indicating what action was performed. Possible values
|
||||
// are:
|
||||
// - "post" - Publish content to the stream.
|
||||
@property (copy) NSString *verb;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentActor
|
||||
//
|
||||
|
||||
@interface GTLPlusCommentActor : GTLObject
|
||||
|
||||
// The name of this actor, suitable for display.
|
||||
@property (copy) NSString *displayName;
|
||||
|
||||
// The ID of the actor.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The image representation of this actor.
|
||||
@property (retain) GTLPlusCommentActorImage *image;
|
||||
|
||||
// A link to the person resource for this actor.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentInReplyToItem
|
||||
//
|
||||
|
||||
@interface GTLPlusCommentInReplyToItem : GTLObject
|
||||
|
||||
// The ID of the activity.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The URL of the activity.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentObject
|
||||
//
|
||||
|
||||
@interface GTLPlusCommentObject : GTLObject
|
||||
|
||||
// The HTML-formatted content, suitable for display.
|
||||
@property (copy) NSString *content;
|
||||
|
||||
// The object type of this comment. Possible values are:
|
||||
// - "comment" - A comment in reply to an activity.
|
||||
@property (copy) NSString *objectType;
|
||||
|
||||
// The content (text) as provided by the author, stored without any HTML
|
||||
// formatting. When creating or updating a comment, this value must be supplied
|
||||
// as plain text in the request.
|
||||
@property (copy) NSString *originalContent;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentPlusoners
|
||||
//
|
||||
|
||||
@interface GTLPlusCommentPlusoners : GTLObject
|
||||
|
||||
// Total number of people who +1'd this comment.
|
||||
@property (retain) NSNumber *totalItems; // unsignedIntValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentActorImage
|
||||
//
|
||||
|
||||
@interface GTLPlusCommentActorImage : GTLObject
|
||||
|
||||
// The URL of the actor's profile photo. To re-size the image and crop it to a
|
||||
// square, append the query string ?sz=x, where x is the dimension in pixels of
|
||||
// each side.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
@@ -1,133 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusComment.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusComment (0 custom class methods, 11 custom properties)
|
||||
// GTLPlusCommentActor (0 custom class methods, 4 custom properties)
|
||||
// GTLPlusCommentInReplyToItem (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusCommentObject (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusCommentPlusoners (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusCommentActorImage (0 custom class methods, 1 custom properties)
|
||||
|
||||
#import "GTLPlusComment.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusComment
|
||||
//
|
||||
|
||||
@implementation GTLPlusComment
|
||||
@dynamic actor, ETag, identifier, inReplyTo, kind, object, plusoners, published,
|
||||
selfLink, updated, verb;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusCommentInReplyToItem class]
|
||||
forKey:@"inReplyTo"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#comment"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentActor
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentActor
|
||||
@dynamic displayName, identifier, image, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentInReplyToItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentInReplyToItem
|
||||
@dynamic identifier, url;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentObject
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentObject
|
||||
@dynamic content, objectType, originalContent;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentPlusoners
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentPlusoners
|
||||
@dynamic totalItems;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentActorImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentActorImage
|
||||
@dynamic url;
|
||||
@end
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusCommentFeed.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusCommentFeed (0 custom class methods, 8 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusComment;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentFeed
|
||||
//
|
||||
|
||||
// This class supports NSFastEnumeration over its "items" property. It also
|
||||
// supports -itemAtIndex: to retrieve individual objects from "items".
|
||||
|
||||
@interface GTLPlusCommentFeed : GTLCollectionObject
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// The ID of this collection of comments.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The comments in this page of results.
|
||||
@property (retain) NSArray *items; // of GTLPlusComment
|
||||
|
||||
// Identifies this resource as a collection of comments. Value:
|
||||
// "plus#commentFeed".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// Link to the next page of activities.
|
||||
@property (copy) NSString *nextLink;
|
||||
|
||||
// The continuation token, which is used to page through large result sets.
|
||||
// Provide this value in a subsequent request to return the next page of
|
||||
// results.
|
||||
@property (copy) NSString *nextPageToken;
|
||||
|
||||
// The title of this collection of comments.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
// The time at which this collection of comments was last updated. Formatted as
|
||||
// an RFC 3339 timestamp.
|
||||
@property (retain) GTLDateTime *updated;
|
||||
|
||||
@end
|
||||
@@ -1,63 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusCommentFeed.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusCommentFeed (0 custom class methods, 8 custom properties)
|
||||
|
||||
#import "GTLPlusCommentFeed.h"
|
||||
|
||||
#import "GTLPlusComment.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusCommentFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusCommentFeed
|
||||
@dynamic ETag, identifier, items, kind, nextLink, nextPageToken, title, updated;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusComment class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#commentFeed"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,57 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusConstants.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLDefines.h"
|
||||
#else
|
||||
#import "GTLDefines.h"
|
||||
#endif
|
||||
|
||||
// Authorization scope
|
||||
// Know your name, basic info, and list of people you're connected to on Google+
|
||||
GTL_EXTERN NSString * const kGTLAuthScopePlusLogin; // "https://www.googleapis.com/auth/plus.login"
|
||||
// Know who you are on Google
|
||||
GTL_EXTERN NSString * const kGTLAuthScopePlusMe; // "https://www.googleapis.com/auth/plus.me"
|
||||
|
||||
// Collection
|
||||
GTL_EXTERN NSString * const kGTLPlusCollectionPlusoners; // "plusoners"
|
||||
GTL_EXTERN NSString * const kGTLPlusCollectionPublic; // "public"
|
||||
GTL_EXTERN NSString * const kGTLPlusCollectionResharers; // "resharers"
|
||||
GTL_EXTERN NSString * const kGTLPlusCollectionVault; // "vault"
|
||||
GTL_EXTERN NSString * const kGTLPlusCollectionVisible; // "visible"
|
||||
|
||||
// OrderBy
|
||||
GTL_EXTERN NSString * const kGTLPlusOrderByAlphabetical; // "alphabetical"
|
||||
GTL_EXTERN NSString * const kGTLPlusOrderByBest; // "best"
|
||||
GTL_EXTERN NSString * const kGTLPlusOrderByRecent; // "recent"
|
||||
|
||||
// SortOrder
|
||||
GTL_EXTERN NSString * const kGTLPlusSortOrderAscending; // "ascending"
|
||||
GTL_EXTERN NSString * const kGTLPlusSortOrderDescending; // "descending"
|
||||
@@ -1,49 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusConstants.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
|
||||
#import "GTLPlusConstants.h"
|
||||
|
||||
// Authorization scope
|
||||
NSString * const kGTLAuthScopePlusLogin = @"https://www.googleapis.com/auth/plus.login";
|
||||
NSString * const kGTLAuthScopePlusMe = @"https://www.googleapis.com/auth/plus.me";
|
||||
|
||||
// Collection
|
||||
NSString * const kGTLPlusCollectionPlusoners = @"plusoners";
|
||||
NSString * const kGTLPlusCollectionPublic = @"public";
|
||||
NSString * const kGTLPlusCollectionResharers = @"resharers";
|
||||
NSString * const kGTLPlusCollectionVault = @"vault";
|
||||
NSString * const kGTLPlusCollectionVisible = @"visible";
|
||||
|
||||
// OrderBy
|
||||
NSString * const kGTLPlusOrderByAlphabetical = @"alphabetical";
|
||||
NSString * const kGTLPlusOrderByBest = @"best";
|
||||
NSString * const kGTLPlusOrderByRecent = @"recent";
|
||||
|
||||
// SortOrder
|
||||
NSString * const kGTLPlusSortOrderAscending = @"ascending";
|
||||
NSString * const kGTLPlusSortOrderDescending = @"descending";
|
||||
@@ -1,225 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusItemScope.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusItemScope (0 custom class methods, 55 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusItemScope;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusItemScope
|
||||
//
|
||||
|
||||
@interface GTLPlusItemScope : GTLObject
|
||||
|
||||
// The subject matter of the content.
|
||||
@property (retain) GTLPlusItemScope *about;
|
||||
|
||||
// An additional name for a Person, can be used for a middle name.
|
||||
@property (retain) NSArray *additionalName; // of NSString
|
||||
|
||||
// Postal address.
|
||||
@property (retain) GTLPlusItemScope *address;
|
||||
|
||||
// Address country.
|
||||
@property (copy) NSString *addressCountry;
|
||||
|
||||
// Address locality.
|
||||
@property (copy) NSString *addressLocality;
|
||||
|
||||
// Address region.
|
||||
@property (copy) NSString *addressRegion;
|
||||
|
||||
// The encoding.
|
||||
@property (retain) NSArray *associatedMedia; // of GTLPlusItemScope
|
||||
|
||||
// Number of attendees.
|
||||
@property (retain) NSNumber *attendeeCount; // intValue
|
||||
|
||||
// A person attending the event.
|
||||
@property (retain) NSArray *attendees; // of GTLPlusItemScope
|
||||
|
||||
// From http://schema.org/MusicRecording, the audio file.
|
||||
@property (retain) GTLPlusItemScope *audio;
|
||||
|
||||
// The person who created this scope.
|
||||
@property (retain) NSArray *author; // of GTLPlusItemScope
|
||||
|
||||
// Best possible rating value.
|
||||
@property (copy) NSString *bestRating;
|
||||
|
||||
// Date of birth.
|
||||
@property (copy) NSString *birthDate;
|
||||
|
||||
// From http://schema.org/MusicRecording, the artist that performed this
|
||||
// recording.
|
||||
@property (retain) GTLPlusItemScope *byArtist;
|
||||
|
||||
// The caption for this object.
|
||||
@property (copy) NSString *caption;
|
||||
|
||||
// File size in (mega/kilo) bytes.
|
||||
@property (copy) NSString *contentSize;
|
||||
|
||||
// Actual bytes of the media object, for example the image file or video file.
|
||||
@property (copy) NSString *contentUrl;
|
||||
|
||||
// The list of contributors for this scope.
|
||||
@property (retain) NSArray *contributor; // of GTLPlusItemScope
|
||||
|
||||
// The date this scope was created.
|
||||
@property (copy) NSString *dateCreated;
|
||||
|
||||
// The date this scope was last modified.
|
||||
@property (copy) NSString *dateModified;
|
||||
|
||||
// The initial date this scope was published.
|
||||
@property (copy) NSString *datePublished;
|
||||
|
||||
// The string describing the content of this scope.
|
||||
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
|
||||
@property (copy) NSString *descriptionProperty;
|
||||
|
||||
// The duration of the item (movie, audio recording, event, etc.) in ISO 8601
|
||||
// date format.
|
||||
@property (copy) NSString *duration;
|
||||
|
||||
// A URL pointing to a player for a specific video. In general, this is the
|
||||
// information in the src element of an embed tag and should not be the same as
|
||||
// the content of the loc tag.
|
||||
@property (copy) NSString *embedUrl;
|
||||
|
||||
// The end date and time of the event (in ISO 8601 date format).
|
||||
@property (copy) NSString *endDate;
|
||||
|
||||
// Family name. In the U.S., the last name of an Person. This can be used along
|
||||
// with givenName instead of the Name property.
|
||||
@property (copy) NSString *familyName;
|
||||
|
||||
// Gender of the person.
|
||||
@property (copy) NSString *gender;
|
||||
|
||||
// Geo coordinates.
|
||||
@property (retain) GTLPlusItemScope *geo;
|
||||
|
||||
// Given name. In the U.S., the first name of a Person. This can be used along
|
||||
// with familyName instead of the Name property.
|
||||
@property (copy) NSString *givenName;
|
||||
|
||||
// The height of the media object.
|
||||
@property (copy) NSString *height;
|
||||
|
||||
// The id for this item scope.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// A url to the image for this scope.
|
||||
@property (copy) NSString *image;
|
||||
|
||||
// From http://schema.org/MusicRecording, which album a song is in.
|
||||
@property (retain) GTLPlusItemScope *inAlbum;
|
||||
|
||||
// Identifies this resource as an itemScope.
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// Latitude.
|
||||
@property (retain) NSNumber *latitude; // doubleValue
|
||||
|
||||
// The location of the event or organization.
|
||||
@property (retain) GTLPlusItemScope *location;
|
||||
|
||||
// Longitude.
|
||||
@property (retain) NSNumber *longitude; // doubleValue
|
||||
|
||||
// The name of this scope.
|
||||
@property (copy) NSString *name;
|
||||
|
||||
// Property of http://schema.org/TVEpisode indicating which series the episode
|
||||
// belongs to.
|
||||
@property (retain) GTLPlusItemScope *partOfTVSeries;
|
||||
|
||||
// The main performer or performers of the event-for example, a presenter,
|
||||
// musician, or actor.
|
||||
@property (retain) NSArray *performers; // of GTLPlusItemScope
|
||||
|
||||
// Player type required-for example, Flash or Silverlight.
|
||||
@property (copy) NSString *playerType;
|
||||
|
||||
// Postal code.
|
||||
@property (copy) NSString *postalCode;
|
||||
|
||||
// Post office box number.
|
||||
@property (copy) NSString *postOfficeBoxNumber;
|
||||
|
||||
// Rating value.
|
||||
@property (copy) NSString *ratingValue;
|
||||
|
||||
// Review rating.
|
||||
@property (retain) GTLPlusItemScope *reviewRating;
|
||||
|
||||
// The start date and time of the event (in ISO 8601 date format).
|
||||
@property (copy) NSString *startDate;
|
||||
|
||||
// Street address.
|
||||
@property (copy) NSString *streetAddress;
|
||||
|
||||
// Comment text, review text, etc.
|
||||
@property (copy) NSString *text;
|
||||
|
||||
// Thumbnail image for an image or video.
|
||||
@property (retain) GTLPlusItemScope *thumbnail;
|
||||
|
||||
// A url to a thumbnail image for this scope.
|
||||
@property (copy) NSString *thumbnailUrl;
|
||||
|
||||
// The exchange traded instrument associated with a Corporation object. The
|
||||
// tickerSymbol is expressed as an exchange and an instrument name separated by
|
||||
// a space character. For the exchange component of the tickerSymbol attribute,
|
||||
// we reccommend using the controlled vocaulary of Market Identifier Codes (MIC)
|
||||
// specified in ISO15022.
|
||||
@property (copy) NSString *tickerSymbol;
|
||||
|
||||
// The item type.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// A URL for the item upon which the action was performed.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// The width of the media object.
|
||||
@property (copy) NSString *width;
|
||||
|
||||
// Worst possible rating value.
|
||||
@property (copy) NSString *worstRating;
|
||||
|
||||
@end
|
||||
@@ -1,77 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusItemScope.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusItemScope (0 custom class methods, 55 custom properties)
|
||||
|
||||
#import "GTLPlusItemScope.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusItemScope
|
||||
//
|
||||
|
||||
@implementation GTLPlusItemScope
|
||||
@dynamic about, additionalName, address, addressCountry, addressLocality,
|
||||
addressRegion, associatedMedia, attendeeCount, attendees, audio,
|
||||
author, bestRating, birthDate, byArtist, caption, contentSize,
|
||||
contentUrl, contributor, dateCreated, dateModified, datePublished,
|
||||
descriptionProperty, duration, embedUrl, endDate, familyName, gender,
|
||||
geo, givenName, height, identifier, image, inAlbum, kind, latitude,
|
||||
location, longitude, name, partOfTVSeries, performers, playerType,
|
||||
postalCode, postOfficeBoxNumber, ratingValue, reviewRating, startDate,
|
||||
streetAddress, text, thumbnail, thumbnailUrl, tickerSymbol, type, url,
|
||||
width, worstRating;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"associated_media", @"associatedMedia",
|
||||
@"description", @"descriptionProperty",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSString class], @"additionalName",
|
||||
[GTLPlusItemScope class], @"associated_media",
|
||||
[GTLPlusItemScope class], @"attendees",
|
||||
[GTLPlusItemScope class], @"author",
|
||||
[GTLPlusItemScope class], @"contributor",
|
||||
[GTLPlusItemScope class], @"performers",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#itemScope"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,65 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusMoment.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusMoment (0 custom class methods, 6 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusItemScope;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusMoment
|
||||
//
|
||||
|
||||
@interface GTLPlusMoment : GTLObject
|
||||
|
||||
// The moment ID.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// Identifies this resource as a moment.
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// The object generated by performing the action on the item
|
||||
@property (retain) GTLPlusItemScope *result;
|
||||
|
||||
// Time stamp of when the action occurred in RFC3339 format.
|
||||
@property (retain) GTLDateTime *startDate;
|
||||
|
||||
// The object on which the action was performed.
|
||||
@property (retain) GTLPlusItemScope *target;
|
||||
|
||||
// The schema.org activity type.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
@end
|
||||
@@ -1,54 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusMoment.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusMoment (0 custom class methods, 6 custom properties)
|
||||
|
||||
#import "GTLPlusMoment.h"
|
||||
|
||||
#import "GTLPlusItemScope.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusMoment
|
||||
//
|
||||
|
||||
@implementation GTLPlusMoment
|
||||
@dynamic identifier, kind, result, startDate, target, type;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#moment"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,76 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusMomentsFeed.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusMomentsFeed (0 custom class methods, 8 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusMoment;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusMomentsFeed
|
||||
//
|
||||
|
||||
// This class supports NSFastEnumeration over its "items" property. It also
|
||||
// supports -itemAtIndex: to retrieve individual objects from "items".
|
||||
|
||||
@interface GTLPlusMomentsFeed : GTLCollectionObject
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// The moments in this page of results.
|
||||
@property (retain) NSArray *items; // of GTLPlusMoment
|
||||
|
||||
// Identifies this resource as a collection of moments. Value:
|
||||
// "plus#momentsFeed".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// Link to the next page of moments.
|
||||
@property (copy) NSString *nextLink;
|
||||
|
||||
// The continuation token, which is used to page through large result sets.
|
||||
// Provide this value in a subsequent request to return the next page of
|
||||
// results.
|
||||
@property (copy) NSString *nextPageToken;
|
||||
|
||||
// Link to this page of moments.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// The title of this collection of moments.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
// The RFC 339 timestamp for when this collection of moments was last updated.
|
||||
@property (retain) GTLDateTime *updated;
|
||||
|
||||
@end
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusMomentsFeed.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusMomentsFeed (0 custom class methods, 8 custom properties)
|
||||
|
||||
#import "GTLPlusMomentsFeed.h"
|
||||
|
||||
#import "GTLPlusMoment.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusMomentsFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusMomentsFeed
|
||||
@dynamic ETag, items, kind, nextLink, nextPageToken, selfLink, title, updated;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"etag"
|
||||
forKey:@"ETag"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusMoment class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#momentsFeed"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,76 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusPeopleFeed.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusPeopleFeed (0 custom class methods, 7 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusPerson;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPeopleFeed
|
||||
//
|
||||
|
||||
// This class supports NSFastEnumeration over its "items" property. It also
|
||||
// supports -itemAtIndex: to retrieve individual objects from "items".
|
||||
|
||||
@interface GTLPlusPeopleFeed : GTLCollectionObject
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// The people in this page of results. Each item includes the id, displayName,
|
||||
// image, and url for the person. To retrieve additional profile data, see the
|
||||
// people.get method.
|
||||
@property (retain) NSArray *items; // of GTLPlusPerson
|
||||
|
||||
// Identifies this resource as a collection of people. Value: "plus#peopleFeed".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// The continuation token, which is used to page through large result sets.
|
||||
// Provide this value in a subsequent request to return the next page of
|
||||
// results.
|
||||
@property (copy) NSString *nextPageToken;
|
||||
|
||||
// Link to this resource.
|
||||
@property (copy) NSString *selfLink;
|
||||
|
||||
// The title of this collection of people.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
// The total number of people available in this list. The number of people in a
|
||||
// response might be smaller due to paging. This might not be set for all
|
||||
// collections.
|
||||
@property (retain) NSNumber *totalItems; // intValue
|
||||
|
||||
@end
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusPeopleFeed.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusPeopleFeed (0 custom class methods, 7 custom properties)
|
||||
|
||||
#import "GTLPlusPeopleFeed.h"
|
||||
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPeopleFeed
|
||||
//
|
||||
|
||||
@implementation GTLPlusPeopleFeed
|
||||
@dynamic ETag, items, kind, nextPageToken, selfLink, title, totalItems;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"etag"
|
||||
forKey:@"ETag"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:[GTLPlusPerson class]
|
||||
forKey:@"items"];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#peopleFeed"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,388 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusPerson.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusPerson (0 custom class methods, 28 custom properties)
|
||||
// GTLPlusPersonAgeRange (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusPersonCover (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusPersonEmailsItem (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusPersonImage (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusPersonName (0 custom class methods, 6 custom properties)
|
||||
// GTLPlusPersonOrganizationsItem (0 custom class methods, 9 custom properties)
|
||||
// GTLPlusPersonPlacesLivedItem (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusPersonUrlsItem (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusPersonCoverCoverInfo (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusPersonCoverCoverPhoto (0 custom class methods, 3 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLObject.h"
|
||||
#else
|
||||
#import "GTLObject.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusPersonAgeRange;
|
||||
@class GTLPlusPersonCover;
|
||||
@class GTLPlusPersonCoverCoverInfo;
|
||||
@class GTLPlusPersonCoverCoverPhoto;
|
||||
@class GTLPlusPersonEmailsItem;
|
||||
@class GTLPlusPersonImage;
|
||||
@class GTLPlusPersonName;
|
||||
@class GTLPlusPersonOrganizationsItem;
|
||||
@class GTLPlusPersonPlacesLivedItem;
|
||||
@class GTLPlusPersonUrlsItem;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPerson
|
||||
//
|
||||
|
||||
@interface GTLPlusPerson : GTLObject
|
||||
|
||||
// A short biography for this person.
|
||||
@property (copy) NSString *aboutMe;
|
||||
|
||||
// The age range of the person.
|
||||
@property (retain) GTLPlusPersonAgeRange *ageRange;
|
||||
|
||||
// The person's date of birth, represented as YYYY-MM-DD.
|
||||
@property (copy) NSString *birthday;
|
||||
|
||||
// The "bragging rights" line of this person.
|
||||
@property (copy) NSString *braggingRights;
|
||||
|
||||
// If a Google+ Page and for followers who are visible, the number of people who
|
||||
// have added this page to a circle.
|
||||
@property (retain) NSNumber *circledByCount; // intValue
|
||||
|
||||
// The cover photo content.
|
||||
@property (retain) GTLPlusPersonCover *cover;
|
||||
|
||||
// The current location for this person.
|
||||
@property (copy) NSString *currentLocation;
|
||||
|
||||
// The name of this person, suitable for display.
|
||||
@property (copy) NSString *displayName;
|
||||
|
||||
// A list of email addresses for this person.
|
||||
@property (retain) NSArray *emails; // of GTLPlusPersonEmailsItem
|
||||
|
||||
// ETag of this response for caching purposes.
|
||||
@property (copy) NSString *ETag;
|
||||
|
||||
// The person's gender. Possible values are:
|
||||
// - "male" - Male gender.
|
||||
// - "female" - Female gender.
|
||||
// - "other" - Other.
|
||||
@property (copy) NSString *gender;
|
||||
|
||||
// If "true", indicates that the person has installed the app that is making the
|
||||
// request and has chosen to expose this install state to the caller. A value of
|
||||
// "false" indicates that the install state cannot be determined (it is either
|
||||
// not installed or the person has chosen to keep this information private).
|
||||
@property (retain) NSNumber *hasApp; // boolValue
|
||||
|
||||
// The ID of this person.
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
|
||||
// The representation of the person's profile photo.
|
||||
@property (retain) GTLPlusPersonImage *image;
|
||||
|
||||
// Whether this user has signed up for Google+.
|
||||
@property (retain) NSNumber *isPlusUser; // boolValue
|
||||
|
||||
// Identifies this resource as a person. Value: "plus#person".
|
||||
@property (copy) NSString *kind;
|
||||
|
||||
// The user's preferred language for rendering.
|
||||
@property (copy) NSString *language;
|
||||
|
||||
// An object representation of the individual components of a person's name.
|
||||
@property (retain) GTLPlusPersonName *name;
|
||||
|
||||
// The nickname of this person.
|
||||
@property (copy) NSString *nickname;
|
||||
|
||||
// Type of person within Google+. Possible values are:
|
||||
// - "person" - represents an actual person.
|
||||
// - "page" - represents a page.
|
||||
@property (copy) NSString *objectType;
|
||||
|
||||
// A list of current or past organizations with which this person is associated.
|
||||
@property (retain) NSArray *organizations; // of GTLPlusPersonOrganizationsItem
|
||||
|
||||
// A list of places where this person has lived.
|
||||
@property (retain) NSArray *placesLived; // of GTLPlusPersonPlacesLivedItem
|
||||
|
||||
// If a Google+ Page, the number of people who have +1'ed this page.
|
||||
@property (retain) NSNumber *plusOneCount; // intValue
|
||||
|
||||
// The person's relationship status. Possible values are:
|
||||
// - "single" - Person is single.
|
||||
// - "in_a_relationship" - Person is in a relationship.
|
||||
// - "engaged" - Person is engaged.
|
||||
// - "married" - Person is married.
|
||||
// - "its_complicated" - The relationship is complicated.
|
||||
// - "open_relationship" - Person is in an open relationship.
|
||||
// - "widowed" - Person is widowed.
|
||||
// - "in_domestic_partnership" - Person is in a domestic partnership.
|
||||
// - "in_civil_union" - Person is in a civil union.
|
||||
@property (copy) NSString *relationshipStatus;
|
||||
|
||||
// The brief description (tagline) of this person.
|
||||
@property (copy) NSString *tagline;
|
||||
|
||||
// The URL of this person's profile.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// A list of URLs for this person.
|
||||
@property (retain) NSArray *urls; // of GTLPlusPersonUrlsItem
|
||||
|
||||
// Whether the person or Google+ Page has been verified.
|
||||
@property (retain) NSNumber *verified; // boolValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonAgeRange
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonAgeRange : GTLObject
|
||||
|
||||
// The age range's upper bound, if any.
|
||||
@property (retain) NSNumber *max; // intValue
|
||||
|
||||
// The age range's lower bound, if any.
|
||||
@property (retain) NSNumber *min; // intValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCover
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonCover : GTLObject
|
||||
|
||||
// Extra information about the cover photo.
|
||||
@property (retain) GTLPlusPersonCoverCoverInfo *coverInfo;
|
||||
|
||||
// The person's primary cover image.
|
||||
@property (retain) GTLPlusPersonCoverCoverPhoto *coverPhoto;
|
||||
|
||||
// The layout of the cover art. Possible values are:
|
||||
// - "banner" - One large image banner.
|
||||
@property (copy) NSString *layout;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonEmailsItem
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonEmailsItem : GTLObject
|
||||
|
||||
// If "true", indicates this email address is the person's primary one.
|
||||
@property (retain) NSNumber *primary; // boolValue
|
||||
|
||||
// The type of address. Possible values are:
|
||||
// - "home" - Home email address.
|
||||
// - "work" - Work email address.
|
||||
// - "other" - Other.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// The email address.
|
||||
@property (copy) NSString *value;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonImage
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonImage : GTLObject
|
||||
|
||||
// The URL of the person's profile photo. To re-size the image and crop it to a
|
||||
// square, append the query string ?sz=x, where x is the dimension in pixels of
|
||||
// each side.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonName
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonName : GTLObject
|
||||
|
||||
// The family name (last name) of this person.
|
||||
@property (copy) NSString *familyName;
|
||||
|
||||
// The full name of this person, including middle names, suffixes, etc.
|
||||
@property (copy) NSString *formatted;
|
||||
|
||||
// The given name (first name) of this person.
|
||||
@property (copy) NSString *givenName;
|
||||
|
||||
// The honorific prefixes (such as "Dr." or "Mrs.") for this person.
|
||||
@property (copy) NSString *honorificPrefix;
|
||||
|
||||
// The honorific suffixes (such as "Jr.") for this person.
|
||||
@property (copy) NSString *honorificSuffix;
|
||||
|
||||
// The middle name of this person.
|
||||
@property (copy) NSString *middleName;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonOrganizationsItem
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonOrganizationsItem : GTLObject
|
||||
|
||||
// The department within the organization. Deprecated.
|
||||
@property (copy) NSString *department;
|
||||
|
||||
// A short description of the person's role in this organization. Deprecated.
|
||||
// Remapped to 'descriptionProperty' to avoid NSObject's 'description'.
|
||||
@property (copy) NSString *descriptionProperty;
|
||||
|
||||
// The date the person left this organization.
|
||||
@property (copy) NSString *endDate;
|
||||
|
||||
// The location of this organization. Deprecated.
|
||||
@property (copy) NSString *location;
|
||||
|
||||
// The name of the organization.
|
||||
@property (copy) NSString *name;
|
||||
|
||||
// If "true", indicates this organization is the person's primary one (typically
|
||||
// interpreted as current one).
|
||||
@property (retain) NSNumber *primary; // boolValue
|
||||
|
||||
// The date the person joined this organization.
|
||||
@property (copy) NSString *startDate;
|
||||
|
||||
// The person's job title or role within the organization.
|
||||
@property (copy) NSString *title;
|
||||
|
||||
// The type of organization. Possible values are:
|
||||
// - "work" - Work.
|
||||
// - "school" - School.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonPlacesLivedItem
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonPlacesLivedItem : GTLObject
|
||||
|
||||
// If "true", this place of residence is this person's primary residence.
|
||||
@property (retain) NSNumber *primary; // boolValue
|
||||
|
||||
// A place where this person has lived. For example: "Seattle, WA", "Near
|
||||
// Toronto".
|
||||
@property (copy) NSString *value;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonUrlsItem
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonUrlsItem : GTLObject
|
||||
|
||||
// If "true", this URL is the person's primary URL.
|
||||
@property (retain) NSNumber *primary; // boolValue
|
||||
|
||||
// The type of URL. Possible values are:
|
||||
// - "home" - URL for home.
|
||||
// - "work" - URL for work.
|
||||
// - "blog" - URL for blog.
|
||||
// - "profile" - URL for profile.
|
||||
// - "other" - Other.
|
||||
@property (copy) NSString *type;
|
||||
|
||||
// The URL value.
|
||||
@property (copy) NSString *value;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCoverCoverInfo
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonCoverCoverInfo : GTLObject
|
||||
|
||||
// The difference between the left position of the image cover and the actual
|
||||
// displayed cover image. Only valid for BANNER layout.
|
||||
@property (retain) NSNumber *leftImageOffset; // intValue
|
||||
|
||||
// The difference between the top position of the image cover and the actual
|
||||
// displayed cover image. Only valid for BANNER layout.
|
||||
@property (retain) NSNumber *topImageOffset; // intValue
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCoverCoverPhoto
|
||||
//
|
||||
|
||||
@interface GTLPlusPersonCoverCoverPhoto : GTLObject
|
||||
|
||||
// The height to the image.
|
||||
@property (retain) NSNumber *height; // intValue
|
||||
|
||||
// The url to the image.
|
||||
@property (copy) NSString *url;
|
||||
|
||||
// The width to the image.
|
||||
@property (retain) NSNumber *width; // intValue
|
||||
|
||||
@end
|
||||
@@ -1,189 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLPlusPerson.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLPlusPerson (0 custom class methods, 28 custom properties)
|
||||
// GTLPlusPersonAgeRange (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusPersonCover (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusPersonEmailsItem (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusPersonImage (0 custom class methods, 1 custom properties)
|
||||
// GTLPlusPersonName (0 custom class methods, 6 custom properties)
|
||||
// GTLPlusPersonOrganizationsItem (0 custom class methods, 9 custom properties)
|
||||
// GTLPlusPersonPlacesLivedItem (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusPersonUrlsItem (0 custom class methods, 3 custom properties)
|
||||
// GTLPlusPersonCoverCoverInfo (0 custom class methods, 2 custom properties)
|
||||
// GTLPlusPersonCoverCoverPhoto (0 custom class methods, 3 custom properties)
|
||||
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPerson
|
||||
//
|
||||
|
||||
@implementation GTLPlusPerson
|
||||
@dynamic aboutMe, ageRange, birthday, braggingRights, circledByCount, cover,
|
||||
currentLocation, displayName, emails, ETag, gender, hasApp, identifier,
|
||||
image, isPlusUser, kind, language, name, nickname, objectType,
|
||||
organizations, placesLived, plusOneCount, relationshipStatus, tagline,
|
||||
url, urls, verified;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"etag", @"ETag",
|
||||
@"id", @"identifier",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[GTLPlusPersonEmailsItem class], @"emails",
|
||||
[GTLPlusPersonOrganizationsItem class], @"organizations",
|
||||
[GTLPlusPersonPlacesLivedItem class], @"placesLived",
|
||||
[GTLPlusPersonUrlsItem class], @"urls",
|
||||
nil];
|
||||
return map;
|
||||
}
|
||||
|
||||
+ (void)load {
|
||||
[self registerObjectClassForKind:@"plus#person"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonAgeRange
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonAgeRange
|
||||
@dynamic max, min;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCover
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonCover
|
||||
@dynamic coverInfo, coverPhoto, layout;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonEmailsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonEmailsItem
|
||||
@dynamic primary, type, value;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonImage
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonImage
|
||||
@dynamic url;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonName
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonName
|
||||
@dynamic familyName, formatted, givenName, honorificPrefix, honorificSuffix,
|
||||
middleName;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonOrganizationsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonOrganizationsItem
|
||||
@dynamic department, descriptionProperty, endDate, location, name, primary,
|
||||
startDate, title, type;
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"description"
|
||||
forKey:@"descriptionProperty"];
|
||||
return map;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonPlacesLivedItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonPlacesLivedItem
|
||||
@dynamic primary, value;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonUrlsItem
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonUrlsItem
|
||||
@dynamic primary, type, value;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCoverCoverInfo
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonCoverCoverInfo
|
||||
@dynamic leftImageOffset, topImageOffset;
|
||||
@end
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// GTLPlusPersonCoverCoverPhoto
|
||||
//
|
||||
|
||||
@implementation GTLPlusPersonCoverCoverPhoto
|
||||
@dynamic height, url, width;
|
||||
@end
|
||||
@@ -1,297 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLQueryPlus.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLQueryPlus (12 custom class methods, 15 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLQuery.h"
|
||||
#else
|
||||
#import "GTLQuery.h"
|
||||
#endif
|
||||
|
||||
@class GTLPlusMoment;
|
||||
|
||||
@interface GTLQueryPlus : GTLQuery
|
||||
|
||||
//
|
||||
// Parameters valid on all methods.
|
||||
//
|
||||
|
||||
// Selector specifying which fields to include in a partial response.
|
||||
@property (copy) NSString *fields;
|
||||
|
||||
//
|
||||
// Method-specific parameters; see the comments below for more information.
|
||||
//
|
||||
@property (copy) NSString *activityId;
|
||||
@property (copy) NSString *collection;
|
||||
@property (copy) NSString *commentId;
|
||||
@property (assign) BOOL debug;
|
||||
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
|
||||
@property (copy) NSString *identifier;
|
||||
@property (copy) NSString *language;
|
||||
@property (assign) NSUInteger maxResults;
|
||||
@property (copy) NSString *orderBy;
|
||||
@property (copy) NSString *pageToken;
|
||||
@property (copy) NSString *query;
|
||||
@property (copy) NSString *sortOrder;
|
||||
@property (copy) NSString *targetUrl;
|
||||
@property (copy) NSString *type;
|
||||
@property (copy) NSString *userId;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "activities" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
// Method: plus.activities.get
|
||||
// Get an activity.
|
||||
// Required:
|
||||
// activityId: The ID of the activity to get.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusActivity.
|
||||
+ (id)queryForActivitiesGetWithActivityId:(NSString *)activityId;
|
||||
|
||||
// Method: plus.activities.list
|
||||
// List all of the activities in the specified collection for a particular user.
|
||||
// Required:
|
||||
// userId: The ID of the user to get activities for. The special value "me"
|
||||
// can be used to indicate the authenticated user.
|
||||
// collection: The collection of activities to list.
|
||||
// kGTLPlusCollectionPublic: All public activities created by the specified
|
||||
// user.
|
||||
// Optional:
|
||||
// maxResults: The maximum number of activities to include in the response,
|
||||
// which is used for paging. For any response, the actual number returned
|
||||
// might be less than the specified maxResults. (1..100, default 20)
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusActivityFeed.
|
||||
+ (id)queryForActivitiesListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection;
|
||||
|
||||
// Method: plus.activities.search
|
||||
// Search public activities.
|
||||
// Required:
|
||||
// query: Full-text search query string.
|
||||
// Optional:
|
||||
// language: Specify the preferred language to search with. See search
|
||||
// language codes for available values. (Default en-US)
|
||||
// maxResults: The maximum number of activities to include in the response,
|
||||
// which is used for paging. For any response, the actual number returned
|
||||
// might be less than the specified maxResults. (1..20, default 10)
|
||||
// orderBy: Specifies how to order search results. (Default
|
||||
// kGTLPlusOrderByRecent)
|
||||
// kGTLPlusOrderByBest: Sort activities by relevance to the user, most
|
||||
// relevant first.
|
||||
// kGTLPlusOrderByRecent: Sort activities by published date, most recent
|
||||
// first.
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response. This token can be of
|
||||
// any length.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusActivityFeed.
|
||||
+ (id)queryForActivitiesSearchWithQuery:(NSString *)query;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "comments" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
// Method: plus.comments.get
|
||||
// Get a comment.
|
||||
// Required:
|
||||
// commentId: The ID of the comment to get.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusComment.
|
||||
+ (id)queryForCommentsGetWithCommentId:(NSString *)commentId;
|
||||
|
||||
// Method: plus.comments.list
|
||||
// List all of the comments for an activity.
|
||||
// Required:
|
||||
// activityId: The ID of the activity to get comments for.
|
||||
// Optional:
|
||||
// maxResults: The maximum number of comments to include in the response,
|
||||
// which is used for paging. For any response, the actual number returned
|
||||
// might be less than the specified maxResults. (0..500, default 20)
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response.
|
||||
// sortOrder: The order in which to sort the list of comments. (Default
|
||||
// kGTLPlusSortOrderAscending)
|
||||
// kGTLPlusSortOrderAscending: Sort oldest comments first.
|
||||
// kGTLPlusSortOrderDescending: Sort newest comments first.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusCommentFeed.
|
||||
+ (id)queryForCommentsListWithActivityId:(NSString *)activityId;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "moments" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
// Method: plus.moments.insert
|
||||
// Record a moment representing a user's activity such as making a purchase or
|
||||
// commenting on a blog.
|
||||
// Required:
|
||||
// userId: The ID of the user to record activities for. The only valid values
|
||||
// are "me" and the ID of the authenticated user.
|
||||
// collection: The collection to which to write moments.
|
||||
// kGTLPlusCollectionVault: The default collection for writing new moments.
|
||||
// Optional:
|
||||
// debug: Return the moment as written. Should be used only for debugging.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
// Fetches a GTLPlusMoment.
|
||||
+ (id)queryForMomentsInsertWithObject:(GTLPlusMoment *)object
|
||||
userId:(NSString *)userId
|
||||
collection:(NSString *)collection;
|
||||
|
||||
// Method: plus.moments.list
|
||||
// List all of the moments for a particular user.
|
||||
// Required:
|
||||
// userId: The ID of the user to get moments for. The special value "me" can
|
||||
// be used to indicate the authenticated user.
|
||||
// collection: The collection of moments to list.
|
||||
// kGTLPlusCollectionVault: All moments created by the requesting
|
||||
// application for the authenticated user.
|
||||
// Optional:
|
||||
// maxResults: The maximum number of moments to include in the response, which
|
||||
// is used for paging. For any response, the actual number returned might be
|
||||
// less than the specified maxResults. (1..100, default 20)
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response.
|
||||
// targetUrl: Only moments containing this targetUrl will be returned.
|
||||
// type: Only moments of this type will be returned.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
// Fetches a GTLPlusMomentsFeed.
|
||||
+ (id)queryForMomentsListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection;
|
||||
|
||||
// Method: plus.moments.remove
|
||||
// Delete a moment.
|
||||
// Required:
|
||||
// identifier: The ID of the moment to delete.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
+ (id)queryForMomentsRemoveWithIdentifier:(NSString *)identifier;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "people" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
// Method: plus.people.get
|
||||
// Get a person's profile. If your app uses scope
|
||||
// https://www.googleapis.com/auth/plus.login, this method is guaranteed to
|
||||
// return ageRange and language.
|
||||
// Required:
|
||||
// userId: The ID of the person to get the profile for. The special value "me"
|
||||
// can be used to indicate the authenticated user.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusPerson.
|
||||
+ (id)queryForPeopleGetWithUserId:(NSString *)userId;
|
||||
|
||||
// Method: plus.people.list
|
||||
// List all of the people in the specified collection.
|
||||
// Required:
|
||||
// userId: Get the collection of people for the person identified by the ID or
|
||||
// use "me" to indiciated the authenticated user.
|
||||
// collection: The collection of people to list.
|
||||
// kGTLPlusCollectionVisible: The list of people who this user has added to
|
||||
// one or more circles, limited to the circles visible to the requesting
|
||||
// application.
|
||||
// Optional:
|
||||
// maxResults: The maximum number of people to include in the response, which
|
||||
// is used for paging. For any response, the actual number returned might be
|
||||
// less than the specified maxResults. (1..100, default 100)
|
||||
// orderBy: The order to return people in.
|
||||
// kGTLPlusOrderByAlphabetical: Order the people by their display name.
|
||||
// kGTLPlusOrderByBest: Order people based on the relevence to the viewer.
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusLogin
|
||||
// Fetches a GTLPlusPeopleFeed.
|
||||
+ (id)queryForPeopleListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection;
|
||||
|
||||
// Method: plus.people.listByActivity
|
||||
// List all of the people in the specified collection for a particular activity.
|
||||
// Required:
|
||||
// activityId: The ID of the activity to get the list of people for.
|
||||
// collection: The collection of people to list.
|
||||
// kGTLPlusCollectionPlusoners: List all people who have +1'd this
|
||||
// activity.
|
||||
// kGTLPlusCollectionResharers: List all people who have reshared this
|
||||
// activity.
|
||||
// Optional:
|
||||
// maxResults: The maximum number of people to include in the response, which
|
||||
// is used for paging. For any response, the actual number returned might be
|
||||
// less than the specified maxResults. (1..100, default 20)
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusPeopleFeed.
|
||||
+ (id)queryForPeopleListByActivityWithActivityId:(NSString *)activityId
|
||||
collection:(NSString *)collection;
|
||||
|
||||
// Method: plus.people.search
|
||||
// Search all public profiles.
|
||||
// Required:
|
||||
// query: Specify a query string for full text search of public text in all
|
||||
// profiles.
|
||||
// Optional:
|
||||
// language: Specify the preferred language to search with. See search
|
||||
// language codes for available values. (Default en-US)
|
||||
// maxResults: The maximum number of people to include in the response, which
|
||||
// is used for paging. For any response, the actual number returned might be
|
||||
// less than the specified maxResults. (1..20, default 10)
|
||||
// pageToken: The continuation token, which is used to page through large
|
||||
// result sets. To get the next page of results, set this parameter to the
|
||||
// value of "nextPageToken" from the previous response. This token can be of
|
||||
// any length.
|
||||
// Authorization scope(s):
|
||||
// kGTLAuthScopePlusMe
|
||||
// Fetches a GTLPlusPeopleFeed.
|
||||
+ (id)queryForPeopleSearchWithQuery:(NSString *)query;
|
||||
|
||||
@end
|
||||
@@ -1,182 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLQueryPlus.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLQueryPlus (12 custom class methods, 15 custom properties)
|
||||
|
||||
#import "GTLQueryPlus.h"
|
||||
|
||||
#import "GTLPlusActivity.h"
|
||||
#import "GTLPlusActivityFeed.h"
|
||||
#import "GTLPlusComment.h"
|
||||
#import "GTLPlusCommentFeed.h"
|
||||
#import "GTLPlusMoment.h"
|
||||
#import "GTLPlusMomentsFeed.h"
|
||||
#import "GTLPlusPeopleFeed.h"
|
||||
#import "GTLPlusPerson.h"
|
||||
|
||||
@implementation GTLQueryPlus
|
||||
|
||||
@dynamic activityId, collection, commentId, debug, fields, identifier, language,
|
||||
maxResults, orderBy, pageToken, query, sortOrder, targetUrl, type,
|
||||
userId;
|
||||
|
||||
+ (NSDictionary *)parameterNameMap {
|
||||
NSDictionary *map =
|
||||
[NSDictionary dictionaryWithObject:@"id"
|
||||
forKey:@"identifier"];
|
||||
return map;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "activities" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForActivitiesGetWithActivityId:(NSString *)activityId {
|
||||
NSString *methodName = @"plus.activities.get";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.activityId = activityId;
|
||||
query.expectedObjectClass = [GTLPlusActivity class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForActivitiesListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.activities.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusActivityFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForActivitiesSearchWithQuery:(NSString *)query_param {
|
||||
NSString *methodName = @"plus.activities.search";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.query = query_param;
|
||||
query.expectedObjectClass = [GTLPlusActivityFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "comments" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForCommentsGetWithCommentId:(NSString *)commentId {
|
||||
NSString *methodName = @"plus.comments.get";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.commentId = commentId;
|
||||
query.expectedObjectClass = [GTLPlusComment class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForCommentsListWithActivityId:(NSString *)activityId {
|
||||
NSString *methodName = @"plus.comments.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.activityId = activityId;
|
||||
query.expectedObjectClass = [GTLPlusCommentFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "moments" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForMomentsInsertWithObject:(GTLPlusMoment *)object
|
||||
userId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
if (object == nil) {
|
||||
GTL_DEBUG_ASSERT(object != nil, @"%@ got a nil object", NSStringFromSelector(_cmd));
|
||||
return nil;
|
||||
}
|
||||
NSString *methodName = @"plus.moments.insert";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.bodyObject = object;
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusMoment class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForMomentsListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.moments.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusMomentsFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForMomentsRemoveWithIdentifier:(NSString *)identifier {
|
||||
NSString *methodName = @"plus.moments.remove";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.identifier = identifier;
|
||||
return query;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark "people" methods
|
||||
// These create a GTLQueryPlus object.
|
||||
|
||||
+ (id)queryForPeopleGetWithUserId:(NSString *)userId {
|
||||
NSString *methodName = @"plus.people.get";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.expectedObjectClass = [GTLPlusPerson class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForPeopleListWithUserId:(NSString *)userId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.people.list";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.userId = userId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusPeopleFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForPeopleListByActivityWithActivityId:(NSString *)activityId
|
||||
collection:(NSString *)collection {
|
||||
NSString *methodName = @"plus.people.listByActivity";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.activityId = activityId;
|
||||
query.collection = collection;
|
||||
query.expectedObjectClass = [GTLPlusPeopleFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
+ (id)queryForPeopleSearchWithQuery:(NSString *)query_param {
|
||||
NSString *methodName = @"plus.people.search";
|
||||
GTLQueryPlus *query = [self queryWithMethodName:methodName];
|
||||
query.query = query_param;
|
||||
query.expectedObjectClass = [GTLPlusPeopleFeed class];
|
||||
return query;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLServicePlus.h
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLServicePlus (0 custom class methods, 0 custom properties)
|
||||
|
||||
#if GTL_BUILT_AS_FRAMEWORK
|
||||
#import "GTL/GTLService.h"
|
||||
#else
|
||||
#import "GTLService.h"
|
||||
#endif
|
||||
|
||||
@interface GTLServicePlus : GTLService
|
||||
|
||||
// No new methods
|
||||
|
||||
// Clients should create a standard query with any of the class methods in
|
||||
// GTLQueryPlus.h. The query can the be sent with GTLService's execute methods,
|
||||
//
|
||||
// - (GTLServiceTicket *)executeQuery:(GTLQuery *)query
|
||||
// completionHandler:(void (^)(GTLServiceTicket *ticket,
|
||||
// id object, NSError *error))handler;
|
||||
// or
|
||||
// - (GTLServiceTicket *)executeQuery:(GTLQuery *)query
|
||||
// delegate:(id)delegate
|
||||
// didFinishSelector:(SEL)finishedSelector;
|
||||
//
|
||||
// where finishedSelector has a signature of:
|
||||
//
|
||||
// - (void)serviceTicket:(GTLServiceTicket *)ticket
|
||||
// finishedWithObject:(id)object
|
||||
// error:(NSError *)error;
|
||||
//
|
||||
// The object passed to the completion handler or delegate method
|
||||
// is a subclass of GTLObject, determined by the query method executed.
|
||||
|
||||
@end
|
||||
@@ -1,71 +0,0 @@
|
||||
/* Copyright (c) 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLServicePlus.m
|
||||
//
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NOTE: This file is generated from Google APIs Discovery Service.
|
||||
// Service:
|
||||
// Google+ API (plus/v1)
|
||||
// Description:
|
||||
// The Google+ API enables developers to build on top of the Google+ platform.
|
||||
// Documentation:
|
||||
// https://developers.google.com/+/api/
|
||||
// Classes:
|
||||
// GTLServicePlus (0 custom class methods, 0 custom properties)
|
||||
|
||||
#import "GTLPlus.h"
|
||||
|
||||
@implementation GTLServicePlus
|
||||
|
||||
#if DEBUG
|
||||
// Method compiled in debug builds just to check that all the needed support
|
||||
// classes are present at link time.
|
||||
+ (NSArray *)checkClasses {
|
||||
NSArray *classes = [NSArray arrayWithObjects:
|
||||
[GTLQueryPlus class],
|
||||
[GTLPlusAcl class],
|
||||
[GTLPlusAclentryResource class],
|
||||
[GTLPlusActivity class],
|
||||
[GTLPlusActivityFeed class],
|
||||
[GTLPlusComment class],
|
||||
[GTLPlusCommentFeed class],
|
||||
[GTLPlusItemScope class],
|
||||
[GTLPlusMoment class],
|
||||
[GTLPlusMomentsFeed class],
|
||||
[GTLPlusPeopleFeed class],
|
||||
[GTLPlusPerson class],
|
||||
nil];
|
||||
return classes;
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Version from discovery.
|
||||
self.apiVersion = @"v1";
|
||||
|
||||
// From discovery. Where to send JSON-RPC.
|
||||
// Turn off prettyPrint for this service to save bandwidth (especially on
|
||||
// mobile). The fetcher logging will pretty print.
|
||||
self.rpcURL = [NSURL URLWithString:@"https://www.googleapis.com/rpc?prettyPrint=false"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,135 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLQuery.h
|
||||
//
|
||||
|
||||
// Query documentation:
|
||||
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Query_Operations
|
||||
|
||||
#import "GTLObject.h"
|
||||
#import "GTLUploadParameters.h"
|
||||
|
||||
@protocol GTLQueryProtocol <NSObject, NSCopying>
|
||||
- (BOOL)isBatchQuery;
|
||||
- (BOOL)shouldSkipAuthorization;
|
||||
- (void)executionDidStop;
|
||||
- (NSDictionary *)additionalHTTPHeaders;
|
||||
- (GTLUploadParameters *)uploadParameters;
|
||||
@end
|
||||
|
||||
@protocol GTLQueryCollectionProtocol
|
||||
@optional
|
||||
@property (retain) NSString *pageToken;
|
||||
@property (retain) NSNumber *startIndex;
|
||||
@end
|
||||
|
||||
@class GTLServiceTicket;
|
||||
|
||||
@interface GTLQuery : NSObject <GTLQueryProtocol> {
|
||||
@private
|
||||
NSString *methodName_;
|
||||
NSMutableDictionary *json_;
|
||||
GTLObject *bodyObject_;
|
||||
NSMutableDictionary *childCache_;
|
||||
NSString *requestID_;
|
||||
GTLUploadParameters *uploadParameters_;
|
||||
NSDictionary *urlQueryParameters_;
|
||||
NSDictionary *additionalHTTPHeaders_;
|
||||
Class expectedObjectClass_;
|
||||
BOOL skipAuthorization_;
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
void (^completionBlock_)(GTLServiceTicket *ticket, id object, NSError *error);
|
||||
#elif !__LP64__
|
||||
// Placeholders: for 32-bit builds, keep the size of the object's ivar section
|
||||
// the same with and without blocks
|
||||
id completionPlaceholder_;
|
||||
#endif
|
||||
}
|
||||
|
||||
// The rpc method name.
|
||||
@property (readonly) NSString *methodName;
|
||||
|
||||
// The JSON dictionary of all the parameters set on this query.
|
||||
@property (retain) NSMutableDictionary *JSON;
|
||||
|
||||
// The object set to be uploaded with the query.
|
||||
@property (retain) GTLObject *bodyObject;
|
||||
|
||||
// Each query must have a request ID string. The user may replace the
|
||||
// default assigned request ID with a custom string, provided that if
|
||||
// used in a batch query, all request IDs in the batch must be unique.
|
||||
@property (copy) NSString *requestID;
|
||||
|
||||
// For queries which support file upload, the MIME type and file handle
|
||||
// or data must be provided.
|
||||
@property (copy) GTLUploadParameters *uploadParameters;
|
||||
|
||||
// Any url query parameters to add to the query (useful for debugging with some
|
||||
// services).
|
||||
@property (copy) NSDictionary *urlQueryParameters;
|
||||
|
||||
// Any additional HTTP headers for this query. Not valid when this query
|
||||
// is added to a batch.
|
||||
//
|
||||
// These headers override the same keys from the service object's
|
||||
// additionalHTTPHeaders.
|
||||
@property (copy) NSDictionary *additionalHTTPHeaders;
|
||||
|
||||
// The GTLObject subclass expected for results (used if the result doesn't
|
||||
// include a kind attribute).
|
||||
@property (assign) Class expectedObjectClass;
|
||||
|
||||
// Clients may set this to YES to disallow authorization. Defaults to NO.
|
||||
@property (assign) BOOL shouldSkipAuthorization;
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
// Clients may provide an optional callback block to be called immediately
|
||||
// before the executeQuery: callback.
|
||||
//
|
||||
// The completionBlock property is particularly useful for queries executed
|
||||
// in a batch.
|
||||
//
|
||||
// Errors passed to the completionBlock will have an "underlying" GTLErrorObject
|
||||
// when the server returned an error for this specific query:
|
||||
//
|
||||
// GTLErrorObject *errorObj = [GTLErrorObject underlyingObjectForError:error];
|
||||
// if (errorObj) {
|
||||
// // the server returned this error for this specific query
|
||||
// } else {
|
||||
// // the batch execution failed
|
||||
// }
|
||||
@property (copy) void (^completionBlock)(GTLServiceTicket *ticket, id object, NSError *error);
|
||||
#endif
|
||||
|
||||
// methodName is the RPC method name to use.
|
||||
+ (id)queryWithMethodName:(NSString *)methodName GTL_NONNULL((1));
|
||||
|
||||
// methodName is the RPC method name to use.
|
||||
- (id)initWithMethodName:(NSString *)method GTL_NONNULL((1));
|
||||
|
||||
// If you need to set a parameter that is not listed as a property for a
|
||||
// query class, you can do so via this api. If you need to clear it after
|
||||
// setting, pass nil for obj.
|
||||
- (void)setCustomParameter:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
|
||||
|
||||
// Auto-generated request IDs
|
||||
+ (NSString *)nextRequestID;
|
||||
|
||||
// Methods for subclasses to override.
|
||||
+ (NSDictionary *)parameterNameMap;
|
||||
+ (NSDictionary *)arrayPropertyToClassMap;
|
||||
@end
|
||||
@@ -1,267 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLQuery.m
|
||||
//
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
#import "GTLQuery.h"
|
||||
#import "GTLRuntimeCommon.h"
|
||||
#import "GTLUtilities.h"
|
||||
|
||||
@interface GTLQuery () <GTLRuntimeCommon>
|
||||
@end
|
||||
|
||||
@implementation GTLQuery
|
||||
|
||||
// Implementation Note: bodyObject could be done as a dynamic property and map
|
||||
// it to the key "resource". But we expose the object on the ServiceTicket
|
||||
// for developers, and so sending it through the plumbing already in the
|
||||
// parameters and outside of that gets into a grey area. For requests sent
|
||||
// via this class, we don't need to touch the JSON, but for developers that
|
||||
// have to use the lower level apis for something we'd need to know to add
|
||||
// it to the JSON.
|
||||
|
||||
@synthesize methodName = methodName_,
|
||||
JSON = json_,
|
||||
bodyObject = bodyObject_,
|
||||
requestID = requestID_,
|
||||
uploadParameters = uploadParameters_,
|
||||
urlQueryParameters = urlQueryParameters_,
|
||||
additionalHTTPHeaders = additionalHTTPHeaders_,
|
||||
expectedObjectClass = expectedObjectClass_,
|
||||
shouldSkipAuthorization = skipAuthorization_;
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
@synthesize completionBlock = completionBlock_;
|
||||
#endif
|
||||
|
||||
+ (id)queryWithMethodName:(NSString *)methodName {
|
||||
return [[[self alloc] initWithMethodName:methodName] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithMethodName:(NSString *)methodName {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
requestID_ = [[[self class] nextRequestID] retain];
|
||||
|
||||
methodName_ = [methodName copy];
|
||||
if ([methodName_ length] == 0) {
|
||||
[self release];
|
||||
self = nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[methodName_ release];
|
||||
[json_ release];
|
||||
[bodyObject_ release];
|
||||
[childCache_ release];
|
||||
[requestID_ release];
|
||||
[uploadParameters_ release];
|
||||
[urlQueryParameters_ release];
|
||||
[additionalHTTPHeaders_ release];
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
[completionBlock_ release];
|
||||
#endif
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLQuery *query =
|
||||
[[[self class] allocWithZone:zone] initWithMethodName:self.methodName];
|
||||
|
||||
if ([json_ count] > 0) {
|
||||
// Deep copy the parameters
|
||||
CFPropertyListRef ref = CFPropertyListCreateDeepCopy(kCFAllocatorDefault,
|
||||
json_, kCFPropertyListMutableContainers);
|
||||
query.JSON = [NSMakeCollectable(ref) autorelease];
|
||||
}
|
||||
query.bodyObject = self.bodyObject;
|
||||
query.requestID = self.requestID;
|
||||
query.uploadParameters = self.uploadParameters;
|
||||
query.urlQueryParameters = self.urlQueryParameters;
|
||||
query.additionalHTTPHeaders = self.additionalHTTPHeaders;
|
||||
query.expectedObjectClass = self.expectedObjectClass;
|
||||
query.shouldSkipAuthorization = self.shouldSkipAuthorization;
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
query.completionBlock = self.completionBlock;
|
||||
#endif
|
||||
return query;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSArray *keys = [self.JSON allKeys];
|
||||
NSArray *params = [keys sortedArrayUsingSelector:@selector(compare:)];
|
||||
NSString *paramsSummary = @"";
|
||||
if ([params count] > 0) {
|
||||
paramsSummary = [NSString stringWithFormat:@" params:(%@)",
|
||||
[params componentsJoinedByString:@","]];
|
||||
}
|
||||
|
||||
keys = [self.urlQueryParameters allKeys];
|
||||
NSArray *urlQParams = [keys sortedArrayUsingSelector:@selector(compare:)];
|
||||
NSString *urlQParamsSummary = @"";
|
||||
if ([urlQParams count] > 0) {
|
||||
urlQParamsSummary = [NSString stringWithFormat:@" urlQParams:(%@)",
|
||||
[urlQParams componentsJoinedByString:@","]];
|
||||
}
|
||||
|
||||
GTLObject *bodyObj = self.bodyObject;
|
||||
NSString *bodyObjSummary = @"";
|
||||
if (bodyObj != nil) {
|
||||
bodyObjSummary = [NSString stringWithFormat:@" bodyObject:%@", [bodyObj class]];
|
||||
}
|
||||
|
||||
NSString *uploadStr = @"";
|
||||
GTLUploadParameters *uploadParams = self.uploadParameters;
|
||||
if (uploadParams) {
|
||||
uploadStr = [NSString stringWithFormat:@" %@", uploadParams];
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"%@ %p: {method:%@%@%@%@%@}",
|
||||
[self class], self, self.methodName,
|
||||
paramsSummary, urlQParamsSummary, bodyObjSummary, uploadStr];
|
||||
}
|
||||
|
||||
- (void)setCustomParameter:(id)obj forKey:(NSString *)key {
|
||||
[self setJSONValue:obj forKey:key];
|
||||
}
|
||||
|
||||
- (BOOL)isBatchQuery {
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)executionDidStop {
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
self.completionBlock = nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSString *)nextRequestID {
|
||||
static unsigned long lastRequestID = 0;
|
||||
NSString *result;
|
||||
|
||||
@synchronized([GTLQuery class]) {
|
||||
++lastRequestID;
|
||||
result = [NSString stringWithFormat:@"gtl_%lu",
|
||||
(unsigned long) lastRequestID];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark GTLRuntimeCommon Support
|
||||
|
||||
- (void)setJSONValue:(id)obj forKey:(NSString *)key {
|
||||
NSMutableDictionary *dict = self.JSON;
|
||||
if (dict == nil && obj != nil) {
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
self.JSON = dict;
|
||||
}
|
||||
[dict setValue:obj forKey:key];
|
||||
}
|
||||
|
||||
- (id)JSONValueForKey:(NSString *)key {
|
||||
id obj = [self.JSON objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
// There is no property for childCache_ as there shouldn't be KVC/KVO
|
||||
// support for it, it's an implementation detail.
|
||||
|
||||
- (void)setCacheChild:(id)obj forKey:(NSString *)key {
|
||||
if (childCache_ == nil && obj != nil) {
|
||||
childCache_ =
|
||||
[[NSMutableDictionary alloc] initWithObjectsAndKeys:obj, key, nil];
|
||||
} else {
|
||||
[childCache_ setValue:obj forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (id)cacheChildForKey:(NSString *)key {
|
||||
id obj = [childCache_ objectForKey:key];
|
||||
return obj;
|
||||
}
|
||||
|
||||
#pragma mark Methods for Subclasses to Override
|
||||
|
||||
+ (NSDictionary *)parameterNameMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMap {
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Utilities
|
||||
|
||||
static NSMutableDictionary *gParameterNameMapCache = nil;
|
||||
static NSMutableDictionary *gArrayPropertyToClassMapCache = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
// note that initialize is guaranteed by the runtime to be called in a
|
||||
// thread-safe manner
|
||||
if (gParameterNameMapCache == nil) {
|
||||
gParameterNameMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
if (gArrayPropertyToClassMapCache == nil) {
|
||||
gArrayPropertyToClassMapCache = [GTLUtilities newStaticDictionary];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertyToJSONKeyMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(parameterNameMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLQuery class]
|
||||
cache:gParameterNameMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)arrayPropertyToClassMapForClass:(Class<GTLRuntimeCommon>)aClass {
|
||||
NSDictionary *resultMap =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:@selector(arrayPropertyToClassMap)
|
||||
startClass:aClass
|
||||
ancestorClass:[GTLQuery class]
|
||||
cache:gArrayPropertyToClassMapCache];
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
#pragma mark Runtime Support
|
||||
|
||||
- (NSDictionary *)surrogates {
|
||||
// Stub method just needed for RumtimeCommon, query doesn't use surrogates.
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (Class<GTLRuntimeCommon>)ancestorClass {
|
||||
return [GTLQuery class];
|
||||
}
|
||||
|
||||
+ (BOOL)resolveInstanceMethod:(SEL)sel {
|
||||
BOOL resolved = [GTLRuntimeCommon resolveInstanceMethod:sel onClass:self];
|
||||
if (resolved)
|
||||
return YES;
|
||||
|
||||
return [super resolveInstanceMethod:sel];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,57 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLRuntimeCommon.h
|
||||
//
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTLDefines.h"
|
||||
|
||||
// This protocol and support class are an internal implementation detail so
|
||||
// GTLObject and GTLQuery can share some code.
|
||||
|
||||
@protocol GTLRuntimeCommon <NSObject>
|
||||
@required
|
||||
// Get/Set properties
|
||||
- (void)setJSONValue:(id)obj forKey:(NSString *)key;
|
||||
- (id)JSONValueForKey:(NSString *)key;
|
||||
// Child cache
|
||||
- (void)setCacheChild:(id)obj forKey:(NSString *)key;
|
||||
- (id)cacheChildForKey:(NSString *)key;
|
||||
// Surrogate class mappings.
|
||||
- (NSDictionary *)surrogates;
|
||||
// Key map
|
||||
+ (NSDictionary *)propertyToJSONKeyMapForClass:(Class<GTLRuntimeCommon>)aClass;
|
||||
// Array item types
|
||||
+ (NSDictionary *)arrayPropertyToClassMapForClass:(Class<GTLRuntimeCommon>)aClass;
|
||||
// The parent class for dynamic support
|
||||
+ (Class<GTLRuntimeCommon>)ancestorClass;
|
||||
@end
|
||||
|
||||
@interface GTLRuntimeCommon : NSObject
|
||||
// Wire things up.
|
||||
+ (BOOL)resolveInstanceMethod:(SEL)sel onClass:(Class)onClass;
|
||||
// Helpers
|
||||
+ (id)objectFromJSON:(id)json
|
||||
defaultClass:(Class)defaultClass
|
||||
surrogates:(NSDictionary *)surrogates
|
||||
isCacheable:(BOOL*)isCacheable;
|
||||
+ (id)jsonFromAPIObject:(id)obj
|
||||
expectedClass:(Class)expectedClass
|
||||
isCacheable:(BOOL*)isCacheable;
|
||||
@end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,607 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLService.h
|
||||
//
|
||||
|
||||
// Service object documentation:
|
||||
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Services_and_Tickets
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTLDefines.h"
|
||||
#import "GTMHTTPFetcherService.h"
|
||||
#import "GTLBatchQuery.h"
|
||||
#import "GTLBatchResult.h"
|
||||
#import "GTLDateTime.h"
|
||||
#import "GTLErrorObject.h"
|
||||
#import "GTLFramework.h"
|
||||
#import "GTLJSONParser.h"
|
||||
#import "GTLObject.h"
|
||||
#import "GTLQuery.h"
|
||||
#import "GTLUtilities.h"
|
||||
|
||||
#undef _EXTERN
|
||||
#undef _INITIALIZE_AS
|
||||
#ifdef GTLSERVICE_DEFINE_GLOBALS
|
||||
#define _EXTERN
|
||||
#define _INITIALIZE_AS(x) =x
|
||||
#else
|
||||
#define _EXTERN extern
|
||||
#define _INITIALIZE_AS(x)
|
||||
#endif
|
||||
|
||||
// Error domains
|
||||
_EXTERN NSString* const kGTLServiceErrorDomain _INITIALIZE_AS(@"com.google.GTLServiceDomain");
|
||||
enum {
|
||||
kGTLErrorQueryResultMissing = -3000,
|
||||
kGTLErrorWaitTimedOut = -3001
|
||||
};
|
||||
|
||||
_EXTERN NSString* const kGTLJSONRPCErrorDomain _INITIALIZE_AS(@"com.google.GTLJSONRPCErrorDomain");
|
||||
|
||||
// We'll consistently store the server error string in the userInfo under
|
||||
// this key
|
||||
_EXTERN NSString* const kGTLServerErrorStringKey _INITIALIZE_AS(@"error");
|
||||
|
||||
_EXTERN Class const kGTLUseRegisteredClass _INITIALIZE_AS(nil);
|
||||
|
||||
_EXTERN NSUInteger const kGTLStandardUploadChunkSize _INITIALIZE_AS(NSUIntegerMax);
|
||||
|
||||
// When servers return us structured JSON errors, the NSError will
|
||||
// contain a GTLErrorObject in the userInfo dictionary under the key
|
||||
// kGTLStructuredErrorsKey
|
||||
_EXTERN NSString* const kGTLStructuredErrorKey _INITIALIZE_AS(@"GTLStructuredError");
|
||||
|
||||
// When specifying an ETag for updating or deleting a single entry, use
|
||||
// kGTLETagWildcard to tell the server to replace the current value
|
||||
// unconditionally. Do not use this in entries in a batch feed.
|
||||
_EXTERN NSString* const kGTLETagWildcard _INITIALIZE_AS(@"*");
|
||||
|
||||
// Notifications when parsing of a fetcher feed or entry begins or ends
|
||||
_EXTERN NSString* const kGTLServiceTicketParsingStartedNotification _INITIALIZE_AS(@"kGTLServiceTicketParsingStartedNotification");
|
||||
_EXTERN NSString* const kGTLServiceTicketParsingStoppedNotification _INITIALIZE_AS(@"kGTLServiceTicketParsingStoppedNotification");
|
||||
|
||||
@class GTLServiceTicket;
|
||||
|
||||
// Block types used for fetch callbacks
|
||||
//
|
||||
// These typedefs are not used in the header file method declarations
|
||||
// since it's more useful when code sense expansions show the argument
|
||||
// types rather than the typedefs
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
typedef void (^GTLServiceCompletionHandler)(GTLServiceTicket *ticket, id object, NSError *error);
|
||||
|
||||
typedef void (^GTLServiceUploadProgressBlock)(GTLServiceTicket *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
|
||||
#else
|
||||
typedef void *GTLServiceCompletionHandler;
|
||||
|
||||
typedef void *GTLServiceUploadProgressBlock;
|
||||
#endif // NS_BLOCKS_AVAILABLE
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
// Service base class
|
||||
//
|
||||
|
||||
@interface GTLService : NSObject {
|
||||
@private
|
||||
NSOperationQueue *parseQueue_;
|
||||
NSString *userAgent_;
|
||||
GTMHTTPFetcherService *fetcherService_;
|
||||
NSString *userAgentAddition_;
|
||||
|
||||
NSMutableDictionary *serviceProperties_; // initial values for properties in future tickets
|
||||
|
||||
NSDictionary *surrogates_; // initial value for surrogates in future tickets
|
||||
|
||||
SEL uploadProgressSelector_; // optional
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
BOOL (^retryBlock_)(GTLServiceTicket *, BOOL, NSError *);
|
||||
void (^uploadProgressBlock_)(GTLServiceTicket *ticket,
|
||||
unsigned long long numberOfBytesRead,
|
||||
unsigned long long dataLength);
|
||||
#elif !__LP64__
|
||||
// Placeholders: for 32-bit builds, keep the size of the object's ivar section
|
||||
// the same with and without blocks
|
||||
id retryPlaceholder_;
|
||||
id uploadProgressPlaceholder_;
|
||||
#endif
|
||||
|
||||
NSUInteger uploadChunkSize_; // zero when uploading via multi-part MIME http body
|
||||
|
||||
BOOL isRetryEnabled_; // user allows auto-retries
|
||||
SEL retrySelector_; // optional; set with setServiceRetrySelector
|
||||
NSTimeInterval maxRetryInterval_; // default to 600. seconds
|
||||
|
||||
BOOL shouldFetchNextPages_;
|
||||
|
||||
NSString *apiKey_;
|
||||
BOOL isRESTDataWrapperRequired_;
|
||||
NSString *apiVersion_;
|
||||
NSURL *rpcURL_;
|
||||
NSURL *rpcUploadURL_;
|
||||
NSDictionary *urlQueryParameters_;
|
||||
NSDictionary *additionalHTTPHeaders_;
|
||||
}
|
||||
|
||||
#pragma mark Query Execution
|
||||
|
||||
// The finishedSelector has a signature matching:
|
||||
//
|
||||
// - (void)serviceTicket:(GTLServiceTicket *)ticket
|
||||
// finishedWithObject:(GTLObject *)object
|
||||
// error:(NSError *)error
|
||||
//
|
||||
// If an error occurs, the error parameter will be non-nil. Otherwise,
|
||||
// the object parameter will point to a GTLObject, if any was returned by
|
||||
// the fetch. (Delete fetches return no object, so the second parameter will
|
||||
// be nil.)
|
||||
//
|
||||
// If the query object is a GTLBatchQuery, the object passed to the callback
|
||||
// will be a GTLBatchResult; see the batch query documentation:
|
||||
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Batch_Operations
|
||||
|
||||
- (GTLServiceTicket *)executeQuery:(id<GTLQueryProtocol>)query
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
- (GTLServiceTicket *)executeQuery:(id<GTLQueryProtocol>)query
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
#endif
|
||||
|
||||
// Automatic page fetches
|
||||
//
|
||||
// Tickets can optionally do a sequence of fetches for queries where
|
||||
// repeated requests with nextPageToken or nextStartIndex values is required to
|
||||
// retrieve items of all pages of the response collection. The client's
|
||||
// callback is invoked only when all items have been retrieved, or an error has
|
||||
// occurred. During the fetch, the items accumulated so far are available from
|
||||
// the ticket.
|
||||
//
|
||||
// Note that the final object may be a combination of multiple page responses
|
||||
// so it may not be the same as if all results had been returned in a single
|
||||
// page. Some fields of the response such as total item counts may reflect only
|
||||
// the final page's values.
|
||||
//
|
||||
// Automatic page fetches will return an error if more than 25 page fetches are
|
||||
// required. For debug builds, this will log a warning to the console when more
|
||||
// than 2 page fetches occur, as a reminder that the query's maxResults
|
||||
// parameter should probably be increased to specify more items returned per
|
||||
// page.
|
||||
//
|
||||
// Default value is NO.
|
||||
@property (nonatomic, assign) BOOL shouldFetchNextPages;
|
||||
|
||||
// Retrying; see comments on retry support at the top of GTMHTTPFetcher.
|
||||
//
|
||||
// Default value is NO.
|
||||
@property (nonatomic, assign, getter=isRetryEnabled) BOOL retryEnabled;
|
||||
|
||||
// Some services require a developer key for quotas and limits. Setting this
|
||||
// will include it on all request sent to this service via a GTLQuery class.
|
||||
@property (nonatomic, copy) NSString *APIKey;
|
||||
|
||||
// An authorizer adds user authentication headers to the request as needed.
|
||||
@property (nonatomic, retain) id <GTMFetcherAuthorizationProtocol> authorizer;
|
||||
|
||||
// Retry selector is optional for retries.
|
||||
//
|
||||
// If present, it should have the signature:
|
||||
// -(BOOL)ticket:(GTLServiceTicket *)ticket willRetry:(BOOL)suggestedWillRetry forError:(NSError *)error
|
||||
// and return YES to cause a retry. Note that unlike the GTMHTTPFetcher retry
|
||||
// selector, this selector's first argument is a ticket, not a fetcher.
|
||||
|
||||
@property (nonatomic, assign) SEL retrySelector;
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
@property (copy) BOOL (^retryBlock)(GTLServiceTicket *ticket, BOOL suggestedWillRetry, NSError *error);
|
||||
#endif
|
||||
|
||||
@property (nonatomic, assign) NSTimeInterval maxRetryInterval;
|
||||
|
||||
//
|
||||
// Fetches may be done using RPC or REST APIs, without creating
|
||||
// a GTLQuery object
|
||||
//
|
||||
|
||||
#pragma mark RPC Fetch Methods
|
||||
|
||||
//
|
||||
// These methods may be used for RPC fetches without creating a GTLQuery object
|
||||
//
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
|
||||
parameters:(NSDictionary *)parameters
|
||||
objectClass:(Class)objectClass
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
|
||||
insertingObject:(GTLObject *)bodyObject
|
||||
objectClass:(Class)objectClass
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
|
||||
parameters:(NSDictionary *)parameters
|
||||
insertingObject:(GTLObject *)bodyObject
|
||||
objectClass:(Class)objectClass
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
|
||||
parameters:(NSDictionary *)parameters
|
||||
objectClass:(Class)objectClass
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
|
||||
insertingObject:(GTLObject *)bodyObject
|
||||
objectClass:(Class)objectClass
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
|
||||
parameters:(NSDictionary *)parameters
|
||||
insertingObject:(GTLObject *)bodyObject
|
||||
objectClass:(Class)objectClass
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
#endif
|
||||
|
||||
#pragma mark REST Fetch Methods
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
|
||||
objectClass:(Class)objectClass
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchPublicObjectWithURL:(NSURL *)objectURL
|
||||
objectClass:(Class)objectClass
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectByInsertingObject:(GTLObject *)bodyToPut
|
||||
forURL:(NSURL *)destinationURL
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1,2));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectByUpdatingObject:(GTLObject *)bodyToPut
|
||||
forURL:(NSURL *)destinationURL
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1,2));
|
||||
|
||||
- (GTLServiceTicket *)deleteResourceURL:(NSURL *)destinationURL
|
||||
ETag:(NSString *)etagOrNil
|
||||
delegate:(id)delegate
|
||||
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectByInsertingObject:(GTLObject *)bodyToPut
|
||||
forURL:(NSURL *)destinationURL
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)fetchObjectByUpdatingObject:(GTLObject *)bodyToPut
|
||||
forURL:(NSURL *)destinationURL
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
|
||||
- (GTLServiceTicket *)deleteResourceURL:(NSURL *)destinationURL
|
||||
ETag:(NSString *)etagOrNil
|
||||
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
|
||||
#endif
|
||||
|
||||
#pragma mark User Properties
|
||||
|
||||
// Properties and userData are supported for client convenience.
|
||||
//
|
||||
// Property keys beginning with _ are reserved by the library.
|
||||
//
|
||||
// The service properties dictionary is copied to become the initial property
|
||||
// dictionary for each ticket.
|
||||
- (void)setServiceProperty:(id)obj forKey:(NSString *)key GTL_NONNULL((2)); // pass nil obj to remove property
|
||||
- (id)servicePropertyForKey:(NSString *)key GTL_NONNULL((1));
|
||||
|
||||
@property (nonatomic, copy) NSDictionary *serviceProperties;
|
||||
|
||||
// The service userData becomes the initial value for each future ticket's
|
||||
// userData.
|
||||
@property (nonatomic, retain) id serviceUserData;
|
||||
|
||||
#pragma mark Request Settings
|
||||
|
||||
// Set the surrogates to be used for future tickets. Surrogates are subclasses
|
||||
// to be used instead of standard classes when creating objects from the JSON.
|
||||
// For example, this code will make the framework generate objects
|
||||
// using MyCalendarItemSubclass instead of GTLItemCalendar and
|
||||
// MyCalendarEventSubclass instead of GTLItemCalendarEvent.
|
||||
//
|
||||
// NSDictionary *surrogates = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
// [MyCalendarEntrySubclass class], [GTLItemCalendar class],
|
||||
// [MyCalendarEventSubclass class], [GTLItemCalendarEvent class],
|
||||
// nil];
|
||||
// [calendarService setServiceSurrogates:surrogates];
|
||||
//
|
||||
@property (nonatomic, retain) NSDictionary *surrogates;
|
||||
|
||||
// On iOS 4 and later, the fetch may optionally continue in the background
|
||||
// until finished or stopped by OS expiration.
|
||||
//
|
||||
// The default value is NO.
|
||||
//
|
||||
// For Mac OS X, background fetches are always supported, and this property
|
||||
// is ignored.
|
||||
@property (nonatomic, assign) BOOL shouldFetchInBackground;
|
||||
|
||||
// Callbacks can be invoked on an operation queue rather than via the run loop
|
||||
// starting on 10.7 and iOS 6. Do not specify both run loop modes and an
|
||||
// operation queue. Specifying a delegate queue typically looks like this:
|
||||
//
|
||||
// service.delegateQueue = [[[NSOperationQueue alloc] init] autorelease];
|
||||
//
|
||||
// Since the callbacks will be on a thread of the operation queue, the client
|
||||
// may re-dispatch from the callbacks to a known dispatch queue or to the
|
||||
// main queue.
|
||||
@property (nonatomic, retain) NSOperationQueue *delegateQueue;
|
||||
|
||||
// Run loop modes are used for scheduling NSURLConnections.
|
||||
//
|
||||
// The default value, nil, schedules connections using the current run
|
||||
// loop mode. To use the service during a modal dialog, be sure to specify
|
||||
// NSModalPanelRunLoopMode as one of the modes.
|
||||
@property (nonatomic, retain) NSArray *runLoopModes;
|
||||
|
||||
// Applications needing an additional identifier in the server logs may specify
|
||||
// one.
|
||||
@property (nonatomic, copy) NSString *userAgentAddition;
|
||||
|
||||
// Applications have a default user-agent based on the application signature
|
||||
// in the Info.plist settings. Most applications should not explicitly set
|
||||
// this property.
|
||||
@property (nonatomic, copy) NSString *userAgent;
|
||||
|
||||
// The request user agent includes the library and OS version appended to the
|
||||
// base userAgent, along with the optional addition string.
|
||||
@property (nonatomic, readonly) NSString *requestUserAgent;
|
||||
|
||||
// Applications may call requestForURL:httpMethod to get a request with the
|
||||
// proper user-agent and ETag headers
|
||||
//
|
||||
// For http method, pass nil (for default GET method), POST, PUT, or DELETE
|
||||
- (NSMutableURLRequest *)requestForURL:(NSURL *)url
|
||||
ETag:(NSString *)etagOrNil
|
||||
httpMethod:(NSString *)httpMethodOrNil GTL_NONNULL((1));
|
||||
|
||||
// objectRequestForURL returns an NSMutableURLRequest for a JSON GTL object
|
||||
//
|
||||
// The object is the object being sent to the server, or nil;
|
||||
// the http method may be nil for GET, or POST, PUT, DELETE
|
||||
- (NSMutableURLRequest *)objectRequestForURL:(NSURL *)url
|
||||
object:(GTLObject *)object
|
||||
ETag:(NSString *)etag
|
||||
httpMethod:(NSString *)httpMethod
|
||||
isREST:(BOOL)isREST
|
||||
additionalHeaders:(NSDictionary *)additionalHeaders
|
||||
ticket:(GTLServiceTicket *)ticket GTL_NONNULL((1));
|
||||
|
||||
// The queue used for parsing JSON responses (previously this property
|
||||
// was called operationQueue)
|
||||
@property (nonatomic, retain) NSOperationQueue *parseQueue;
|
||||
|
||||
// The fetcher service object issues the GTMHTTPFetcher instances
|
||||
// for this API service
|
||||
@property (nonatomic, retain) GTMHTTPFetcherService *fetcherService;
|
||||
|
||||
// Default storage for cookies is in the service object's fetchHistory.
|
||||
//
|
||||
// Apps that want to share cookies between all standalone fetchers and the
|
||||
// service object may specify static application-wide cookie storage,
|
||||
// kGTMHTTPFetcherCookieStorageMethodStatic.
|
||||
@property (nonatomic, assign) NSInteger cookieStorageMethod;
|
||||
|
||||
// When sending REST style queries, should the payload be wrapped in a "data"
|
||||
// element, and will the reply be wrapped in an "data" element.
|
||||
@property (nonatomic, assign) BOOL isRESTDataWrapperRequired;
|
||||
|
||||
// Any url query parameters to add to urls (useful for debugging with some
|
||||
// services).
|
||||
@property (copy) NSDictionary *urlQueryParameters;
|
||||
|
||||
// Any extra http headers to set on requests for GTLObjects.
|
||||
@property (copy) NSDictionary *additionalHTTPHeaders;
|
||||
|
||||
// The service API version.
|
||||
@property (nonatomic, copy) NSString *apiVersion;
|
||||
|
||||
// The URL for sending RPC requests for this service.
|
||||
@property (nonatomic, retain) NSURL *rpcURL;
|
||||
|
||||
// The URL for sending RPC requests which initiate file upload.
|
||||
@property (nonatomic, retain) NSURL *rpcUploadURL;
|
||||
|
||||
// Set a non-zero value to enable uploading via chunked fetches
|
||||
// (resumable uploads); typically this defaults to kGTLStandardUploadChunkSize
|
||||
// for service subclasses that support chunked uploads
|
||||
@property (nonatomic, assign) NSUInteger serviceUploadChunkSize;
|
||||
|
||||
// Service subclasses may specify their own default chunk size
|
||||
+ (NSUInteger)defaultServiceUploadChunkSize;
|
||||
|
||||
// The service uploadProgressSelector becomes the initial value for each future
|
||||
// ticket's uploadProgressSelector.
|
||||
//
|
||||
// The optional uploadProgressSelector will be called in the delegate as bytes
|
||||
// are uploaded to the server. It should have a signature matching
|
||||
//
|
||||
// - (void)ticket:(GTLServiceTicket *)ticket
|
||||
// hasDeliveredByteCount:(unsigned long long)numberOfBytesRead
|
||||
// ofTotalByteCount:(unsigned long long)dataLength;
|
||||
@property (nonatomic, assign) SEL uploadProgressSelector;
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
@property (copy) void (^uploadProgressBlock)(GTLServiceTicket *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
|
||||
#endif
|
||||
|
||||
// Wait synchronously for fetch to complete (strongly discouraged)
|
||||
//
|
||||
// This just runs the current event loop until the fetch completes
|
||||
// or the timout limit is reached. This may discard unexpected events
|
||||
// that occur while spinning, so it's really not appropriate for use
|
||||
// in serious applications.
|
||||
//
|
||||
// Returns true if an object was successfully fetched. If the wait
|
||||
// timed out, returns false and the returned error is nil.
|
||||
//
|
||||
// The returned object or error, if any, will be already autoreleased
|
||||
//
|
||||
// This routine will likely be removed in some future releases of the library.
|
||||
- (BOOL)waitForTicket:(GTLServiceTicket *)ticket
|
||||
timeout:(NSTimeInterval)timeoutInSeconds
|
||||
fetchedObject:(GTLObject **)outObjectOrNil
|
||||
error:(NSError **)outErrorOrNil GTL_NONNULL((1));
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
// Ticket base class
|
||||
//
|
||||
@interface GTLServiceTicket : NSObject {
|
||||
GTLService *service_;
|
||||
|
||||
NSMutableDictionary *ticketProperties_;
|
||||
NSDictionary *surrogates_;
|
||||
|
||||
GTMHTTPFetcher *objectFetcher_;
|
||||
SEL uploadProgressSelector_;
|
||||
BOOL shouldFetchNextPages_;
|
||||
BOOL isRetryEnabled_;
|
||||
SEL retrySelector_;
|
||||
NSTimeInterval maxRetryInterval_;
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
BOOL (^retryBlock_)(GTLServiceTicket *, BOOL, NSError *);
|
||||
void (^uploadProgressBlock_)(GTLServiceTicket *ticket,
|
||||
unsigned long long numberOfBytesRead,
|
||||
unsigned long long dataLength);
|
||||
#elif !__LP64__
|
||||
// Placeholders: for 32-bit builds, keep the size of the object's ivar section
|
||||
// the same with and without blocks
|
||||
id retryPlaceholder_;
|
||||
id uploadProgressPlaceholder_;
|
||||
#endif
|
||||
|
||||
GTLObject *postedObject_;
|
||||
GTLObject *fetchedObject_;
|
||||
id<GTLQueryProtocol> executingQuery_;
|
||||
id<GTLQueryProtocol> originalQuery_;
|
||||
NSError *fetchError_;
|
||||
BOOL hasCalledCallback_;
|
||||
NSUInteger pagesFetchedCounter_;
|
||||
|
||||
NSString *apiKey_;
|
||||
BOOL isREST_;
|
||||
|
||||
NSOperation *parseOperation_;
|
||||
}
|
||||
|
||||
+ (id)ticketForService:(GTLService *)service;
|
||||
|
||||
- (id)initWithService:(GTLService *)service;
|
||||
|
||||
- (id)service;
|
||||
|
||||
#pragma mark Execution Control
|
||||
// if cancelTicket is called, the fetch is stopped if it is in progress,
|
||||
// the callbacks will not be called, and the ticket will no longer be useful
|
||||
// (though the client must still release the ticket if it retained the ticket)
|
||||
- (void)cancelTicket;
|
||||
|
||||
// chunked upload tickets may be paused
|
||||
- (void)pauseUpload;
|
||||
- (void)resumeUpload;
|
||||
- (BOOL)isUploadPaused;
|
||||
|
||||
@property (nonatomic, retain) GTMHTTPFetcher *objectFetcher;
|
||||
@property (nonatomic, assign) SEL uploadProgressSelector;
|
||||
|
||||
// Services which do not require an user authorization may require a developer
|
||||
// API key for quota management
|
||||
@property (nonatomic, copy) NSString *APIKey;
|
||||
|
||||
#pragma mark User Properties
|
||||
|
||||
// Properties and userData are supported for client convenience.
|
||||
//
|
||||
// Property keys beginning with _ are reserved by the library.
|
||||
- (void)setProperty:(id)obj forKey:(NSString *)key GTL_NONNULL((1)); // pass nil obj to remove property
|
||||
- (id)propertyForKey:(NSString *)key;
|
||||
|
||||
@property (nonatomic, copy) NSDictionary *properties;
|
||||
@property (nonatomic, retain) id userData;
|
||||
|
||||
#pragma mark Payload
|
||||
|
||||
@property (nonatomic, retain) GTLObject *postedObject;
|
||||
@property (nonatomic, retain) GTLObject *fetchedObject;
|
||||
@property (nonatomic, retain) id<GTLQueryProtocol> executingQuery; // Query currently being fetched by this ticket
|
||||
@property (nonatomic, retain) id<GTLQueryProtocol> originalQuery; // Query used to create this ticket
|
||||
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1)); // Returns the query from within the batch with the given id.
|
||||
|
||||
@property (nonatomic, retain) NSDictionary *surrogates;
|
||||
|
||||
#pragma mark Retry
|
||||
|
||||
@property (nonatomic, assign, getter=isRetryEnabled) BOOL retryEnabled;
|
||||
@property (nonatomic, assign) SEL retrySelector;
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
@property (copy) BOOL (^retryBlock)(GTLServiceTicket *ticket, BOOL suggestedWillRetry, NSError *error);
|
||||
#endif
|
||||
@property (nonatomic, assign) NSTimeInterval maxRetryInterval;
|
||||
|
||||
#pragma mark Status
|
||||
|
||||
@property (nonatomic, readonly) NSInteger statusCode; // server status from object fetch
|
||||
@property (nonatomic, retain) NSError *fetchError;
|
||||
@property (nonatomic, assign) BOOL hasCalledCallback;
|
||||
|
||||
#pragma mark Pagination
|
||||
|
||||
@property (nonatomic, assign) BOOL shouldFetchNextPages;
|
||||
@property (nonatomic, assign) NSUInteger pagesFetchedCounter;
|
||||
|
||||
#pragma mark Upload
|
||||
|
||||
#if NS_BLOCKS_AVAILABLE
|
||||
@property (copy) void (^uploadProgressBlock)(GTLServiceTicket *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// Category to provide opaque access to tickets stored in fetcher properties
|
||||
@interface GTMHTTPFetcher (GTLServiceTicketAdditions)
|
||||
- (id)ticket;
|
||||
@end
|
||||
|
||||
2407
External/google-plus-ios-sdk/OpenSource/GTL/GTLService.m
vendored
2407
External/google-plus-ios-sdk/OpenSource/GTL/GTLService.m
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// Makes the value of GTL_TARGET_NAMESPACE a prefix for all GTL
|
||||
// library class names
|
||||
//
|
||||
|
||||
//
|
||||
// To avoid global namespace issues, define GTL_TARGET_NAMESPACE to a short
|
||||
// string in your target if you are using the GTL library in a shared-code
|
||||
// environment like a plug-in.
|
||||
//
|
||||
// For example: -DGTL_TARGET_NAMESPACE=MyPlugin
|
||||
//
|
||||
|
||||
//
|
||||
// com.google.GTLFramework v. 2.0 (29 classes) 2011-10-25 19:25:36 -0700
|
||||
//
|
||||
|
||||
#if defined(__OBJC__) && defined(GTL_TARGET_NAMESPACE)
|
||||
|
||||
#define _GTL_NS_SYMBOL_INNER(ns, symbol) ns ## _ ## symbol
|
||||
#define _GTL_NS_SYMBOL_MIDDLE(ns, symbol) _GTL_NS_SYMBOL_INNER(ns, symbol)
|
||||
#define _GTL_NS_SYMBOL(symbol) _GTL_NS_SYMBOL_MIDDLE(GTL_TARGET_NAMESPACE, symbol)
|
||||
|
||||
#define _GTL_NS_STRING_INNER(ns) #ns
|
||||
#define _GTL_NS_STRING_MIDDLE(ns) _GTL_NS_STRING_INNER(ns)
|
||||
#define GTL_TARGET_NAMESPACE_STRING _GTL_NS_STRING_MIDDLE(GTL_TARGET_NAMESPACE)
|
||||
|
||||
#define GTLBatchQuery _GTL_NS_SYMBOL(GTLBatchQuery)
|
||||
#define GTLBatchResult _GTL_NS_SYMBOL(GTLBatchResult)
|
||||
#define GTLCollectionObject _GTL_NS_SYMBOL(GTLCollectionObject)
|
||||
#define GTLDateTime _GTL_NS_SYMBOL(GTLDateTime)
|
||||
#define GTLErrorObject _GTL_NS_SYMBOL(GTLErrorObject)
|
||||
#define GTLErrorObjectData _GTL_NS_SYMBOL(GTLErrorObjectData)
|
||||
#define GTLJSONParser _GTL_NS_SYMBOL(GTLJSONParser)
|
||||
#define GTLObject _GTL_NS_SYMBOL(GTLObject)
|
||||
#define GTLQuery _GTL_NS_SYMBOL(GTLQuery)
|
||||
#define GTLRuntimeCommon _GTL_NS_SYMBOL(GTLRuntimeCommon)
|
||||
#define GTLService _GTL_NS_SYMBOL(GTLService)
|
||||
#define GTLServiceTicket _GTL_NS_SYMBOL(GTLServiceTicket)
|
||||
#define GTLUploadParameters _GTL_NS_SYMBOL(GTLUploadParameters)
|
||||
#define GTLUtilities _GTL_NS_SYMBOL(GTLUtilities)
|
||||
#define GTMCachedURLResponse _GTL_NS_SYMBOL(GTMCachedURLResponse)
|
||||
#define GTMCookieStorage _GTL_NS_SYMBOL(GTMCookieStorage)
|
||||
#define GTMGatherInputStream _GTL_NS_SYMBOL(GTMGatherInputStream)
|
||||
#define GTMHTTPFetcher _GTL_NS_SYMBOL(GTMHTTPFetcher)
|
||||
#define GTMHTTPFetcherService _GTL_NS_SYMBOL(GTMHTTPFetcherService)
|
||||
#define GTMHTTPFetchHistory _GTL_NS_SYMBOL(GTMHTTPFetchHistory)
|
||||
#define GTMHTTPUploadFetcher _GTL_NS_SYMBOL(GTMHTTPUploadFetcher)
|
||||
#define GTMMIMEDocument _GTL_NS_SYMBOL(GTMMIMEDocument)
|
||||
#define GTMMIMEPart _GTL_NS_SYMBOL(GTMMIMEPart)
|
||||
#define GTMOAuth2Authentication _GTL_NS_SYMBOL(GTMOAuth2Authentication)
|
||||
#define GTMOAuth2AuthorizationArgs _GTL_NS_SYMBOL(GTMOAuth2AuthorizationArgs)
|
||||
#define GTMOAuth2SignIn _GTL_NS_SYMBOL(GTMOAuth2SignIn)
|
||||
#define GTMOAuth2WindowController _GTL_NS_SYMBOL(GTMOAuth2WindowController)
|
||||
#define GTMReadMonitorInputStream _GTL_NS_SYMBOL(GTMReadMonitorInputStream)
|
||||
#define GTMURLCache _GTL_NS_SYMBOL(GTMURLCache)
|
||||
|
||||
#endif
|
||||
@@ -1,60 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLUploadParameters.h
|
||||
//
|
||||
|
||||
// Uploading documentation:
|
||||
// https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Uploading_Files
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTLDefines.h"
|
||||
|
||||
@interface GTLUploadParameters : NSObject <NSCopying> {
|
||||
@private
|
||||
NSString *MIMEType_;
|
||||
NSData *data_;
|
||||
NSFileHandle *fileHandle_;
|
||||
NSURL *uploadLocationURL_;
|
||||
NSString *slug_;
|
||||
BOOL shouldSendUploadOnly_;
|
||||
}
|
||||
|
||||
// Uploading requires MIME type and one of
|
||||
// - data to be uploaded
|
||||
// - file handle for uploading
|
||||
@property (copy) NSString *MIMEType;
|
||||
@property (retain) NSData *data;
|
||||
@property (retain) NSFileHandle *fileHandle;
|
||||
|
||||
// Resuming an in-progress upload is done with the upload location URL,
|
||||
// and requires a file handle for uploading
|
||||
@property (retain) NSURL *uploadLocationURL;
|
||||
|
||||
// Some services need a slug (filename) header
|
||||
@property (copy) NSString *slug;
|
||||
|
||||
// Uploads may be done without a JSON body in the initial request
|
||||
@property (assign) BOOL shouldSendUploadOnly;
|
||||
|
||||
+ (GTLUploadParameters *)uploadParametersWithData:(NSData *)data
|
||||
MIMEType:(NSString *)mimeType GTL_NONNULL((1,2));
|
||||
|
||||
+ (GTLUploadParameters *)uploadParametersWithFileHandle:(NSFileHandle *)fileHandle
|
||||
MIMEType:(NSString *)mimeType GTL_NONNULL((1,2));
|
||||
|
||||
@end
|
||||
@@ -1,107 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTLObject.m
|
||||
//
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
#import "GTLUploadParameters.h"
|
||||
|
||||
@implementation GTLUploadParameters
|
||||
|
||||
@synthesize MIMEType = MIMEType_,
|
||||
data = data_,
|
||||
fileHandle = fileHandle_,
|
||||
uploadLocationURL = uploadLocationURL_,
|
||||
slug = slug_,
|
||||
shouldSendUploadOnly = shouldSendUploadOnly_;
|
||||
|
||||
+ (GTLUploadParameters *)uploadParametersWithData:(NSData *)data
|
||||
MIMEType:(NSString *)mimeType {
|
||||
GTLUploadParameters *params = [[[GTLUploadParameters alloc] init] autorelease];
|
||||
params.data = data;
|
||||
params.MIMEType = mimeType;
|
||||
return params;
|
||||
}
|
||||
|
||||
+ (GTLUploadParameters *)uploadParametersWithFileHandle:(NSFileHandle *)fileHandle
|
||||
MIMEType:(NSString *)mimeType {
|
||||
GTLUploadParameters *params = [[[GTLUploadParameters alloc] init] autorelease];
|
||||
params.fileHandle = fileHandle;
|
||||
params.MIMEType = mimeType;
|
||||
return params;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
GTLUploadParameters *newParams = [[[self class] allocWithZone:zone] init];
|
||||
newParams.MIMEType = self.MIMEType;
|
||||
newParams.data = self.data;
|
||||
newParams.fileHandle = self.fileHandle;
|
||||
newParams.uploadLocationURL = self.uploadLocationURL;
|
||||
newParams.slug = self.slug;
|
||||
newParams.shouldSendUploadOnly = self.shouldSendUploadOnly;
|
||||
return newParams;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[MIMEType_ release];
|
||||
[data_ release];
|
||||
[fileHandle_ release];
|
||||
[uploadLocationURL_ release];
|
||||
[slug_ release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
NSString *str = [NSString stringWithFormat:@"MIMEType:%@", MIMEType_];
|
||||
[array addObject:str];
|
||||
|
||||
if (data_) {
|
||||
str = [NSString stringWithFormat:@"data:%llu bytes",
|
||||
(unsigned long long)[data_ length]];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (fileHandle_) {
|
||||
str = [NSString stringWithFormat:@"fileHandle:%@", fileHandle_];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (uploadLocationURL_) {
|
||||
str = [NSString stringWithFormat:@"uploadLocation:%@",
|
||||
[uploadLocationURL_ absoluteString]];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (slug_) {
|
||||
str = [NSString stringWithFormat:@"slug:%@", slug_];
|
||||
[array addObject:str];
|
||||
}
|
||||
|
||||
if (shouldSendUploadOnly_) {
|
||||
[array addObject:@"shouldSendUploadOnly"];
|
||||
}
|
||||
|
||||
NSString *descStr = [array componentsJoinedByString:@", "];
|
||||
str = [NSString stringWithFormat:@"%@ %p: {%@}",
|
||||
[self class], self, descStr];
|
||||
return str;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,93 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef SKIP_GTL_DEFINES
|
||||
#import "GTLDefines.h"
|
||||
#endif
|
||||
|
||||
// helper functions for implementing isEqual:
|
||||
BOOL GTL_AreEqualOrBothNil(id obj1, id obj2);
|
||||
BOOL GTL_AreBoolsEqual(BOOL b1, BOOL b2);
|
||||
|
||||
// Helper to ensure a number is a number.
|
||||
//
|
||||
// The GoogleAPI servers will send numbers >53 bits as strings to avoid
|
||||
// bugs in some JavaScript implementations. Work around this by catching
|
||||
// the string and turning it back into a number.
|
||||
NSNumber *GTL_EnsureNSNumber(NSNumber *num);
|
||||
|
||||
@interface GTLUtilities : NSObject
|
||||
|
||||
//
|
||||
// String encoding
|
||||
//
|
||||
|
||||
// URL encoding, different for parts of URLs and parts of URL parameters
|
||||
//
|
||||
// +stringByURLEncodingString just makes a string legal for a URL
|
||||
//
|
||||
// +stringByURLEncodingForURI also encodes some characters that are legal in
|
||||
// URLs but should not be used in URIs,
|
||||
// per http://bitworking.org/projects/atom/rfc5023.html#rfc.section.9.7
|
||||
//
|
||||
// +stringByURLEncodingStringParameter is like +stringByURLEncodingForURI but
|
||||
// replaces space characters with + characters rather than percent-escaping them
|
||||
//
|
||||
+ (NSString *)stringByURLEncodingString:(NSString *)str;
|
||||
+ (NSString *)stringByURLEncodingForURI:(NSString *)str;
|
||||
+ (NSString *)stringByURLEncodingStringParameter:(NSString *)str;
|
||||
|
||||
// Percent-encoded UTF-8
|
||||
+ (NSString *)stringByPercentEncodingUTF8ForString:(NSString *)str;
|
||||
|
||||
// Key-value coding searches in an array
|
||||
//
|
||||
// Utilities to get from an array objects having a known value (or nil)
|
||||
// at a keyPath
|
||||
|
||||
+ (NSArray *)objectsFromArray:(NSArray *)sourceArray
|
||||
withValue:(id)desiredValue
|
||||
forKeyPath:(NSString *)keyPath;
|
||||
|
||||
+ (id)firstObjectFromArray:(NSArray *)sourceArray
|
||||
withValue:(id)desiredValue
|
||||
forKeyPath:(NSString *)keyPath;
|
||||
|
||||
//
|
||||
// Version helpers
|
||||
//
|
||||
|
||||
+ (NSComparisonResult)compareVersion:(NSString *)ver1 toVersion:(NSString *)ver2;
|
||||
|
||||
//
|
||||
// URL builder
|
||||
//
|
||||
|
||||
// If there are already query parameters on urlString, the new ones are simple
|
||||
// appended after them.
|
||||
+ (NSURL *)URLWithString:(NSString *)urlString
|
||||
queryParameters:(NSDictionary *)queryParameters;
|
||||
|
||||
// Allocate a global dictionary
|
||||
+ (NSMutableDictionary *)newStaticDictionary;
|
||||
|
||||
// Walk up the class tree merging dictionaries and return the result.
|
||||
+ (NSDictionary *)mergedClassDictionaryForSelector:(SEL)selector
|
||||
startClass:(Class)startClass
|
||||
ancestorClass:(Class)ancestorClass
|
||||
cache:(NSMutableDictionary *)cache;
|
||||
@end
|
||||
@@ -1,358 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "GTLUtilities.h"
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
@implementation GTLUtilities
|
||||
|
||||
#pragma mark String encoding
|
||||
|
||||
// URL Encoding
|
||||
|
||||
+ (NSString *)stringByURLEncodingString:(NSString *)str {
|
||||
NSString *result = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
return result;
|
||||
}
|
||||
|
||||
// NSURL's stringByAddingPercentEscapesUsingEncoding: does not escape
|
||||
// some characters that should be escaped in URL parameters, like / and ?;
|
||||
// we'll use CFURL to force the encoding of those
|
||||
//
|
||||
// Reference: http://www.ietf.org/rfc/rfc3986.txt
|
||||
|
||||
const CFStringRef kCharsToForceEscape = CFSTR("!*'();:@&=+$,/?%#[]");
|
||||
|
||||
+ (NSString *)stringByURLEncodingForURI:(NSString *)str {
|
||||
|
||||
NSString *resultStr = str;
|
||||
|
||||
CFStringRef originalString = (CFStringRef) str;
|
||||
CFStringRef leaveUnescaped = NULL;
|
||||
|
||||
CFStringRef escapedStr;
|
||||
escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||
originalString,
|
||||
leaveUnescaped,
|
||||
kCharsToForceEscape,
|
||||
kCFStringEncodingUTF8);
|
||||
if (escapedStr) {
|
||||
resultStr = [(id)CFMakeCollectable(escapedStr) autorelease];
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
+ (NSString *)stringByURLEncodingStringParameter:(NSString *)str {
|
||||
// For parameters, we'll explicitly leave spaces unescaped now, and replace
|
||||
// them with +'s
|
||||
NSString *resultStr = str;
|
||||
|
||||
CFStringRef originalString = (CFStringRef) str;
|
||||
CFStringRef leaveUnescaped = CFSTR(" ");
|
||||
|
||||
CFStringRef escapedStr;
|
||||
escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||
originalString,
|
||||
leaveUnescaped,
|
||||
kCharsToForceEscape,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
if (escapedStr) {
|
||||
NSMutableString *mutableStr = [NSMutableString stringWithString:(NSString *)escapedStr];
|
||||
CFRelease(escapedStr);
|
||||
|
||||
// replace spaces with plusses
|
||||
[mutableStr replaceOccurrencesOfString:@" "
|
||||
withString:@"+"
|
||||
options:0
|
||||
range:NSMakeRange(0, [mutableStr length])];
|
||||
resultStr = mutableStr;
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
+ (NSString *)stringByPercentEncodingUTF8ForString:(NSString *)inputStr {
|
||||
|
||||
// Encode per http://bitworking.org/projects/atom/rfc5023.html#rfc.section.9.7
|
||||
//
|
||||
// This is used for encoding upload slug headers
|
||||
//
|
||||
// Step through the string as UTF-8, and replace characters outside 20..7E
|
||||
// (and the percent symbol itself, 25) with percent-encodings
|
||||
//
|
||||
// We avoid creating an encoding string unless we encounter some characters
|
||||
// that require it
|
||||
const char* utf8 = [inputStr UTF8String];
|
||||
if (utf8 == NULL) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableString *encoded = nil;
|
||||
|
||||
for (unsigned int idx = 0; utf8[idx] != '\0'; idx++) {
|
||||
|
||||
unsigned char currChar = (unsigned char)utf8[idx];
|
||||
if (currChar < 0x20 || currChar == 0x25 || currChar > 0x7E) {
|
||||
|
||||
if (encoded == nil) {
|
||||
// Start encoding and catch up on the character skipped so far
|
||||
encoded = [[[NSMutableString alloc] initWithBytes:utf8
|
||||
length:idx
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
}
|
||||
|
||||
// append this byte as a % and then uppercase hex
|
||||
[encoded appendFormat:@"%%%02X", currChar];
|
||||
|
||||
} else {
|
||||
// This character does not need encoding
|
||||
//
|
||||
// Encoded is nil here unless we've encountered a previous character
|
||||
// that needed encoding
|
||||
[encoded appendFormat:@"%c", currChar];
|
||||
}
|
||||
}
|
||||
|
||||
if (encoded) {
|
||||
return encoded;
|
||||
}
|
||||
|
||||
return inputStr;
|
||||
}
|
||||
|
||||
#pragma mark Key-Value Coding Searches in an Array
|
||||
|
||||
+ (NSArray *)objectsFromArray:(NSArray *)sourceArray
|
||||
withValue:(id)desiredValue
|
||||
forKeyPath:(NSString *)keyPath {
|
||||
// Step through all entries, get the value from
|
||||
// the key path, and see if it's equal to the
|
||||
// desired value
|
||||
NSMutableArray *results = [NSMutableArray array];
|
||||
|
||||
for(id obj in sourceArray) {
|
||||
id val = [obj valueForKeyPath:keyPath];
|
||||
if (GTL_AreEqualOrBothNil(val, desiredValue)) {
|
||||
|
||||
// found a match; add it to the results array
|
||||
[results addObject:obj];
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
+ (id)firstObjectFromArray:(NSArray *)sourceArray
|
||||
withValue:(id)desiredValue
|
||||
forKeyPath:(NSString *)keyPath {
|
||||
for (id obj in sourceArray) {
|
||||
id val = [obj valueForKeyPath:keyPath];
|
||||
if (GTL_AreEqualOrBothNil(val, desiredValue)) {
|
||||
// found a match; return it
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark Version helpers
|
||||
|
||||
// compareVersion compares two strings in 1.2.3.4 format
|
||||
// missing fields are interpreted as zeros, so 1.2 = 1.2.0.0
|
||||
+ (NSComparisonResult)compareVersion:(NSString *)ver1 toVersion:(NSString *)ver2 {
|
||||
|
||||
static NSCharacterSet* dotSet = nil;
|
||||
if (dotSet == nil) {
|
||||
dotSet = [[NSCharacterSet characterSetWithCharactersInString:@"."] retain];
|
||||
}
|
||||
|
||||
if (ver1 == nil) ver1 = @"";
|
||||
if (ver2 == nil) ver2 = @"";
|
||||
|
||||
NSScanner* scanner1 = [NSScanner scannerWithString:ver1];
|
||||
NSScanner* scanner2 = [NSScanner scannerWithString:ver2];
|
||||
|
||||
[scanner1 setCharactersToBeSkipped:dotSet];
|
||||
[scanner2 setCharactersToBeSkipped:dotSet];
|
||||
|
||||
int partA1 = 0, partA2 = 0, partB1 = 0, partB2 = 0;
|
||||
int partC1 = 0, partC2 = 0, partD1 = 0, partD2 = 0;
|
||||
|
||||
if ([scanner1 scanInt:&partA1] && [scanner1 scanInt:&partB1]
|
||||
&& [scanner1 scanInt:&partC1] && [scanner1 scanInt:&partD1]) {
|
||||
}
|
||||
if ([scanner2 scanInt:&partA2] && [scanner2 scanInt:&partB2]
|
||||
&& [scanner2 scanInt:&partC2] && [scanner2 scanInt:&partD2]) {
|
||||
}
|
||||
|
||||
if (partA1 != partA2) return ((partA1 < partA2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
if (partB1 != partB2) return ((partB1 < partB2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
if (partC1 != partC2) return ((partC1 < partC2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
if (partD1 != partD2) return ((partD1 < partD2) ? NSOrderedAscending : NSOrderedDescending);
|
||||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
#pragma mark URL builder
|
||||
|
||||
+ (NSURL *)URLWithString:(NSString *)urlString
|
||||
queryParameters:(NSDictionary *)queryParameters {
|
||||
if ([urlString length] == 0) return nil;
|
||||
|
||||
NSString *fullURLString;
|
||||
if ([queryParameters count] > 0) {
|
||||
NSMutableArray *queryItems = [NSMutableArray arrayWithCapacity:[queryParameters count]];
|
||||
|
||||
// sort the custom parameter keys so that we have deterministic parameter
|
||||
// order for unit tests
|
||||
NSArray *queryKeys = [queryParameters allKeys];
|
||||
NSArray *sortedQueryKeys = [queryKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||
|
||||
for (NSString *paramKey in sortedQueryKeys) {
|
||||
NSString *paramValue = [queryParameters valueForKey:paramKey];
|
||||
|
||||
NSString *paramItem = [NSString stringWithFormat:@"%@=%@",
|
||||
[self stringByURLEncodingStringParameter:paramKey],
|
||||
[self stringByURLEncodingStringParameter:paramValue]];
|
||||
|
||||
[queryItems addObject:paramItem];
|
||||
}
|
||||
|
||||
NSString *paramStr = [queryItems componentsJoinedByString:@"&"];
|
||||
|
||||
BOOL hasQMark = ([urlString rangeOfString:@"?"].location == NSNotFound);
|
||||
char joiner = hasQMark ? '?' : '&';
|
||||
fullURLString = [NSString stringWithFormat:@"%@%c%@",
|
||||
urlString, joiner, paramStr];
|
||||
} else {
|
||||
fullURLString = urlString;
|
||||
}
|
||||
NSURL *result = [NSURL URLWithString:fullURLString];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark Collections
|
||||
|
||||
+ (NSMutableDictionary *)newStaticDictionary {
|
||||
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// make the dictionary ineligible for garbage collection
|
||||
#if !GTL_IPHONE
|
||||
[[NSGarbageCollector defaultCollector] disableCollectorForPointer:dict];
|
||||
#endif
|
||||
return dict;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)mergedClassDictionaryForSelector:(SEL)selector
|
||||
startClass:(Class)startClass
|
||||
ancestorClass:(Class)ancestorClass
|
||||
cache:(NSMutableDictionary *)cache {
|
||||
NSDictionary *result;
|
||||
@synchronized(cache) {
|
||||
result = [cache objectForKey:startClass];
|
||||
if (result == nil) {
|
||||
// Collect the class's dictionary.
|
||||
NSDictionary *classDict = [startClass performSelector:selector];
|
||||
|
||||
// Collect the parent class's merged dictionary.
|
||||
NSDictionary *parentClassMergedDict;
|
||||
if ([startClass isEqual:ancestorClass]) {
|
||||
parentClassMergedDict = nil;
|
||||
} else {
|
||||
Class parentClass = class_getSuperclass(startClass);
|
||||
parentClassMergedDict =
|
||||
[GTLUtilities mergedClassDictionaryForSelector:selector
|
||||
startClass:parentClass
|
||||
ancestorClass:ancestorClass
|
||||
cache:cache];
|
||||
}
|
||||
|
||||
// Merge this class's into the parent's so things properly override.
|
||||
NSMutableDictionary *mergeDict;
|
||||
if (parentClassMergedDict != nil) {
|
||||
mergeDict =
|
||||
[NSMutableDictionary dictionaryWithDictionary:parentClassMergedDict];
|
||||
} else {
|
||||
mergeDict = [NSMutableDictionary dictionary];
|
||||
}
|
||||
if (classDict != nil) {
|
||||
[mergeDict addEntriesFromDictionary:classDict];
|
||||
}
|
||||
|
||||
// Make an immutable version.
|
||||
result = [NSDictionary dictionaryWithDictionary:mergeDict];
|
||||
|
||||
// Save it.
|
||||
[cache setObject:result forKey:(id<NSCopying>)startClass];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// isEqual: has the fatal flaw that it doesn't deal well with the receiver
|
||||
// being nil. We'll use this utility instead.
|
||||
BOOL GTL_AreEqualOrBothNil(id obj1, id obj2) {
|
||||
if (obj1 == obj2) {
|
||||
return YES;
|
||||
}
|
||||
if (obj1 && obj2) {
|
||||
BOOL areEqual = [obj1 isEqual:obj2];
|
||||
return areEqual;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL GTL_AreBoolsEqual(BOOL b1, BOOL b2) {
|
||||
// avoid comparison problems with boolean types by negating
|
||||
// both booleans
|
||||
return (!b1 == !b2);
|
||||
}
|
||||
|
||||
NSNumber *GTL_EnsureNSNumber(NSNumber *num) {
|
||||
// If the server returned a string object where we expect a number, try
|
||||
// to make a number object.
|
||||
if ([num isKindOfClass:[NSString class]]) {
|
||||
NSNumber *newNum;
|
||||
NSString *str = (NSString *)num;
|
||||
if ([str rangeOfString:@"."].location != NSNotFound) {
|
||||
// This is a floating-point number.
|
||||
// Force the parser to use '.' as the decimal separator.
|
||||
static NSLocale *usLocale = nil;
|
||||
@synchronized([GTLUtilities class]) {
|
||||
if (usLocale == nil) {
|
||||
usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
|
||||
}
|
||||
newNum = [NSDecimalNumber decimalNumberWithString:(NSString*)num
|
||||
locale:(id)usLocale];
|
||||
}
|
||||
} else {
|
||||
// NSDecimalNumber +decimalNumberWithString:locale:
|
||||
// does not correctly create an NSNumber for large values like
|
||||
// 71100000000007780.
|
||||
if ([str hasPrefix:@"-"]) {
|
||||
newNum = [NSNumber numberWithLongLong:[str longLongValue]];
|
||||
} else {
|
||||
const char *utf8 = [str UTF8String];
|
||||
unsigned long long ull = strtoull(utf8, NULL, 10);
|
||||
newNum = [NSNumber numberWithUnsignedLongLong:ull];
|
||||
}
|
||||
}
|
||||
if (newNum) {
|
||||
num = newNum;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
441
External/google-plus-ios-sdk/OpenSource/GTMDefines.h
vendored
441
External/google-plus-ios-sdk/OpenSource/GTMDefines.h
vendored
@@ -1,441 +0,0 @@
|
||||
//
|
||||
// GTMDefines.h
|
||||
//
|
||||
// Copyright 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
// use this file except in compliance with the License. You may obtain a copy
|
||||
// of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations under
|
||||
// the License.
|
||||
//
|
||||
|
||||
// ============================================================================
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#ifdef __OBJC__
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
#endif // __OBJC__
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <Availability.h>
|
||||
#endif // TARGET_OS_IPHONE
|
||||
|
||||
// Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs
|
||||
#ifndef MAC_OS_X_VERSION_10_5
|
||||
#define MAC_OS_X_VERSION_10_5 1050
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_7
|
||||
#define MAC_OS_X_VERSION_10_7 1070
|
||||
#endif
|
||||
|
||||
// Not all __IPHONE_X macros defined in past SDKs
|
||||
#ifndef __IPHONE_3_0
|
||||
#define __IPHONE_3_0 30000
|
||||
#endif
|
||||
#ifndef __IPHONE_3_1
|
||||
#define __IPHONE_3_1 30100
|
||||
#endif
|
||||
#ifndef __IPHONE_3_2
|
||||
#define __IPHONE_3_2 30200
|
||||
#endif
|
||||
#ifndef __IPHONE_4_0
|
||||
#define __IPHONE_4_0 40000
|
||||
#endif
|
||||
#ifndef __IPHONE_4_3
|
||||
#define __IPHONE_4_3 40300
|
||||
#endif
|
||||
#ifndef __IPHONE_5_0
|
||||
#define __IPHONE_5_0 50000
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CPP symbols that can be overridden in a prefix to control how the toolbox
|
||||
// is compiled.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// By setting the GTM_CONTAINERS_VALIDATION_FAILED_LOG and
|
||||
// GTM_CONTAINERS_VALIDATION_FAILED_ASSERT macros you can control what happens
|
||||
// when a validation fails. If you implement your own validators, you may want
|
||||
// to control their internals using the same macros for consistency.
|
||||
#ifndef GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
|
||||
#define GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 0
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way to do inlines. Apple's macros even use
|
||||
// a few different actual definitions, so we're based off of the foundation
|
||||
// one.
|
||||
#if !defined(GTM_INLINE)
|
||||
#if (defined (__GNUC__) && (__GNUC__ == 4)) || defined (__clang__)
|
||||
#define GTM_INLINE static __inline__ __attribute__((always_inline))
|
||||
#else
|
||||
#define GTM_INLINE static __inline__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way of doing externs that links up nicely
|
||||
// when mixing objc and objc++
|
||||
#if !defined (GTM_EXTERN)
|
||||
#if defined __cplusplus
|
||||
#define GTM_EXTERN extern "C"
|
||||
#define GTM_EXTERN_C_BEGIN extern "C" {
|
||||
#define GTM_EXTERN_C_END }
|
||||
#else
|
||||
#define GTM_EXTERN extern
|
||||
#define GTM_EXTERN_C_BEGIN
|
||||
#define GTM_EXTERN_C_END
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way of exporting things if we have visibility
|
||||
// set to hidden.
|
||||
#if !defined (GTM_EXPORT)
|
||||
#define GTM_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way of declaring something as unused. This
|
||||
// doesn't use __unused because that is only supported in gcc 4.2 and greater.
|
||||
#if !defined (GTM_UNUSED)
|
||||
#define GTM_UNUSED(x) ((void)(x))
|
||||
#endif
|
||||
|
||||
// _GTMDevLog & _GTMDevAssert
|
||||
//
|
||||
// _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for
|
||||
// developer level errors. This implementation simply macros to NSLog/NSAssert.
|
||||
// It is not intended to be a general logging/reporting system.
|
||||
//
|
||||
// Please see http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert
|
||||
// for a little more background on the usage of these macros.
|
||||
//
|
||||
// _GTMDevLog log some error/problem in debug builds
|
||||
// _GTMDevAssert assert if conditon isn't met w/in a method/function
|
||||
// in all builds.
|
||||
//
|
||||
// To replace this system, just provide different macro definitions in your
|
||||
// prefix header. Remember, any implementation you provide *must* be thread
|
||||
// safe since this could be called by anything in what ever situtation it has
|
||||
// been placed in.
|
||||
//
|
||||
|
||||
// We only define the simple macros if nothing else has defined this.
|
||||
#ifndef _GTMDevLog
|
||||
|
||||
#ifdef DEBUG
|
||||
#define _GTMDevLog(...) NSLog(__VA_ARGS__)
|
||||
#else
|
||||
#define _GTMDevLog(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif // _GTMDevLog
|
||||
|
||||
#ifndef _GTMDevAssert
|
||||
// we directly invoke the NSAssert handler so we can pass on the varargs
|
||||
// (NSAssert doesn't have a macro we can use that takes varargs)
|
||||
#if !defined(NS_BLOCK_ASSERTIONS)
|
||||
#define _GTMDevAssert(condition, ...) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
[[NSAssertionHandler currentHandler] \
|
||||
handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
|
||||
file:[NSString stringWithUTF8String:__FILE__] \
|
||||
lineNumber:__LINE__ \
|
||||
description:__VA_ARGS__]; \
|
||||
} \
|
||||
} while(0)
|
||||
#else // !defined(NS_BLOCK_ASSERTIONS)
|
||||
#define _GTMDevAssert(condition, ...) do { } while (0)
|
||||
#endif // !defined(NS_BLOCK_ASSERTIONS)
|
||||
|
||||
#endif // _GTMDevAssert
|
||||
|
||||
// _GTMCompileAssert
|
||||
// _GTMCompileAssert is an assert that is meant to fire at compile time if you
|
||||
// want to check things at compile instead of runtime. For example if you
|
||||
// want to check that a wchar is 4 bytes instead of 2 you would use
|
||||
// _GTMCompileAssert(sizeof(wchar_t) == 4, wchar_t_is_4_bytes_on_OS_X)
|
||||
// Note that the second "arg" is not in quotes, and must be a valid processor
|
||||
// symbol in it's own right (no spaces, punctuation etc).
|
||||
|
||||
// Wrapping this in an #ifndef allows external groups to define their own
|
||||
// compile time assert scheme.
|
||||
#ifndef _GTMCompileAssert
|
||||
// We got this technique from here:
|
||||
// http://unixjunkie.blogspot.com/2007/10/better-compile-time-asserts_29.html
|
||||
|
||||
#define _GTMCompileAssertSymbolInner(line, msg) _GTMCOMPILEASSERT ## line ## __ ## msg
|
||||
#define _GTMCompileAssertSymbol(line, msg) _GTMCompileAssertSymbolInner(line, msg)
|
||||
#define _GTMCompileAssert(test, msg) \
|
||||
typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ]
|
||||
#endif // _GTMCompileAssert
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CPP symbols defined based on the project settings so the GTM code has
|
||||
// simple things to test against w/o scattering the knowledge of project
|
||||
// setting through all the code.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Provide a single constant CPP symbol that all of GTM uses for ifdefing
|
||||
// iPhone code.
|
||||
#if TARGET_OS_IPHONE // iPhone SDK
|
||||
// For iPhone specific stuff
|
||||
#define GTM_IPHONE_SDK 1
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#define GTM_IPHONE_SIMULATOR 1
|
||||
#else
|
||||
#define GTM_IPHONE_DEVICE 1
|
||||
#endif // TARGET_IPHONE_SIMULATOR
|
||||
// By default, GTM has provided it's own unittesting support, define this
|
||||
// to use the support provided by Xcode, especially for the Xcode4 support
|
||||
// for unittesting.
|
||||
#ifndef GTM_IPHONE_USE_SENTEST
|
||||
#define GTM_IPHONE_USE_SENTEST 0
|
||||
#endif
|
||||
#else
|
||||
// For MacOS specific stuff
|
||||
#define GTM_MACOS_SDK 1
|
||||
#endif
|
||||
|
||||
// Some of our own availability macros
|
||||
#if GTM_MACOS_SDK
|
||||
#define GTM_AVAILABLE_ONLY_ON_IPHONE UNAVAILABLE_ATTRIBUTE
|
||||
#define GTM_AVAILABLE_ONLY_ON_MACOS
|
||||
#else
|
||||
#define GTM_AVAILABLE_ONLY_ON_IPHONE
|
||||
#define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
// GC was dropped by Apple, define the old constant incase anyone still keys
|
||||
// off of it.
|
||||
#ifndef GTM_SUPPORT_GC
|
||||
#define GTM_SUPPORT_GC 0
|
||||
#endif
|
||||
|
||||
// To simplify support for 64bit (and Leopard in general), we provide the type
|
||||
// defines for non Leopard SDKs
|
||||
#if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
// NSInteger/NSUInteger and Max/Mins
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
#if __LP64__ || NS_BUILD_32_LIKE_64
|
||||
typedef long NSInteger;
|
||||
typedef unsigned long NSUInteger;
|
||||
#else
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
#define NSIntegerMax LONG_MAX
|
||||
#define NSIntegerMin LONG_MIN
|
||||
#define NSUIntegerMax ULONG_MAX
|
||||
#define NSINTEGER_DEFINED 1
|
||||
#endif // NSINTEGER_DEFINED
|
||||
// CGFloat
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
#if defined(__LP64__) && __LP64__
|
||||
// This really is an untested path (64bit on Tiger?)
|
||||
typedef double CGFloat;
|
||||
#define CGFLOAT_MIN DBL_MIN
|
||||
#define CGFLOAT_MAX DBL_MAX
|
||||
#define CGFLOAT_IS_DOUBLE 1
|
||||
#else /* !defined(__LP64__) || !__LP64__ */
|
||||
typedef float CGFloat;
|
||||
#define CGFLOAT_MIN FLT_MIN
|
||||
#define CGFLOAT_MAX FLT_MAX
|
||||
#define CGFLOAT_IS_DOUBLE 0
|
||||
#endif /* !defined(__LP64__) || !__LP64__ */
|
||||
#define CGFLOAT_DEFINED 1
|
||||
#endif // CGFLOAT_DEFINED
|
||||
#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||
|
||||
// Some support for advanced clang static analysis functionality
|
||||
// See http://clang-analyzer.llvm.org/annotations.html
|
||||
#ifndef __has_feature // Optional.
|
||||
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
|
||||
#endif
|
||||
|
||||
#ifndef NS_RETURNS_RETAINED
|
||||
#if __has_feature(attribute_ns_returns_retained)
|
||||
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
|
||||
#else
|
||||
#define NS_RETURNS_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_RETURNS_NOT_RETAINED
|
||||
#if __has_feature(attribute_ns_returns_not_retained)
|
||||
#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
|
||||
#else
|
||||
#define NS_RETURNS_NOT_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CF_RETURNS_RETAINED
|
||||
#if __has_feature(attribute_cf_returns_retained)
|
||||
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
|
||||
#else
|
||||
#define CF_RETURNS_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CF_RETURNS_NOT_RETAINED
|
||||
#if __has_feature(attribute_cf_returns_not_retained)
|
||||
#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
|
||||
#else
|
||||
#define CF_RETURNS_NOT_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_CONSUMED
|
||||
#if __has_feature(attribute_ns_consumed)
|
||||
#define NS_CONSUMED __attribute__((ns_consumed))
|
||||
#else
|
||||
#define NS_CONSUMED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CF_CONSUMED
|
||||
#if __has_feature(attribute_cf_consumed)
|
||||
#define CF_CONSUMED __attribute__((cf_consumed))
|
||||
#else
|
||||
#define CF_CONSUMED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_CONSUMES_SELF
|
||||
#if __has_feature(attribute_ns_consumes_self)
|
||||
#define NS_CONSUMES_SELF __attribute__((ns_consumes_self))
|
||||
#else
|
||||
#define NS_CONSUMES_SELF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef NS_FORMAT_ARGUMENT
|
||||
#define NS_FORMAT_ARGUMENT(A)
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef NS_FORMAT_FUNCTION
|
||||
#define NS_FORMAT_FUNCTION(F,A)
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef CF_FORMAT_ARGUMENT
|
||||
#define CF_FORMAT_ARGUMENT(A)
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef CF_FORMAT_FUNCTION
|
||||
#define CF_FORMAT_FUNCTION(F,A)
|
||||
#endif
|
||||
|
||||
#ifndef GTM_NONNULL
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(nonnull)
|
||||
#define GTM_NONNULL(x) __attribute__((nonnull x))
|
||||
#else
|
||||
#define GTM_NONNULL(x)
|
||||
#endif
|
||||
#else
|
||||
#define GTM_NONNULL(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Invalidates the initializer from which it's called.
|
||||
#ifndef GTMInvalidateInitializer
|
||||
#if __has_feature(objc_arc)
|
||||
#define GTMInvalidateInitializer() \
|
||||
do { \
|
||||
[self class]; /* Avoid warning of dead store to |self|. */ \
|
||||
_GTMDevAssert(NO, @"Invalid initializer."); \
|
||||
return nil; \
|
||||
} while (0)
|
||||
#else
|
||||
#define GTMInvalidateInitializer() \
|
||||
do { \
|
||||
[self release]; \
|
||||
_GTMDevAssert(NO, @"Invalid initializer."); \
|
||||
return nil; \
|
||||
} while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
// Declared here so that it can easily be used for logging tracking if
|
||||
// necessary. See GTMUnitTestDevLog.h for details.
|
||||
@class NSString;
|
||||
GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2);
|
||||
|
||||
// Macro to allow you to create NSStrings out of other macros.
|
||||
// #define FOO foo
|
||||
// NSString *fooString = GTM_NSSTRINGIFY(FOO);
|
||||
#if !defined (GTM_NSSTRINGIFY)
|
||||
#define GTM_NSSTRINGIFY_INNER(x) @#x
|
||||
#define GTM_NSSTRINGIFY(x) GTM_NSSTRINGIFY_INNER(x)
|
||||
#endif
|
||||
|
||||
// Macro to allow fast enumeration when building for 10.5 or later, and
|
||||
// reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration
|
||||
// does keys, so pick the right thing, nothing is done on the FastEnumeration
|
||||
// side to be sure you're getting what you wanted.
|
||||
#ifndef GTM_FOREACH_OBJECT
|
||||
#if TARGET_OS_IPHONE || !(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
||||
#define GTM_FOREACH_ENUMEREE(element, enumeration) \
|
||||
for (element in enumeration)
|
||||
#define GTM_FOREACH_OBJECT(element, collection) \
|
||||
for (element in collection)
|
||||
#define GTM_FOREACH_KEY(element, collection) \
|
||||
for (element in collection)
|
||||
#else
|
||||
#define GTM_FOREACH_ENUMEREE(element, enumeration) \
|
||||
for (NSEnumerator *_ ## element ## _enum = enumeration; \
|
||||
(element = [_ ## element ## _enum nextObject]) != nil; )
|
||||
#define GTM_FOREACH_OBJECT(element, collection) \
|
||||
GTM_FOREACH_ENUMEREE(element, [collection objectEnumerator])
|
||||
#define GTM_FOREACH_KEY(element, collection) \
|
||||
GTM_FOREACH_ENUMEREE(element, [collection keyEnumerator])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
|
||||
// To simplify support for both Leopard and Snow Leopard we declare
|
||||
// the Snow Leopard protocols that we need here.
|
||||
#if !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
#define GTM_10_6_PROTOCOLS_DEFINED 1
|
||||
@protocol NSConnectionDelegate
|
||||
@end
|
||||
@protocol NSAnimationDelegate
|
||||
@end
|
||||
@protocol NSImageDelegate
|
||||
@end
|
||||
@protocol NSTabViewDelegate
|
||||
@end
|
||||
#endif // !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
|
||||
// GTM_SEL_STRING is for specifying selector (usually property) names to KVC
|
||||
// or KVO methods.
|
||||
// In debug it will generate warnings for undeclared selectors if
|
||||
// -Wunknown-selector is turned on.
|
||||
// In release it will have no runtime overhead.
|
||||
#ifndef GTM_SEL_STRING
|
||||
#ifdef DEBUG
|
||||
#define GTM_SEL_STRING(selName) NSStringFromSelector(@selector(selName))
|
||||
#else
|
||||
#define GTM_SEL_STRING(selName) @#selName
|
||||
#endif // DEBUG
|
||||
#endif // GTM_SEL_STRING
|
||||
|
||||
#endif // __OBJC__
|
||||
@@ -1,72 +0,0 @@
|
||||
//
|
||||
// GTMGarbageCollection.h
|
||||
//
|
||||
// Copyright 2007-2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
// use this file except in compliance with the License. You may obtain a copy
|
||||
// of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations under
|
||||
// the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTMDefines.h"
|
||||
|
||||
// This allows us to easily move our code from GC to non GC.
|
||||
// They are no-ops unless we are require Leopard or above.
|
||||
// See
|
||||
// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/index.html
|
||||
// and
|
||||
// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html#//apple_ref/doc/uid/TP40006687-SW1
|
||||
// for details.
|
||||
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) && !GTM_IPHONE_SDK
|
||||
// General use would be to call this through GTMCFAutorelease
|
||||
// but there may be a reason the you want to make something collectable
|
||||
// but not autoreleased, especially in pure GC code where you don't
|
||||
// want to bother with the nop autorelease. Done as a define instead of an
|
||||
// inline so that tools like Clang's scan-build don't report code as leaking.
|
||||
#define GTMNSMakeCollectable(cf) ((id)NSMakeCollectable(cf))
|
||||
|
||||
// GTMNSMakeUncollectable is for global maps, etc. that we don't
|
||||
// want released ever. You should still retain these in non-gc code.
|
||||
GTM_INLINE void GTMNSMakeUncollectable(id object) {
|
||||
[[NSGarbageCollector defaultCollector] disableCollectorForPointer:object];
|
||||
}
|
||||
|
||||
// Hopefully no code really needs this, but GTMIsGarbageCollectionEnabled is
|
||||
// a common way to check at runtime if GC is on.
|
||||
// There are some places where GC doesn't work w/ things w/in Apple's
|
||||
// frameworks, so this is here so GTM unittests and detect it, and not run
|
||||
// individual tests to work around bugs in Apple's frameworks.
|
||||
GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
|
||||
return ([NSGarbageCollector defaultCollector] != nil);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define GTMNSMakeCollectable(cf) ((id)(cf))
|
||||
|
||||
GTM_INLINE void GTMNSMakeUncollectable(id object) {
|
||||
}
|
||||
|
||||
GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// GTMCFAutorelease makes a CF object collectable in GC mode, or adds it
|
||||
// to the autorelease pool in non-GC mode. Either way it is taken care
|
||||
// of. Done as a define instead of an inline so that tools like Clang's
|
||||
// scan-build don't report code as leaking.
|
||||
#define GTMCFAutorelease(cf) ([GTMNSMakeCollectable(cf) autorelease])
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
/* Copyright (c) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// GTMHTTPFetchHistory.h
|
||||
//
|
||||
|
||||
//
|
||||
// Users of the GTMHTTPFetcher class may optionally create and set a fetch
|
||||
// history object. The fetch history provides "memory" between subsequent
|
||||
// fetches, including:
|
||||
//
|
||||
// - For fetch responses with Etag headers, the fetch history
|
||||
// remembers the response headers. Future fetcher requests to the same URL
|
||||
// will be given an "If-None-Match" header, telling the server to return
|
||||
// a 304 Not Modified status if the response is unchanged, reducing the
|
||||
// server load and network traffic.
|
||||
//
|
||||
// - Optionally, the fetch history can cache the ETagged data that was returned
|
||||
// in the responses that contained Etag headers. If a later fetch
|
||||
// results in a 304 status, the fetcher will return the cached ETagged data
|
||||
// to the client along with a 200 status, hiding the 304.
|
||||
//
|
||||
// - The fetch history can track cookies.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "GTMHTTPFetcher.h"
|
||||
|
||||
#undef _EXTERN
|
||||
#undef _INITIALIZE_AS
|
||||
#ifdef GTMHTTPFETCHHISTORY_DEFINE_GLOBALS
|
||||
#define _EXTERN
|
||||
#define _INITIALIZE_AS(x) =x
|
||||
#else
|
||||
#if defined(__cplusplus)
|
||||
#define _EXTERN extern "C"
|
||||
#else
|
||||
#define _EXTERN extern
|
||||
#endif
|
||||
#define _INITIALIZE_AS(x)
|
||||
#endif
|
||||
|
||||
|
||||
// default data cache size for when we're caching responses to handle "not
|
||||
// modified" errors for the client
|
||||
#if GTM_IPHONE
|
||||
// iPhone: up to 1MB memory
|
||||
_EXTERN const NSUInteger kGTMDefaultETaggedDataCacheMemoryCapacity _INITIALIZE_AS(1*1024*1024);
|
||||
#else
|
||||
// Mac OS X: up to 15MB memory
|
||||
_EXTERN const NSUInteger kGTMDefaultETaggedDataCacheMemoryCapacity _INITIALIZE_AS(15*1024*1024);
|
||||
#endif
|
||||
|
||||
// forward declarations
|
||||
@class GTMURLCache;
|
||||
@class GTMCookieStorage;
|
||||
|
||||
@interface GTMHTTPFetchHistory : NSObject <GTMHTTPFetchHistoryProtocol> {
|
||||
@private
|
||||
GTMURLCache *etaggedDataCache_;
|
||||
BOOL shouldRememberETags_;
|
||||
BOOL shouldCacheETaggedData_; // if NO, then only headers are cached
|
||||
GTMCookieStorage *cookieStorage_;
|
||||
}
|
||||
|
||||
// With caching enabled, previously-cached data will be returned instead of
|
||||
// 304 Not Modified responses when repeating a fetch of an URL that previously
|
||||
// included an ETag header in its response
|
||||
@property (assign) BOOL shouldRememberETags; // default: NO
|
||||
@property (assign) BOOL shouldCacheETaggedData; // default: NO
|
||||
|
||||
// the default ETag data cache capacity is kGTMDefaultETaggedDataCacheMemoryCapacity
|
||||
@property (assign) NSUInteger memoryCapacity;
|
||||
|
||||
@property (retain) GTMCookieStorage *cookieStorage;
|
||||
|
||||
- (id)initWithMemoryCapacity:(NSUInteger)totalBytes
|
||||
shouldCacheETaggedData:(BOOL)shouldCacheETaggedData;
|
||||
|
||||
- (void)updateRequest:(NSMutableURLRequest *)request isHTTPGet:(BOOL)isHTTPGet;
|
||||
|
||||
- (void)clearETaggedDataCache;
|
||||
- (void)clearHistory;
|
||||
|
||||
- (void)removeAllCookies;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// GTMURLCache and GTMCachedURLResponse have interfaces similar to their
|
||||
// NSURLCache counterparts, in hopes that someday the NSURLCache versions
|
||||
// can be used. But in 10.5.8, those are not reliable enough except when
|
||||
// used with +setSharedURLCache. Our goal here is just to cache
|
||||
// responses for handling If-None-Match requests that return
|
||||
// "Not Modified" responses, not for replacing the general URL
|
||||
// caches.
|
||||
|
||||
@interface GTMCachedURLResponse : NSObject {
|
||||
@private
|
||||
NSURLResponse *response_;
|
||||
NSData *data_;
|
||||
NSDate *useDate_; // date this response was last saved or used
|
||||
NSDate *reservationDate_; // date this response's ETag was used
|
||||
}
|
||||
|
||||
@property (readonly) NSURLResponse* response;
|
||||
@property (readonly) NSData* data;
|
||||
|
||||
// date the response was saved or last accessed
|
||||
@property (retain) NSDate *useDate;
|
||||
|
||||
// date the response's ETag header was last used for a fetch request
|
||||
@property (retain) NSDate *reservationDate;
|
||||
|
||||
- (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data;
|
||||
@end
|
||||
|
||||
@interface GTMURLCache : NSObject {
|
||||
NSMutableDictionary *responses_; // maps request URL to GTMCachedURLResponse
|
||||
NSUInteger memoryCapacity_; // capacity of NSDatas in the responses
|
||||
NSUInteger totalDataSize_; // sum of sizes of NSDatas of all responses
|
||||
NSTimeInterval reservationInterval_; // reservation expiration interval
|
||||
}
|
||||
|
||||
@property (assign) NSUInteger memoryCapacity;
|
||||
|
||||
- (id)initWithMemoryCapacity:(NSUInteger)totalBytes;
|
||||
|
||||
- (GTMCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request;
|
||||
- (void)storeCachedResponse:(GTMCachedURLResponse *)cachedResponse forRequest:(NSURLRequest *)request;
|
||||
- (void)removeCachedResponseForRequest:(NSURLRequest *)request;
|
||||
- (void)removeAllCachedResponses;
|
||||
|
||||
// for unit testing
|
||||
- (void)setReservationInterval:(NSTimeInterval)secs;
|
||||
- (NSDictionary *)responses;
|
||||
- (NSUInteger)totalDataSize;
|
||||
@end
|
||||
|
||||
@interface GTMCookieStorage : NSObject <GTMCookieStorageProtocol> {
|
||||
@private
|
||||
// The cookie storage object manages an array holding cookies, but the array
|
||||
// is allocated externally (it may be in a fetcher object or the static
|
||||
// fetcher cookie array.) See the fetcher's setCookieStorageMethod:
|
||||
// for allocation of this object and assignment of its cookies array.
|
||||
NSMutableArray *cookies_;
|
||||
}
|
||||
|
||||
// add all NSHTTPCookies in the supplied array to the storage array,
|
||||
// replacing cookies in the storage array as appropriate
|
||||
// Side effect: removes expired cookies from the storage array
|
||||
- (void)setCookies:(NSArray *)newCookies;
|
||||
|
||||
// retrieve all cookies appropriate for the given URL, considering
|
||||
// domain, path, cookie name, expiration, security setting.
|
||||
// Side effect: removes expired cookies from the storage array
|
||||
- (NSArray *)cookiesForURL:(NSURL *)theURL;
|
||||
|
||||
// return a cookie with the same name, domain, and path as the
|
||||
// given cookie, or else return nil if none found
|
||||
//
|
||||
// Both the cookie being tested and all stored cookies should
|
||||
// be valid (non-nil name, domains, paths)
|
||||
- (NSHTTPCookie *)cookieMatchingCookie:(NSHTTPCookie *)cookie;
|
||||
|
||||
// remove any expired cookies, excluding cookies with nil expirations
|
||||
- (void)removeExpiredCookies;
|
||||
|
||||
- (void)removeAllCookies;
|
||||
|
||||
@end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user