Permalink
Browse files

Adding Dropbox SDK v1.

  • Loading branch information...
1 parent c9ddddd commit deee7cb36eb02029d4d91ac6c658543af11d46c5 Chris Trompette committed with webframp Oct 1, 2012
Showing with 1,796 additions and 0 deletions.
  1. BIN DropboxSDK.framework/DropboxSDK
  2. +36 −0 DropboxSDK.framework/Headers/Base64Transcoder.h
  3. +29 −0 DropboxSDK.framework/Headers/DBAccountInfo.h
  4. +10 −0 DropboxSDK.framework/Headers/DBDefines.h
  5. +21 −0 DropboxSDK.framework/Headers/DBDeltaEntry.h
  6. +21 −0 DropboxSDK.framework/Headers/DBError.h
  7. +75 −0 DropboxSDK.framework/Headers/DBJSON.h
  8. +86 −0 DropboxSDK.framework/Headers/DBJsonBase.h
  9. +87 −0 DropboxSDK.framework/Headers/DBJsonParser.h
  10. +129 −0 DropboxSDK.framework/Headers/DBJsonWriter.h
  11. +38 −0 DropboxSDK.framework/Headers/DBLog.h
  12. +47 −0 DropboxSDK.framework/Headers/DBMetadata.h
  13. +23 −0 DropboxSDK.framework/Headers/DBQuota.h
  14. +77 −0 DropboxSDK.framework/Headers/DBRequest.h
  15. +220 −0 DropboxSDK.framework/Headers/DBRestClient.h
  16. +22 −0 DropboxSDK.framework/Headers/DBSession+iOS.h
  17. +59 −0 DropboxSDK.framework/Headers/DBSession.h
  18. +7 −0 DropboxSDK.framework/Headers/DropboxSDK-Prefix.pch
  19. +20 −0 DropboxSDK.framework/Headers/DropboxSDK.h
  20. +55 −0 DropboxSDK.framework/Headers/JSON.h
  21. +14 −0 DropboxSDK.framework/Headers/MPDebug.h
  22. +20 −0 DropboxSDK.framework/Headers/MPOAuth.h
  23. +86 −0 DropboxSDK.framework/Headers/MPOAuthAPI.h
  24. +50 −0 DropboxSDK.framework/Headers/MPOAuthAPIRequestLoader.h
  25. +30 −0 DropboxSDK.framework/Headers/MPOAuthAuthenticationMethod.h
  26. +44 −0 DropboxSDK.framework/Headers/MPOAuthAuthenticationMethodOAuth.h
  27. +29 −0 DropboxSDK.framework/Headers/MPOAuthConnection.h
  28. +18 −0 DropboxSDK.framework/Headers/MPOAuthCredentialConcreteStore+KeychainAdditions.h
  29. +40 −0 DropboxSDK.framework/Headers/MPOAuthCredentialConcreteStore.h
  30. +33 −0 DropboxSDK.framework/Headers/MPOAuthCredentialStore.h
  31. +28 −0 DropboxSDK.framework/Headers/MPOAuthParameterFactory.h
  32. +28 −0 DropboxSDK.framework/Headers/MPOAuthSignatureParameter.h
  33. +32 −0 DropboxSDK.framework/Headers/MPOAuthURLRequest.h
  34. +20 −0 DropboxSDK.framework/Headers/MPOAuthURLResponse.h
  35. +30 −0 DropboxSDK.framework/Headers/MPURLRequestParameter.h
  36. +15 −0 DropboxSDK.framework/Headers/NSDictionary+Dropbox.h
  37. +68 −0 DropboxSDK.framework/Headers/NSObject+DBJSON.h
  38. +58 −0 DropboxSDK.framework/Headers/NSString+DBJSON.h
  39. +18 −0 DropboxSDK.framework/Headers/NSString+Dropbox.h
  40. +21 −0 DropboxSDK.framework/Headers/NSString+URLEscapingAdditions.h
  41. +21 −0 DropboxSDK.framework/Headers/NSURL+MPURLParameterAdditions.h
  42. +14 −0 DropboxSDK.framework/Headers/NSURLResponse+Encoding.h
  43. +17 −0 DropboxSDK.framework/Headers/UIAlertView+Dropbox.h
  44. BIN DropboxSDK.framework/Info.plist
Binary file not shown.
@@ -0,0 +1,36 @@
+/*
+ * Base64Transcoder.h
+ * Base64Test
+ *
+ * Created by Jonathan Wight on Tue Mar 18 2003.
+ * Copyright (c) 2003 Toxic Software. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+extern size_t EstimateBas64EncodedDataSize(size_t inDataSize);
+extern size_t EstimateBas64DecodedDataSize(size_t inDataSize);
+
+extern bool Base64EncodeData(const void *inInputData, size_t inInputDataSize, char *outOutputData, size_t *ioOutputDataSize);
+extern bool Base64DecodeData(const void *inInputData, size_t inInputDataSize, void *ioOutputData, size_t *ioOutputDataSize);
+
@@ -0,0 +1,29 @@
+//
+// DBAccountInfo.h
+// DropboxSDK
+//
+// Created by Brian Smith on 5/3/10.
+// Copyright 2010 Dropbox, Inc. All rights reserved.
+//
+
+
+#import "DBQuota.h"
+
+@interface DBAccountInfo : NSObject <NSCoding> {
+ NSString* country;
+ NSString* displayName;
+ DBQuota* quota;
+ NSString* userId;
+ NSString* referralLink;
+ NSDictionary* original;
+}
+
+- (id)initWithDictionary:(NSDictionary*)dict;
+
+@property (nonatomic, readonly) NSString* country;
+@property (nonatomic, readonly) NSString* displayName;
+@property (nonatomic, readonly) DBQuota* quota;
+@property (nonatomic, readonly) NSString* userId;
+@property (nonatomic, readonly) NSString* referralLink;
+
+@end
@@ -0,0 +1,10 @@
+//
+// DBDefines.h
+// DropboxSDK
+//
+// Created by Brian Smith on 8/8/11.
+// Copyright 2011 Dropbox, Inc. All rights reserved.
+//
+
+// Taken from three20 (http://three20.info/)
+#define DB_FIX_CATEGORY_BUG(name) @interface DB_FIX_CATEGORY_BUG##name @end @implementation DB_FIX_CATEGORY_BUG##name @end
@@ -0,0 +1,21 @@
+//
+// DBDeltaEntry.h
+// DropboxSDK
+//
+// Created by Brian Smith on 3/25/12.
+// Copyright (c) 2012 Dropbox. All rights reserved.
+//
+
+#import "DBMetadata.h"
+
+@interface DBDeltaEntry : NSObject <NSCoding> {
+ NSString *lowercasePath;
+ DBMetadata *metadata;
+}
+
+- (id)initWithArray:(NSArray *)array;
+
+@property (nonatomic, readonly) NSString *lowercasePath;
+@property (nonatomic, readonly) DBMetadata *metadata; // nil if file has been deleted
+
+@end
@@ -0,0 +1,21 @@
+//
+// DBError.h
+// DropboxSDK
+//
+// Created by Brian Smith on 7/21/10.
+// Copyright 2010 Dropbox, Inc. All rights reserved.
+//
+
+/* This file contains error codes and the dropbox error domain */
+
+extern NSString* DBErrorDomain;
+
+// Error codes in the dropbox.com domain represent the HTTP status code if less than 1000
+typedef enum {
+ DBErrorNone = 0,
+ DBErrorGenericError = 1000,
+ DBErrorFileNotFound,
+ DBErrorInsufficientDiskSpace,
+ DBErrorIllegalFileType, // Error sent if you try to upload a directory
+ DBErrorInvalidResponse, // Sent when the client does not get valid JSON when it's expecting it
+} DBErrorCode;
@@ -0,0 +1,75 @@
+/*
+ Copyright (C) 2007-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>
+#import "DBJsonParser.h"
+#import "DBJsonWriter.h"
+
+/**
+ @brief Facade for DBJsonWriter/DBJsonParser.
+
+ Requests are forwarded to instances of DBJsonWriter and DBJsonParser.
+ */
+@interface DBJSON : DBJsonBase <DBJsonParser, DBJsonWriter> {
+
+@private
+ DBJsonParser *jsonParser;
+ DBJsonWriter *jsonWriter;
+}
+
+
+/// Return the fragment represented by the given string
+- (id)fragmentWithString:(NSString*)jsonrep
+ error:(NSError**)error;
+
+/// Return the object represented by the given string
+- (id)objectWithString:(NSString*)jsonrep
+ error:(NSError**)error;
+
+/// Parse the string and return the represented object (or scalar)
+- (id)objectWithString:(id)value
+ allowScalar:(BOOL)x
+ error:(NSError**)error;
+
+
+/// Return JSON representation of an array or dictionary
+- (NSString*)stringWithObject:(id)value
+ error:(NSError**)error;
+
+/// Return JSON representation of any legal JSON value
+- (NSString*)stringWithFragment:(id)value
+ error:(NSError**)error;
+
+/// Return JSON representation (or fragment) for the given object
+- (NSString*)stringWithObject:(id)value
+ allowScalar:(BOOL)x
+ error:(NSError**)error;
+
+
+@end
@@ -0,0 +1,86 @@
+/*
+ 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>
+
+extern NSString * DBJSONErrorDomain;
+
+
+enum {
+ EUNSUPPORTED = 1,
+ EPARSENUM,
+ EPARSE,
+ EFRAGMENT,
+ ECTRL,
+ EUNICODE,
+ EDEPTH,
+ EESCAPE,
+ ETRAILCOMMA,
+ ETRAILGARBAGE,
+ EEOF,
+ EINPUT
+};
+
+/**
+ @brief Common base class for parsing & writing.
+
+ This class contains the common error-handling code and option between the parser/writer.
+ */
+@interface DBJsonBase : NSObject {
+ NSMutableArray *errorTrace;
+
+@protected
+ NSUInteger depth, maxDepth;
+}
+
+/**
+ @brief The maximum recursing depth.
+
+ Defaults to 512. 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(copy,readonly) NSArray* errorTrace;
+
+/// @internal for use in subclasses to add errors to the stack trace
+- (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str;
+
+/// @internal for use in subclasess to clear the error before a new parsing attempt
+- (void)clearErrorTrace;
+
+@end
@@ -0,0 +1,87 @@
+/*
+ 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>
+#import "DBJsonBase.h"
+
+/**
+ @brief Options for the parser class.
+
+ This exists so the DBJSON facade can implement the options in the parser without having to re-declare them.
+ */
+@protocol DBJsonParser
+
+/**
+ @brief Return the object represented by the given string.
+
+ Returns the object represented by the passed-in string or nil on error. The returned object can be
+ a string, number, boolean, null, array or dictionary.
+
+ @param repr the json string to parse
+ */
+- (id)objectWithString:(NSString *)repr;
+
+@end
+
+
+/**
+ @brief The JSON parser class.
+
+ JSON is mapped to Objective-C types in the following way:
+
+ @li Null -> NSNull
+ @li String -> NSMutableString
+ @li Array -> NSMutableArray
+ @li Object -> NSMutableDictionary
+ @li Boolean -> NSNumber (initialised with -initWithBool:)
+ @li Number -> NSDecimalNumber
+
+ Since Objective-C doesn't have a dedicated class for boolean values, these turns into NSNumber
+ instances. These are initialised with the -initWithBool: method, and
+ round-trip back to JSON properly. (They won't silently suddenly become 0 or 1; they'll be
+ represented as 'true' and 'false' again.)
+
+ JSON numbers turn into NSDecimalNumber instances,
+ as we can thus avoid any loss of precision. (JSON allows ridiculously large numbers.)
+
+ */
+@interface DBJsonParser : DBJsonBase <DBJsonParser> {
+
+@private
+ const char *c;
+}
+
+@end
+
+// don't use - exists for backwards compatibility with 2.1.x only. Will be removed in 2.3.
+@interface DBJsonParser (Private)
+- (id)fragmentWithString:(id)repr;
+@end
+
+
Oops, something went wrong.

0 comments on commit deee7cb

Please sign in to comment.