You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/09/02 17:40:24 UTC
[43/45] usergrid git commit: Moving older SDKs to a difference
location and updating main README to link to new SDK locations.
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/SBJson/SBJsonUTF8Stream.m
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/SBJson/SBJsonUTF8Stream.m b/sdks/ios/UGAPI/SBJson/SBJsonUTF8Stream.m
deleted file mode 100755
index f57015d..0000000
--- a/sdks/ios/UGAPI/SBJson/SBJsonUTF8Stream.m
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- Copyright (c) 2011, Stig Brautaset. 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.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- Neither the name of the the author 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT
- HOLDER OR CONTRIBUTORS 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.
- */
-
-#import "SBJsonUTF8Stream.h"
-
-
-@implementation SBJsonUTF8Stream
-
-@synthesize index = _index;
-
-- (id)init {
- self = [super init];
- if (self) {
- _data = [[NSMutableData alloc] initWithCapacity:4096u];
- }
- return self;
-}
-
-
-- (void)appendData:(NSData *)data_ {
-
- if (_index) {
- // Discard data we've already parsed
- [_data replaceBytesInRange:NSMakeRange(0, _index) withBytes:"" length:0];
-
- // Reset index to point to current position
- _index = 0;
- }
-
- [_data appendData:data_];
-
- // This is an optimisation.
- _bytes = (const char*)[_data bytes];
- _length = [_data length];
-}
-
-
-- (BOOL)getUnichar:(unichar*)ch {
- if (_index < _length) {
- *ch = (unichar)_bytes[_index];
- return YES;
- }
- return NO;
-}
-
-- (BOOL)getNextUnichar:(unichar*)ch {
- if (++_index < _length) {
- *ch = (unichar)_bytes[_index];
- return YES;
- }
- return NO;
-}
-
-- (BOOL)getStringFragment:(NSString **)string {
- NSUInteger start = _index;
- while (_index < _length) {
- switch (_bytes[_index]) {
- case '"':
- case '\\':
- case 0 ... 0x1f:
- *string = [[NSString alloc] initWithBytes:(_bytes + start)
- length:(_index - start)
- encoding:NSUTF8StringEncoding];
- return YES;
- break;
- default:
- _index++;
- break;
- }
- }
- return NO;
-}
-
-- (void)skip {
- _index++;
-}
-
-- (void)skipWhitespace {
- while (_index < _length) {
- switch (_bytes[_index]) {
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- _index++;
- break;
- default:
- return;
- break;
- }
- }
-}
-
-- (BOOL)haveRemainingCharacters:(NSUInteger)chars {
- return [_data length] - _index >= chars;
-}
-
-- (BOOL)skipCharacters:(const char *)chars length:(NSUInteger)len {
- const void *bytes = ((const char*)[_data bytes]) + _index;
- if (!memcmp(bytes, chars, len)) {
- _index += len;
- return YES;
- }
- return NO;
-}
-
-- (NSString*)stringWithRange:(NSRange)range {
- return [[NSString alloc] initWithBytes:_bytes + range.location length:range.length encoding:NSUTF8StringEncoding];
-
-}
-
-
-@end
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/SBJson/SBJsonWriter.h
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/SBJson/SBJsonWriter.h b/sdks/ios/UGAPI/SBJson/SBJsonWriter.h
deleted file mode 100755
index 640816c..0000000
--- a/sdks/ios/UGAPI/SBJson/SBJsonWriter.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- Copyright (C) 2009 Stig Brautaset. 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.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of the author 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
- */
-
-#import <Foundation/Foundation.h>
-
-/**
- @brief The JSON writer class.
-
- This uses SBJsonStreamWriter internally.
-
- @see @ref json2objc
- */
-
-@interface SBJsonWriter : NSObject
-
-/**
- @brief The maximum recursing depth.
-
- Defaults to 32. If the input is nested deeper than this the input will be deemed to be
- malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can
- turn off this security feature by setting the maxDepth value to 0.
- */
-@property NSUInteger maxDepth;
-
-/**
- @brief Return an error trace, or nil if there was no errors.
-
- Note that this method returns the trace of the last method that failed.
- You need to check the return value of the call you're making to figure out
- if the call actually failed, before you know call this method.
- */
-@property (readonly, copy) NSString *error;
-
-/**
- @brief Whether we are generating human-readable (multiline) JSON.
-
- Set whether or not to generate human-readable JSON. The default is NO, which produces
- JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable
- JSON with linebreaks after each array value and dictionary key/value pair, indented two
- spaces per nesting level.
- */
-@property BOOL humanReadable;
-
-/**
- @brief Whether or not to sort the dictionary keys in the output.
-
- If this is set to YES, the dictionary keys in the JSON output will be in sorted order.
- (This is useful if you need to compare two structures, for example.) The default is NO.
- */
-@property BOOL sortKeys;
-
-/**
- @brief An optional comparator to be used if sortKeys is YES.
-
- If this is nil, sorting will be done via @selector(compare:).
- */
-@property (copy) NSComparator sortKeysComparator;
-
-/**
- @brief Return JSON representation for the given object.
-
- Returns a string containing JSON representation of the passed in value, or nil on error.
- If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error.
-
- @param value any instance that can be represented as JSON text.
- */
-- (NSString*)stringWithObject:(id)value;
-
-/**
- @brief Return JSON representation for the given object.
-
- Returns an NSData object containing JSON represented as UTF8 text, or nil on error.
-
- @param value any instance that can be represented as JSON text.
- */
-- (NSData*)dataWithObject:(id)value;
-
-/**
- @brief Return JSON representation (or fragment) for the given object.
-
- Returns a string containing JSON representation of the passed in value, or nil on error.
- If nil is returned and @p error is not NULL, @p *error can be interrogated to find the cause of the error.
-
- @param value any instance that can be represented as a JSON fragment
- @param error pointer to object to be populated with NSError on failure
-
- */- (NSString*)stringWithObject:(id)value
- error:(NSError**)error;
-
-
-@end
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/SBJson/SBJsonWriter.m
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/SBJson/SBJsonWriter.m b/sdks/ios/UGAPI/SBJson/SBJsonWriter.m
deleted file mode 100755
index d200f9c..0000000
--- a/sdks/ios/UGAPI/SBJson/SBJsonWriter.m
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Copyright (C) 2009 Stig Brautaset. 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.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of the author 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
- */
-
-#import "SBJsonWriter.h"
-#import "SBJsonStreamWriter.h"
-#import "SBJsonStreamWriterAccumulator.h"
-
-
-@interface SBJsonWriter ()
-@property (copy) NSString *error;
-@end
-
-@implementation SBJsonWriter
-
-@synthesize sortKeys;
-@synthesize humanReadable;
-
-@synthesize error;
-@synthesize maxDepth;
-
-@synthesize sortKeysComparator;
-
-- (id)init {
- self = [super init];
- if (self) {
- self.maxDepth = 32u;
- }
- return self;
-}
-
-
-- (NSString*)stringWithObject:(id)value {
- NSData *data = [self dataWithObject:value];
- if (data)
- return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- return nil;
-}
-
-- (NSString*)stringWithObject:(id)value error:(NSError**)error_ {
- NSString *tmp = [self stringWithObject:value];
- if (tmp)
- return tmp;
-
- if (error_) {
- NSDictionary *ui = [NSDictionary dictionaryWithObjectsAndKeys:error, NSLocalizedDescriptionKey, nil];
- *error_ = [NSError errorWithDomain:@"org.brautaset.SBJsonWriter.ErrorDomain" code:0 userInfo:ui];
- }
-
- return nil;
-}
-
-- (NSData*)dataWithObject:(id)object {
- self.error = nil;
-
- SBJsonStreamWriterAccumulator *accumulator = [[SBJsonStreamWriterAccumulator alloc] init];
-
- SBJsonStreamWriter *streamWriter = [[SBJsonStreamWriter alloc] init];
- streamWriter.sortKeys = self.sortKeys;
- streamWriter.maxDepth = self.maxDepth;
- streamWriter.sortKeysComparator = self.sortKeysComparator;
- streamWriter.humanReadable = self.humanReadable;
- streamWriter.delegate = accumulator;
-
- BOOL ok = NO;
- if ([object isKindOfClass:[NSDictionary class]])
- ok = [streamWriter writeObject:object];
-
- else if ([object isKindOfClass:[NSArray class]])
- ok = [streamWriter writeArray:object];
-
- else if ([object respondsToSelector:@selector(proxyForJson)])
- return [self dataWithObject:[object proxyForJson]];
- else {
- self.error = @"Not valid type for JSON";
- return nil;
- }
-
- if (ok)
- return accumulator.data;
-
- self.error = streamWriter.error;
- return nil;
-}
-
-
-@end
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/SSKeychain.h
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/SSKeychain.h b/sdks/ios/UGAPI/SSKeychain.h
deleted file mode 100644
index 23093b6..0000000
--- a/sdks/ios/UGAPI/SSKeychain.h
+++ /dev/null
@@ -1,357 +0,0 @@
-//
-// SSKeychain.h
-// SSToolkit
-//
-// Created by Sam Soffes on 5/19/10.
-// Copyright (c) 2009-2011 Sam Soffes. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <Security/Security.h>
-
-/** Error codes that can be returned in NSError objects. */
-typedef enum {
- /** No error. */
- SSKeychainErrorNone = noErr,
-
- /** Some of the arguments were invalid. */
- SSKeychainErrorBadArguments = -1001,
-
- /** There was no password. */
- SSKeychainErrorNoPassword = -1002,
-
- /** One or more parameters passed internally were not valid. */
- SSKeychainErrorInvalidParameter = errSecParam,
-
- /** Failed to allocate memory. */
- SSKeychainErrorFailedToAllocated = errSecAllocate,
-
- /** No trust results are available. */
- SSKeychainErrorNotAvailable = errSecNotAvailable,
-
- /** Authorization/Authentication failed. */
- SSKeychainErrorAuthorizationFailed = errSecAuthFailed,
-
- /** The item already exists. */
- SSKeychainErrorDuplicatedItem = errSecDuplicateItem,
-
- /** The item cannot be found.*/
- SSKeychainErrorNotFound = errSecItemNotFound,
-
- /** Interaction with the Security Server is not allowed. */
- SSKeychainErrorInteractionNotAllowed = errSecInteractionNotAllowed,
-
- /** Unable to decode the provided data. */
- SSKeychainErrorFailedToDecode = errSecDecode
-} SSKeychainErrorCode;
-
-extern NSString *const kSSKeychainErrorDomain;
-
-/** Account name. */
-extern NSString *const kSSKeychainAccountKey;
-
-/**
- Time the item was created.
-
- The value will be a string.
- */
-extern NSString *const kSSKeychainCreatedAtKey;
-
-/** Item class. */
-extern NSString *const kSSKeychainClassKey;
-
-/** Item description. */
-extern NSString *const kSSKeychainDescriptionKey;
-
-/** Item label. */
-extern NSString *const kSSKeychainLabelKey;
-
-/** Time the item was last modified.
-
- The value will be a string.
- */
-extern NSString *const kSSKeychainLastModifiedKey;
-
-/** Where the item was created. */
-extern NSString *const kSSKeychainWhereKey;
-
-/**
- Simple wrapper for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system
- Keychain on Mac OS X and iOS.
-
- This was originally inspired by EMKeychain and SDKeychain (both of which are now gone). Thanks to the authors.
- SSKeychain has since switched to a simpler implementation that was abstracted from [SSToolkit](http://sstoolk.it).
- */
-@interface SSKeychain : NSObject
-
-///-----------------------
-/// @name Getting Accounts
-///-----------------------
-
-/**
- Returns an array containing the Keychain's accounts, or `nil` if the Keychain has no accounts.
-
- See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the
- dictionaries returned by this method.
-
- @return An array of dictionaries containing the Keychain's accounts, or `nil` if the Keychain doesn't have any
- accounts. The order of the objects in the array isn't defined.
-
- @see allAccounts:
- */
-+ (NSArray *)allAccounts;
-
-/**
- Returns an array containing the Keychain's accounts, or `nil` if the Keychain doesn't have any
- accounts.
-
- See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the
- dictionaries returned by this method.
-
- @param error If accessing the accounts fails, upon return contains an error that describes the problem.
-
- @return An array of dictionaries containing the Keychain's accounts, or `nil` if the Keychain doesn't have any
- accounts. The order of the objects in the array isn't defined.
-
- @see allAccounts
- */
-+ (NSArray *)allAccounts:(NSError **)error;
-
-/**
- Returns an array containing the Keychain's accounts for a given service, or `nil` if the Keychain doesn't have any
- accounts for the given service.
-
- See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the
- dictionaries returned by this method.
-
- @param serviceName The service for which to return the corresponding accounts.
-
- @return An array of dictionaries containing the Keychain's accountsfor a given `serviceName`, or `nil` if the Keychain
- doesn't have any accounts for the given `serviceName`. The order of the objects in the array isn't defined.
-
- @see accountsForService:error:
- */
-+ (NSArray *)accountsForService:(NSString *)serviceName;
-
-/**
- Returns an array containing the Keychain's accounts for a given service, or `nil` if the Keychain doesn't have any
- accounts for the given service.
-
- @param serviceName The service for which to return the corresponding accounts.
-
- @param error If accessing the accounts fails, upon return contains an error that describes the problem.
-
- @return An array of dictionaries containing the Keychain's accountsfor a given `serviceName`, or `nil` if the Keychain
- doesn't have any accounts for the given `serviceName`. The order of the objects in the array isn't defined.
-
- @see accountsForService:
- */
-+ (NSArray *)accountsForService:(NSString *)serviceName error:(NSError **)error;
-
-
-///------------------------
-/// @name Getting Passwords
-///------------------------
-
-/**
- Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't have a
- password for the given parameters.
-
- @param serviceName The service for which to return the corresponding password.
-
- @param account The account for which to return the corresponding password.
-
- @return Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't
- have a password for the given parameters.
-
- @see passwordForService:account:error:
- */
-+ (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account;
-
-/**
- Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't have a
- password for the given parameters.
-
- @param serviceName The service for which to return the corresponding password.
-
- @param account The account for which to return the corresponding password.
-
- @param error If accessing the password fails, upon return contains an error that describes the problem.
-
- @return Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't
- have a password for the given parameters.
-
- @see passwordForService:account:
- */
-+ (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
-
-/**
- Returns the password data for a given account and service, or `nil` if the Keychain doesn't have data
- for the given parameters.
-
- @param serviceName The service for which to return the corresponding password.
-
- @param account The account for which to return the corresponding password.
-
- @param error If accessing the password fails, upon return contains an error that describes the problem.
-
- @return Returns a the password data for the given account and service, or `nil` if the Keychain doesn't
- have data for the given parameters.
-
- @see passwordDataForService:account:error:
- */
-+ (NSData *)passwordDataForService:(NSString *)serviceName account:(NSString *)account;
-
-/**
- Returns the password data for a given account and service, or `nil` if the Keychain doesn't have data
- for the given parameters.
-
- @param serviceName The service for which to return the corresponding password.
-
- @param account The account for which to return the corresponding password.
-
- @param error If accessing the password fails, upon return contains an error that describes the problem.
-
- @return Returns a the password data for the given account and service, or `nil` if the Keychain doesn't
- have a password for the given parameters.
-
- @see passwordDataForService:account:
- */
-+ (NSData *)passwordDataForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
-
-
-///-------------------------
-/// @name Deleting Passwords
-///-------------------------
-
-/**
- Deletes a password from the Keychain.
-
- @param serviceName The service for which to delete the corresponding password.
-
- @param account The account for which to delete the corresponding password.
-
- @return Returns `YES` on success, or `NO` on failure.
-
- @see deletePasswordForService:account:error:
- */
-+ (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account;
-
-/**
- Deletes a password from the Keychain.
-
- @param serviceName The service for which to delete the corresponding password.
-
- @param account The account for which to delete the corresponding password.
-
- @param error If deleting the password fails, upon return contains an error that describes the problem.
-
- @return Returns `YES` on success, or `NO` on failure.
-
- @see deletePasswordForService:account:
- */
-+ (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
-
-
-///------------------------
-/// @name Setting Passwords
-///------------------------
-
-/**
- Sets a password in the Keychain.
-
- @param password The password to store in the Keychain.
-
- @param serviceName The service for which to set the corresponding password.
-
- @param account The account for which to set the corresponding password.
-
- @return Returns `YES` on success, or `NO` on failure.
-
- @see setPassword:forService:account:error:
- */
-+ (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account;
-
-/**
- Sets a password in the Keychain.
-
- @param password The password to store in the Keychain.
-
- @param serviceName The service for which to set the corresponding password.
-
- @param account The account for which to set the corresponding password.
-
- @param error If setting the password fails, upon return contains an error that describes the problem.
-
- @return Returns `YES` on success, or `NO` on failure.
-
- @see setPassword:forService:account:
- */
-+ (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
-
-/**
- Sets arbirary data in the Keychain.
-
- @param password The data to store in the Keychain.
-
- @param serviceName The service for which to set the corresponding password.
-
- @param account The account for which to set the corresponding password.
-
- @param error If setting the password fails, upon return contains an error that describes the problem.
-
- @return Returns `YES` on success, or `NO` on failure.
-
- @see setPasswordData:forService:account:error:
- */
-+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account;
-
-/**
- Sets arbirary data in the Keychain.
-
- @param password The data to store in the Keychain.
-
- @param serviceName The service for which to set the corresponding password.
-
- @param account The account for which to set the corresponding password.
-
- @param error If setting the password fails, upon return contains an error that describes the problem.
-
- @return Returns `YES` on success, or `NO` on failure.
-
- @see setPasswordData:forService:account:
- */
-+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
-
-
-///--------------------
-/// @name Configuration
-///--------------------
-
-#if __IPHONE_4_0 && TARGET_OS_IPHONE
-/**
- Returns the accessibility type for all future passwords saved to the Keychain.
-
- @return Returns the accessibility type.
-
- The return value will be `NULL` or one of the "Keychain Item Accessibility Constants" used for determining when a
- keychain item should be readable.
-
- @see accessibilityType
- */
-+ (CFTypeRef)accessibilityType;
-
-/**
- Sets the accessibility type for all future passwords saved to the Keychain.
-
- @param accessibilityType One of the "Keychain Item Accessibility Constants" used for determining when a keychain item
- should be readable.
-
- If the value is `NULL` (the default), the Keychain default will be used.
-
- @see accessibilityType
- */
-+ (void)setAccessibilityType:(CFTypeRef)accessibilityType;
-#endif
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/SSKeychain.m
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/SSKeychain.m b/sdks/ios/UGAPI/SSKeychain.m
deleted file mode 100644
index 1267b5e..0000000
--- a/sdks/ios/UGAPI/SSKeychain.m
+++ /dev/null
@@ -1,262 +0,0 @@
-//
-// SSKeychain.m
-// SSToolkit
-//
-// Created by Sam Soffes on 5/19/10.
-// Copyright (c) 2009-2011 Sam Soffes. All rights reserved.
-//
-
-#import "SSKeychain.h"
-
-NSString *const kSSKeychainErrorDomain = @"com.samsoffes.sskeychain";
-
-NSString *const kSSKeychainAccountKey = @"acct";
-NSString *const kSSKeychainCreatedAtKey = @"cdat";
-NSString *const kSSKeychainClassKey = @"labl";
-NSString *const kSSKeychainDescriptionKey = @"desc";
-NSString *const kSSKeychainLabelKey = @"labl";
-NSString *const kSSKeychainLastModifiedKey = @"mdat";
-NSString *const kSSKeychainWhereKey = @"svce";
-
-#if __IPHONE_4_0 && TARGET_OS_IPHONE
-CFTypeRef SSKeychainAccessibilityType = NULL;
-#endif
-
-@interface SSKeychain ()
-+ (NSMutableDictionary *)_queryForService:(NSString *)service account:(NSString *)account;
-@end
-
-@implementation SSKeychain
-
-#pragma mark - Getting Accounts
-
-+ (NSArray *)allAccounts {
- return [self accountsForService:nil error:nil];
-}
-
-
-+ (NSArray *)allAccounts:(NSError **)error {
- return [self accountsForService:nil error:error];
-}
-
-
-+ (NSArray *)accountsForService:(NSString *)service {
- return [self accountsForService:service error:nil];
-}
-
-
-+ (NSArray *)accountsForService:(NSString *)service error:(NSError **)error {
- OSStatus status = SSKeychainErrorBadArguments;
- NSMutableDictionary *query = [self _queryForService:service account:nil];
-#if __has_feature(objc_arc)
- [query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnAttributes];
- [query setObject:(__bridge id)kSecMatchLimitAll forKey:(__bridge id)kSecMatchLimit];
-#else
- [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnAttributes];
- [query setObject:(id)kSecMatchLimitAll forKey:(id)kSecMatchLimit];
-#endif
-
- CFTypeRef result = NULL;
-#if __has_feature(objc_arc)
- status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
-#else
- status = SecItemCopyMatching((CFDictionaryRef)query, &result);
-#endif
- if (status != noErr && error != NULL) {
- *error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
- return nil;
- }
-
-#if __has_feature(objc_arc)
- return (__bridge_transfer NSArray *)result;
-#else
- return [(NSArray *)result autorelease];
-#endif
-}
-
-
-#pragma mark - Getting Passwords
-
-+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account {
- return [self passwordForService:service account:account error:nil];
-}
-
-
-+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
- NSData *data = [self passwordDataForService:service account:account error:error];
- if (data.length > 0) {
- NSString *string = [[NSString alloc] initWithData:(NSData *)data encoding:NSUTF8StringEncoding];
-#if !__has_feature(objc_arc)
- [string autorelease];
-#endif
- return string;
- }
-
- return nil;
-}
-
-
-+ (NSData *)passwordDataForService:(NSString *)service account:(NSString *)account {
- return [self passwordDataForService:service account:account error:nil];
-}
-
-
-+ (NSData *)passwordDataForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
- OSStatus status = SSKeychainErrorBadArguments;
- if (!service || !account) {
- if (error) {
- *error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
- }
- return nil;
- }
-
- CFTypeRef result = NULL;
- NSMutableDictionary *query = [self _queryForService:service account:account];
-#if __has_feature(objc_arc)
- [query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData];
- [query setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit];
- status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
-#else
- [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];
- [query setObject:(id)kSecMatchLimitOne forKey:(id)kSecMatchLimit];
- status = SecItemCopyMatching((CFDictionaryRef)query, &result);
-#endif
-
- if (status != noErr && error != NULL) {
- *error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
- return nil;
- }
-
-#if __has_feature(objc_arc)
- return (__bridge_transfer NSData *)result;
-#else
- return [(NSData *)result autorelease];
-#endif
-}
-
-
-#pragma mark - Deleting Passwords
-
-+ (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account {
- return [self deletePasswordForService:service account:account error:nil];
-}
-
-
-+ (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
- OSStatus status = SSKeychainErrorBadArguments;
- if (service && account) {
- NSMutableDictionary *query = [self _queryForService:service account:account];
-#if __has_feature(objc_arc)
- status = SecItemDelete((__bridge CFDictionaryRef)query);
-#else
- status = SecItemDelete((CFDictionaryRef)query);
-#endif
- }
- if (status != noErr && error != NULL) {
- *error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
- }
- return (status == noErr);
-
-}
-
-
-#pragma mark - Setting Passwords
-
-+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account {
- return [self setPassword:password forService:service account:account error:nil];
-}
-
-
-+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account error:(NSError **)error {
- NSData *data = [password dataUsingEncoding:NSUTF8StringEncoding];
- return [self setPasswordData:data forService:service account:account error:error];
-}
-
-
-+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)service account:(NSString *)account {
- return [self setPasswordData:password forService:service account:account error:nil];
-}
-
-
-+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)service account:(NSString *)account error:(NSError **)error {
- OSStatus status = SSKeychainErrorBadArguments;
- if (password && service && account) {
- [self deletePasswordForService:service account:account];
- NSMutableDictionary *query = [self _queryForService:service account:account];
-#if __has_feature(objc_arc)
- [query setObject:password forKey:(__bridge id)kSecValueData];
-#else
- [query setObject:password forKey:(id)kSecValueData];
-#endif
-
-#if __IPHONE_4_0 && TARGET_OS_IPHONE
- if (SSKeychainAccessibilityType) {
-#if __has_feature(objc_arc)
- [query setObject:(id)[self accessibilityType] forKey:(__bridge id)kSecAttrAccessible];
-#else
- [query setObject:(id)[self accessibilityType] forKey:(id)kSecAttrAccessible];
-#endif
- }
-#endif
-
-#if __has_feature(objc_arc)
- status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
-#else
- status = SecItemAdd((CFDictionaryRef)query, NULL);
-#endif
- }
- if (status != noErr && error != NULL) {
- *error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
- }
- return (status == noErr);
-}
-
-
-#pragma mark - Configuration
-
-#if __IPHONE_4_0 && TARGET_OS_IPHONE
-+ (CFTypeRef)accessibilityType {
- return SSKeychainAccessibilityType;
-}
-
-
-+ (void)setAccessibilityType:(CFTypeRef)accessibilityType {
- CFRetain(accessibilityType);
- if (SSKeychainAccessibilityType) {
- CFRelease(SSKeychainAccessibilityType);
- }
- SSKeychainAccessibilityType = accessibilityType;
-}
-#endif
-
-
-#pragma mark - Private
-
-+ (NSMutableDictionary *)_queryForService:(NSString *)service account:(NSString *)account {
- NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:3];
-#if __has_feature(objc_arc)
- [dictionary setObject:(__bridge id)kSecClassGenericPassword forKey:(__bridge id)kSecClass];
-#else
- [dictionary setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];
-#endif
-
- if (service) {
-#if __has_feature(objc_arc)
- [dictionary setObject:service forKey:(__bridge id)kSecAttrService];
-#else
- [dictionary setObject:service forKey:(id)kSecAttrService];
-#endif
- }
-
- if (account) {
-#if __has_feature(objc_arc)
- [dictionary setObject:account forKey:(__bridge id)kSecAttrAccount];
-#else
- [dictionary setObject:account forKey:(id)kSecAttrAccount];
-#endif
- }
-
- return dictionary;
-}
-
-@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/UGActivity.h
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGActivity.h b/sdks/ios/UGAPI/UGActivity.h
deleted file mode 100755
index 1139518..0000000
--- a/sdks/ios/UGAPI/UGActivity.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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>
-
-@interface UGActivity : NSObject
-
-// In order for an activity to be valid, you must call setBasics and one of the setActor functions.
-// In all cases, the return value will be YES if the function succeeded and NO if there
-// was a problem with the set. A response of NO will usually mean you sent nil for a required field.
-
-// these are the basics of the activity.
-// verb: the action being taken
-// category: The type of activity it is
-// content: The content of this activity. The format is defined by the category
-// title: The title of this category.
--(BOOL) setBasics: (NSString *)verb category:(NSString *)category content:(NSString *)content title:(NSString *)title;
-
-// actorUserName: The username of the entity doing this activity
-// actorDisplayName: The visible name of the entity doing this activity
-// actorUUID: The UUID of the entity doing this activity
--(BOOL) setActorInfo: (NSString *)actorUserName actorDisplayName:(NSString *)actorDisplayName actorUUID:(NSString *)actorUUID;
-
-// actorUserName: The username of the entity doing this activity
-// actorDisplayName: The visible name of the entity doing this activity
-// actorUUID: The UUID of the entity doing this activity
--(BOOL) setActorInfo: (NSString *)actorUserName actorDisplayName:(NSString *)actorDisplayName actorEmail:(NSString *)actorEmail;
-
-// Associating an object with the Activity is optional. You don't have to supply an object at all.
-
-// objectType: the type of the object associated with this activity
-// displayName: The visible name of the object associated with this activity
-// entityType: the entity type of this object within UserGrid. The actual type that it is stored under
-// entityUUID: The uuid of the object associated with this activity
--(BOOL)setObjectInfo: (NSString *)objectType displayName:(NSString *)displayName entityType:(NSString *)entityType entityUUID:(NSString *)entityUUID;
-
-// similar to the function above, but it takes an arbitrary object content (which can be new and unique) instead of an already-defined object
--(BOOL)setObjectInfo: (NSString *)objectType displayName:(NSString *)displayName objectContent:(NSString *)objectContent;
-
-// similar to the other two functions, but simply has the type and displayName. In this case, the
-// "content" value supplied in setBasics will be used as the object content.
--(BOOL)setObjectInfo: (NSString *)objectType displayName:(NSString *)displayName;
-
-// returns YES if this is properly set up. NO if it has not been properly set up
--(BOOL)isValid;
-
-// turn this object in to an NSDictionary. Used internally by UGClient
--(NSDictionary *)toNSDictionary;
-
-@end
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/UGActivity.m
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGActivity.m b/sdks/ios/UGAPI/UGActivity.m
deleted file mode 100755
index 3eaea00..0000000
--- a/sdks/ios/UGAPI/UGActivity.m
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 "UGActivity.h"
-
-// the way they have set up the object info
-enum
-{
- kUGActivityNoObject = 0,
- kUGActivityObjectEntity = 1,
- kUGActivityObjectContent = 2,
- kUGActivityObjectNameOnly = 3
-};
-
-@implementation UGActivity
-{
- // basic stats
- NSString *m_verb;
- NSString *m_category;
- NSString *m_content;
- NSString *m_title;
-
- // stats related to the actor
- NSString *m_actorUserName;
- NSString *m_actorDisplayName;
- NSString *m_actorUUID;
- NSString *m_actorEmail;
-
- // stats related to the object
- NSString *m_objectType;
- NSString *m_objectDisplayName;
-
- // for the object, either these must be set...
- NSString *m_entityType;
- NSString *m_entityUUID;
-
- // ...or this must be set
- NSString *m_objectContent;
-
- // or it will use the content field as the content for the object
-
- // tracking how the object is currently set up
- int m_objectDataType;
-}
-
--(id)init
-{
- self = [super init];
- if ( self )
- {
- m_objectDataType = kUGActivityNoObject;
- }
- return self;
-}
-
--(BOOL) setBasics: (NSString *)verb category:(NSString *)category content:(NSString *)content title:(NSString *)title
-{
- // input validation
- if ( !verb || !category || !content || !title ) return NO;
-
- m_verb = verb;
- m_category = category;
- m_content = content;
- m_title = title;
-
- return YES;
-}
-
--(BOOL) setActorInfo: (NSString *)actorUserName actorDisplayName:(NSString *)actorDisplayName actorUUID:(NSString *)actorUUID
-{
- // input validation
- if ( !actorUserName || !actorDisplayName || !actorUUID ) return NO;
-
- m_actorUserName = actorUserName;
- m_actorDisplayName = actorDisplayName;
- m_actorUUID = actorUUID;
- m_actorEmail = nil;
-
- return YES;
-}
-
--(BOOL) setActorInfo: (NSString *)actorUserName actorDisplayName:(NSString *)actorDisplayName actorEmail:(NSString *)actorEmail
-{
- // input validation
- if ( !actorUserName || !actorDisplayName || !actorEmail ) return NO;
-
- m_actorUserName = actorUserName;
- m_actorDisplayName = actorDisplayName;
- m_actorEmail = actorEmail;
- m_actorUUID = nil;
-
- return YES;
-}
-
--(BOOL)setObjectInfo: (NSString *)objectType displayName:(NSString *)displayName entityType:(NSString *)entityType entityUUID:(NSString *)entityUUID
-{
- // input validation
- if ( !objectType || !displayName || !entityType || !entityUUID ) return NO;
-
- m_objectType = objectType;
- m_objectDisplayName = displayName;
- m_entityType = entityType;
- m_entityUUID = entityUUID;
- m_objectDataType = kUGActivityObjectEntity;
-
- // clear out the unused value
- m_objectContent = nil;
-
- return YES;
-}
-
--(BOOL)setObjectInfo: (NSString *)objectType displayName:(NSString *)displayName objectContent:(NSString *)objectContent
-{
- // input validation
- if ( !objectType || !displayName || !objectContent ) return NO;
-
- m_objectType = objectType;
- m_objectDisplayName = displayName;
- m_objectContent = objectContent;
- m_objectDataType = kUGActivityObjectContent;
-
- // clear out the unused values
- m_entityType = nil;
- m_entityUUID = nil;
-
- return YES;
-}
-
--(BOOL)setObjectInfo: (NSString *)objectType displayName:(NSString *)displayName
-{
- // input validation
- if ( !objectType || !displayName ) return NO;
-
- m_objectType = objectType;
- m_objectDisplayName = displayName;
- m_objectDataType = kUGActivityObjectNameOnly;
-
- // we'll use m_content when the time comes. But we don't want to
- // assume they've set it yet. They can call the setup functions in any order.
- m_objectContent = nil;
- m_entityType = nil;
- m_entityUUID = nil;
-
- return YES;
-}
-
--(BOOL)isValid
-{
- // if any of the required values are nil, it's not valid
- if ( !m_verb || !m_category || !m_content || !m_title || !m_actorUserName || !m_actorDisplayName )
- {
- return NO;
- }
-
- // either the uuid or the email of the user must be valid
- if ( !m_actorUUID && !m_actorEmail )
- {
- return NO;
- }
-
- // the object data requirements are based on the object setup
- switch ( m_objectDataType )
- {
- case kUGActivityObjectEntity:
- {
- if ( !m_objectType || !m_objectDisplayName || !m_entityType || !m_entityUUID ) return NO;
- }
- break;
-
- case kUGActivityObjectContent:
- {
- if ( !m_objectType || !m_objectDisplayName || !m_objectContent ) return NO;
- }
- break;
-
- case kUGActivityObjectNameOnly:
- {
- if ( !m_objectType || !m_objectDisplayName ) return NO;
- }
- break;
-
- // kUGActivityNoObject has no requirements.
- }
-
- // if we're here, we're valid.
- return YES;
-}
-
--(NSDictionary *)toNSDictionary
-{
- NSMutableDictionary *ret = [NSMutableDictionary new];
-
- // add all the fields in
- [ret setObject:@"activity" forKey:@"type"];
- [ret setObject:m_verb forKey:@"verb"];
- [ret setObject:m_category forKey:@"category"];
- [ret setObject:m_content forKey:@"content"];
- [ret setObject:m_title forKey:@"title"];
-
- // make the actor's subdictionary
- NSMutableDictionary *actor = [NSMutableDictionary new];
- [actor setObject:@"person" forKey:@"type"];
- [actor setObject:@"user" forKey:@"entityType"];
- [actor setObject:m_actorDisplayName forKey:@"displayName"];
-
- if ( m_actorUUID )
- {
- [actor setObject:m_actorUUID forKey:@"uuid"];
- }
- if ( m_actorEmail )
- {
- [actor setObject:m_actorEmail forKey:@"email"];
- }
-
- // add the actor to the main dict
- [ret setObject:actor forKey:@"actor"];
-
- if ( m_objectDataType != kUGActivityNoObject )
- {
- // there is an associated object. Prep a dict for it
- NSMutableDictionary *object = [NSMutableDictionary new];
-
- // these fields are involved in all cases
- [object setObject:m_objectType forKey:@"type"];
- [object setObject:m_objectDisplayName forKey:@"displayName"];
-
- if ( m_objectDataType == kUGActivityObjectContent )
- {
- [object setObject:m_objectContent forKey:@"content"];
- }
- else if ( m_objectDataType == kUGActivityObjectNameOnly )
- {
- [object setObject:m_content forKey:@"content"];
- }
- else if ( m_objectDataType == kUGActivityObjectEntity )
- {
- [object setObject:m_entityType forKey:@"entityType"];
- [object setObject:m_entityUUID forKey:@"entityUUID"];
- }
-
- // add to the dict
- [ret setObject:object forKey:@"object"];
- }
-
- // done with the assembly
- return ret;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/ios/UGAPI/UGClient.h
----------------------------------------------------------------------
diff --git a/sdks/ios/UGAPI/UGClient.h b/sdks/ios/UGAPI/UGClient.h
deleted file mode 100755
index 4e6a31f..0000000
--- a/sdks/ios/UGAPI/UGClient.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 "UGClientResponse.h"
-#import "UGQuery.h"
-#import "UGActivity.h"
-#import "UGUser.h"
-
-/******************** A WORD ON NETWORK COMMUNICATION CALLS ****************
-Some calls require network communication with UserGrid. Therefore,
-they all have the option of being synchronous (blocking) or asynchronous.
-
-You may specify an asynchronous delegate with the call setDelegate. If you
-do, all calls will be asynchronous and responses will be sent to that delegate.
-The immediate return value (a UGClientResponse *) from any call will have its
-transactionState set to kUGClientResponsePending, and the transactionID will be
-properly set (allowing you to identify the specific call in your callback if you
-wish.)
-
-The delegate must support the following message:
--(void)ugClientResponse:(UGClientResponse *)response
-
-If you do not set a delegate, all functions will run synchronously, blocking
-until a response has been received or an error detected.
-****************************************************************************/
-
-
-/**************************** A WORD ON UGQUERY *****************************
-Some calls take a UGQuery *. These are functions that return a lot of data, as
-opposed to a simple answer. You may use the UGQuery to control the data with filters
-and response limits. See UGQuery.h for more information.
-
-In all cases, where a UGQuery is one of the parameters, you may send nil. If you
-do, the query will be completely unfiltered, and you will receive back *all* the data
-associated with the operation, up to the response limit, which is 10. You can
-set the response limit in UGQuery as well.
-****************************************************************************/
-
-
-@interface UGClient : NSObject
-
-+(NSString *) version;
-
-/********************* INIT AND SETUP *********************/
-// init with an app ID
--(id) initWithOrganizationId: (NSString *)organizationID withApplicationID:(NSString *)applicationID;
-
-// init with an app ID and a base UserGrid URL. This is useful if you
-// are running a local UG server or your company has its own public
-// UG server. The default URL is http://api.usergrid.com. The base URL
-// must be a fully formated http link, including the "http://" at the
-// beginning.
--(id) initWithOrganizationId: (NSString *)organizationID withApplicationID:(NSString *)applicationID baseURL:(NSString *)baseURL;
-
-// set the delegate. See "A WORD ON NETWORK COMMUNICATION CALLS"
-// at the top of the file for a detailed explanation. The function
-// will return NO if the delegate is rejected. This means the delegate
-// does not support the required delegation function "ugClientResponse".
-//
-// This is the formal declaration of ugClientResponse:
-// -(void)ugClientResponse:(UGClientResponse *)response
-//
-// You may change the delegate at any time, but be forewarned that any
-// pending transactions in progress will be abandoned. Changing the delegate
-// (especially setting it to nil) ensures that hte previous delegate will
-// receive no further messages from this instance of UGClient.
-//
-// Setting the delegate to nil puts the API in to synchronous mode.
--(BOOL) setDelegate:(id)delegate;
-
-
-/********************* LOGIN / LOGOUT *********************/
-// log in with the given username and password
--(UGClientResponse *)logInUser: (NSString *)userName password:(NSString *)password;
-
-// log in with the given username and PIN value
--(UGClientResponse *)logInUserWithPin: (NSString *)userName pin:(NSString *)pin;
-
-// log in user with Facebook token
-//
-// //sample usage:
-// NSString * facebookToken = @"your-facebook-token";
-// UGClientResponse *response = [usergridClient logInUserWithFacebook:facebookToken];
-// user = [usergridClient getLoggedInUser];
-// if (user.username){
-// return true;
-// } else {
-// return false;
-// }
-//
--(UGClientResponse *)logInUserWithFacebook: (NSString *)facebookToken;
-
-// log in as the administrator of the application. Generally used for applications
-// that have an "administrator" feature. Not the sort of thing you want normal
-// users doing.
--(UGClientResponse *)logInAdmin: (NSString *)adminUserName secret:(NSString *)adminSecret;
-
-// log out the current user. The Client only supports one user logged in at a time.
-// You can have multiple instances of UGClient if you want multiple
-// users doing transactions simultaneously. This does not require network communication,
-// so it has no return. It doesn't actually "log out" from the server. It simply clears
-// the locally stored auth information
--(void)logOut;
-
-
-
-/********************* USER MANAGEMENT *********************/
-//adds a new user
--(UGClientResponse *)addUser:(NSString *)username email:(NSString *)email name:(NSString *)name password:(NSString *)password;
-
-// updates a user's password
--(UGClientResponse *)updateUserPassword:(NSString *)usernameOrEmail oldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;
-
-// get all the groups this user is in
--(UGClientResponse *)getGroupsForUser: (NSString *)userID;
-
-// get users in this app. Definitely want to consider sending a Query along
-// with this call
--(UGClientResponse *)getUsers: (UGQuery *)query;
-
-/********************* ACTIVITY MANAGEMENT *********************/
-// create a new activity.
-// Note that there is a class, UGActivity, which can help
-// you create and validate an Activity, and will generate the needed
-// NSDictionary for you.
--(UGClientResponse *)createActivity: (NSDictionary *)activity;
-
-// create an activity and post it to a user in a single step. See comment
-// above createActivity for information on making Activity creation easier
--(UGClientResponse *)postUserActivity: (NSString *)userID activity:(NSDictionary *)activity;
-
-// post an already-created activity to a user
--(UGClientResponse *)postUserActivityByUUID: (NSString *)userID activity:(NSString *)activityUUID;
-
-// create an activity and post it to a group in a single step. See comment
-// above createActivity for information on making Activity creation easier
--(UGClientResponse *)postGroupActivity: (NSString *)groupID activity:(NSDictionary *)activity;
-
-// post an already-created activity to a group
--(UGClientResponse *)postGroupActivityByUUID: (NSString *)groupID activity:(NSString *)activityUUID;
-
-// get the activities this user is in
--(UGClientResponse *)getActivitiesForUser: (NSString *)userID query:(UGQuery *)query;
-
-// get the activities this group is in
--(UGClientResponse *)getActivitiesForGroup: (NSString *)groupID query:(UGQuery *)query;
-
-// get the activity feed for a user
--(UGClientResponse *)getActivityFeedForUser: (NSString *)userID query:(UGQuery *)query;
-
-// get the activity feed for a group
--(UGClientResponse *)getActivityFeedForGroup: (NSString *)groupID query:(UGQuery *)query;
-
-// remove an activity
--(UGClientResponse *)removeActivity:(NSString *)activityUUID;
-
-/********************* GROUP MANAGEMENT *********************/
-// create a new group. The groupPath can be a path with slashes to make for
-// a hierarchical structure of your own design (if you want). groupTitle is
-// optional, you can send nil if you don't want to provide one.
--(UGClientResponse *)createGroup:(NSString *)groupPath groupTitle:(NSString *)groupTitle;
-
-// add a user to a group
--(UGClientResponse *)addUserToGroup:(NSString *)userID group:(NSString *)groupID;
-
-// remove a user from a group
--(UGClientResponse *)removeUserFromGroup:(NSString *)userID group:(NSString *)groupID;
-
-// get all the users in this group
--(UGClientResponse *)getUsersForGroup:(NSString *)groupID query:(UGQuery *)query;
-
-
-
-/******************** ENTITY MANAGEMENT ********************/
-// adds an entity to the specified collection.
--(UGClientResponse *)createEntity: (NSDictionary *)newEntity;
-
-// get a list of entities that meet the specified query.
--(UGClientResponse *)getEntities: (NSString *)type query:(UGQuery *)query;
-
-// updates an entity (it knows the type from the entity data)
--(UGClientResponse *)updateEntity: (NSString *)entityID entity:(NSDictionary *)updatedEntity;
-
-// removes an entity of the specified type
--(UGClientResponse *)removeEntity: (NSString *)type entityID:(NSString *)entityID;
-
-// Directionally connect two entities. For instance, user "Bob" might like Lyons Restaurant.
-// connectorType would be "users" (because Bob is a user)
-// connectorID would be Bob's userID
-// connectionType would be "like"
-// connecteeID would be the UUID of Lyons Restaurant
--(UGClientResponse *)connectEntities: (NSString *)connectorType connectorID:(NSString *)connectorID type:(NSString *)connectionType connecteeID:(NSString *)connecteeID;
-
-// Directionally connect two entities. For instance, user "Bob" might follow user "Mary".
-// connectorType would be "users" (because Bob is a user)
-// connectorID would be Bob's userID
-// connectionType would be "like"
-// connecteeType would be "users" (because Mary is a user)
-// connecteeID would be Mary's userID
--(UGClientResponse *)connectEntities: (NSString *)connectorType connectorID:(NSString *)connectorID connectionType:(NSString *)connectionType connecteeType:(NSString *)connecteeType connecteeID:(NSString *)connecteeID;
-
-// disconnect two entities. It uses the same parameters and calling rules as connectEntities
--(UGClientResponse *)disconnectEntities: (NSString *)connectorType connectorID:(NSString *)connectorID type:(NSString *)connectionType connecteeID:(NSString *)connecteeID;
-
-// get entity connections
--(UGClientResponse *)getEntityConnections: (NSString *)connectorType connectorID:(NSString *)connectorID connectionType:(NSString *)connectionType query:(UGQuery *)query;
-
-
-
-/********************* MESSAGE MANAGEMENT *********************/
-// post a message to a given queue
--(UGClientResponse *)postMessage: (NSString *)queuePath message:(NSDictionary *)message;
-
-// get all messages from the queue path
--(UGClientResponse *)getMessages: (NSString *)queuePath query:(UGQuery *)query;
-
-// add a subscriber to a queue
--(UGClientResponse *)addSubscriber: (NSString *)queuePath subscriberPath:(NSString *)subscriberPath;
-
-// remove a subscriber from a queue
--(UGClientResponse *)removeSubscriber: (NSString *)queuePath subscriberPath:(NSString *)subscriberPath;
-
-
-/********************* SERVER-SIDE STORAGE *********************/
-// these functions refer to data that can be put in a special place
-// specific to this device. Every call to remoteStorage replaces whatever
-// was there before
-
-// put the data in to the remote storage
--(UGClientResponse *)setRemoteStorage: (NSDictionary *)data;
-
-// get the data from remote storage
--(UGClientResponse *)getRemoteStorage;
-
-// a class function that returns a uuid for this
-// device. It will be globally unique, and will always
-// return the same value for the same handset.
-// NOTE - This value will change if the operating
-// system is reinstalled. This function is used internally, but
-// is also handy for clients, so it is part of the interface.
-+(NSString *)getUniqueDeviceID;
-
-/***************** REMOTE PUSH NOTIFICATIONS *****************/
-
-// call from application:didRegisterForRemoteNotificationsWithDeviceToken: callback
-// will automatically register the passed deviceToken with the usergrid system
-// using the getUniqueDeviceID method to associate this device on the server
-- (UGClientResponse *)setDevicePushToken:(NSData *)newDeviceToken forNotifier:(NSString *)notifier;
-
-// push an "alert" type notification to the remote group, user, or device specified
-// in the path argument. the notifer may be a name or UUID of an apns notifier
-// that has been set up on the usergrid server.
-- (UGClientResponse *)pushAlert:(NSString *)message
- withSound:(NSString *)sound
- to:(NSString *)path
- usingNotifier:(NSString *)notifier;
-
-/*********************** ACCESSORS ************************/
-// if a user is logged in, this returns the OAuth token for this session.
-// UGClient manages this internally, so you never really need it. But if you
-// want it for other reasons, this accessor gives it to you. If you have not
-// successfully logged in, this will return nil
--(NSString *)getAccessToken;
-
-// returns information about the logged in user
--(UGUser *)getLoggedInUser;
-
-// returns the delegate that is currently being used for asynch
-// calls. Returns nil if there is no delegate (synch mode)
--(id) getDelegate;
-
-/*********************** OBLIQUE USAGE ************************/
-// This is a general purpose function for directly accessing the
-// UserGrid service. This is useful if the service has new features
-// that the API has not yet supported, or if you are using an older
-// version of the API and don't want to upgrade.
-//
-// url: The full URL that you are accessing. You are responsible for
-// assembling it, including the appID and all sub-sections down the line
-//
-// op: The HttpMethod being invoked. Examples: @"POST", @"PUT", etc. You may
-// send nil. If you do, the operation is GET. There is one specially supported
-// method called "POSTFORM". This will post with the data type set to
-// application/x-www-form-urlencoded instead of the more likely needed
-// application/json. This is necessary if you are doing authentication
-// or if you are sending form data up.
-//
-// opData: The data sent along with the operation. You may send nil. If the
-// operation is GET, this value is ignored. Usually, this would be
-// expected to be in json format. With this oblique approach, it is
-// your responsibility to format the data correctly for whatever you're
-// doing. Bear in mind that this api comes with SBJson, which provides
-// some very simple ways to assemble json formatted strings. See SBJsonWriter.
-//
-// NOTE - This function will be synchronous or asynchronous the same as any
-// other function in the API. It is based on the value sent to setDelegate.
--(UGClientResponse *)apiRequest: (NSString *)url operation:(NSString *)op data:(NSString *)opData;
-
-/*********************** DEBUGGING ASSISTANCE ************************/
-// when logging is on, all outgoing URLs are logged via NSLog, and all
-// incoming data from the service is also logged. Additionally, any errors
-// encountered internally are logged. This can be helpful to see the actual
-// service communication in progress and help debug problems you may be having.
--(void)setLogging: (BOOL)loggingState;
-
-/*********************** VERSION CHECKING ************************/
-#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
-#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
-#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
-#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
-#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
-
-@end