2
0

Dumped Google+ SDK.

[UPDATED]   Google+ SDK.
This commit is contained in:
Maarten Billemont 2013-04-27 17:14:05 -04:00
parent dc3c30a2f7
commit a6e3b83ebb
206 changed files with 8949 additions and 1417 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -32,7 +32,7 @@ static NSString *EncodeBase64StringCommon(NSData *data, const char *table) {
NSUInteger bufferSize = ((length + 2) / 3) * 4;
NSMutableData* buffer = [NSMutableData dataWithLength:bufferSize];
uint8_t *output = [buffer mutableBytes];
int8_t *output = [buffer mutableBytes];
for (NSUInteger i = 0; i < length; i += 3) {
NSUInteger value = 0;
@ -70,7 +70,7 @@ 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]] = i;
decodingTable[(unsigned int) encodingTable[i]] = (char)i;
}
}
@ -80,7 +80,7 @@ static NSData *DecodeBase64StringCommon(NSString *base64Str,
const char *cString = [base64Str cStringUsingEncoding:NSASCIIStringEncoding];
if (cString == nil) return nil;
NSInteger inputLength = strlen(cString);
NSInteger inputLength = (NSInteger)strlen(cString);
if (inputLength % 4 != 0) return nil;
if (inputLength == 0) return [NSData data];
@ -89,7 +89,7 @@ static NSData *DecodeBase64StringCommon(NSString *base64Str,
}
NSInteger outputLength = inputLength * 3 / 4;
NSMutableData* data = [NSMutableData dataWithLength:outputLength];
NSMutableData* data = [NSMutableData dataWithLength:(NSUInteger)outputLength];
uint8_t *output = [data mutableBytes];
NSInteger inputPoint = 0;
@ -102,12 +102,12 @@ static NSData *DecodeBase64StringCommon(NSString *base64Str,
int i2 = inputPoint < inputLength ? cString[inputPoint++] : 'A'; // 'A' will decode to \0
int i3 = inputPoint < inputLength ? cString[inputPoint++] : 'A';
output[outputPoint++] = (table[i0] << 2) | (table[i1] >> 4);
output[outputPoint++] = (uint8_t)((table[i0] << 2) | (table[i1] >> 4));
if (outputPoint < outputLength) {
output[outputPoint++] = ((table[i1] & 0xF) << 4) | (table[i2] >> 2);
output[outputPoint++] = (uint8_t)(((table[i1] & 0xF) << 4) | (table[i2] >> 2));
}
if (outputPoint < outputLength) {
output[outputPoint++] = ((table[i2] & 0x3) << 6) | table[i3];
output[outputPoint++] = (uint8_t)(((table[i2] & 0x3) << 6) | table[i3]);
}
}

View File

@ -45,8 +45,8 @@
+ (id)batchQuery;
+ (id)batchQueryWithQueries:(NSArray *)array;
- (void)addQuery:(GTLQuery *)query;
- (void)addQuery:(GTLQuery *)query GTL_NONNULL((1));
- (GTLQuery *)queryForRequestID:(NSString *)requestID;
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1));
@end

View File

@ -34,6 +34,12 @@
@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_:
@ -58,6 +64,19 @@
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;
@ -179,29 +198,41 @@
}
}
- (NSCalendar *)calendar {
NSCalendar *cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSTimeZone *tz = self.timeZone;
if (tz) {
[cal setTimeZone:tz];
- (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 {
NSCalendar *cal = self.calendar;
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
// 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
// any time zone.
NSDateComponents *noonDateComponents = [[dateComponents copy] autorelease];
[noonDateComponents setHour:12];
[noonDateComponents setMinute:0];
@ -209,8 +240,10 @@
dateComponents = noonDateComponents;
NSTimeZone *gmt = [NSTimeZone timeZoneWithName:@"Universal"];
[cal setTimeZone:gmt];
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;
}
@ -278,10 +311,7 @@
}
- (void)setFromDate:(NSDate *)date timeZone:(NSTimeZone *)tz {
NSCalendar *cal = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
if (tz) {
[cal setTimeZone:tz];
}
NSCalendar *cal = [self calendarForTimeZone:tz];
NSUInteger const kComponentBits = (NSYearCalendarUnit | NSMonthCalendarUnit
| NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit
@ -332,25 +362,20 @@
// There should be no whitespace, so no skip characters.
[scanner setCharactersToBeSkipped:nil];
NSCharacterSet* dashSet = [NSCharacterSet characterSetWithCharactersInString:@"-"];
NSCharacterSet* tSet = [NSCharacterSet characterSetWithCharactersInString:@"Tt "];
NSCharacterSet* colonSet = [NSCharacterSet characterSetWithCharactersInString:@":"];
NSCharacterSet* plusMinusZSet = [NSCharacterSet characterSetWithCharactersInString:@"+-zZ"];
// 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:dashSet intoString:NULL] &&
[scanner scanCharactersFromSet:gDashSet intoString:NULL] &&
[scanner scanInteger:&month] &&
[scanner scanCharactersFromSet:dashSet intoString:NULL] &&
[scanner scanCharactersFromSet:gDashSet intoString:NULL] &&
[scanner scanInteger:&day] &&
// Thh:mm:ss
[scanner scanCharactersFromSet:tSet intoString:NULL] &&
[scanner scanCharactersFromSet:gTSet intoString:NULL] &&
[scanner scanInteger:&hour] &&
[scanner scanCharactersFromSet:colonSet intoString:NULL] &&
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
[scanner scanInteger:&minute] &&
[scanner scanCharactersFromSet:colonSet intoString:NULL] &&
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
[scanner scanDouble:&secDouble]) {
// At this point we got secDouble, pull it apart.
@ -360,9 +385,9 @@
// Finish parsing, now the offset info.
if (// Z or +hh:mm
[scanner scanCharactersFromSet:plusMinusZSet intoString:&sign] &&
[scanner scanCharactersFromSet:gPlusMinusZSet intoString:&sign] &&
[scanner scanInteger:&offsetHour] &&
[scanner scanCharactersFromSet:colonSet intoString:NULL] &&
[scanner scanCharactersFromSet:gColonSet intoString:NULL] &&
[scanner scanInteger:&offsetMinute]) {
}
}

View File

@ -126,3 +126,19 @@
#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

View File

@ -83,7 +83,7 @@
- (NSString *)JSONString;
// generic access to json; also creates it if necessary
- (void)setJSONValue:(id)obj forKey:(NSString *)key;
- (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
@ -93,13 +93,15 @@
// 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;
- (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.
- (void)setProperty:(id)obj forKey:(NSString *)key; // pass nil obj to remove property
- (id)propertyForKey:(NSString *)key;
//
// 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;
@ -184,7 +186,7 @@
// 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;
- (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
@ -199,7 +201,7 @@
// 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, this exists for the methods not up to spec.
// 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;

View File

@ -197,7 +197,7 @@ static NSString *const kUserDataPropertyKey = @"_userData";
// 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 ([value count] > 0) {
if ([(NSArray *)value count] > 0) {
id firstObj = [value objectAtIndex:0];
if ([firstObj isKindOfClass:[NSDictionary class]]) {
// An array of objects
@ -455,7 +455,7 @@ static NSString *const kUserDataPropertyKey = @"_userData";
} else if ([rawValue isKindOfClass:[NSArray class]]) {
// for arrays, show the number of items in the array:
// [3]
value = [NSString stringWithFormat:@"[%lu]", (unsigned long)[rawValue count]];
value = [NSString stringWithFormat:@"[%lu]", (unsigned long)[(NSArray *)rawValue count]];
} else if ([rawValue isKindOfClass:[NSString class]]) {
// for strings, show the string in quotes:
// "Hi mom."

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,16 +20,25 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// 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"

View File

@ -0,0 +1,60 @@
/* 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

View File

@ -0,0 +1,61 @@
/* 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

View File

@ -0,0 +1,61 @@
/* 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

View File

@ -0,0 +1,48 @@
/* 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

View File

@ -0,0 +1,493 @@
/* 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

View File

@ -0,0 +1,290 @@
/* 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

View File

@ -0,0 +1,81 @@
/* 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

View File

@ -0,0 +1,64 @@
/* 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

View File

@ -0,0 +1,183 @@
/* 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

View File

@ -0,0 +1,133 @@
/* 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

View File

@ -0,0 +1,78 @@
/* 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

View File

@ -0,0 +1,63 @@
/* 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

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
#import <Foundation/Foundation.h>
@ -35,10 +35,23 @@
#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"
// Send your activity to your private Google+ history
GTL_EXTERN NSString * const kGTLAuthScopePlusMomentsWrite; // "https://www.googleapis.com/auth/plus.moments.write"
GTL_EXTERN NSString * const kGTLAuthScopePlusMe; // "https://www.googleapis.com/auth/plus.me"
// Collection
GTL_EXTERN NSString * const kGTLPlusCollectionVault; // "vault"
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"

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,17 +20,30 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
#import "GTLPlusConstants.h"
// Authorization scope
NSString * const kGTLAuthScopePlusMe = @"https://www.googleapis.com/auth/plus.me";
NSString * const kGTLAuthScopePlusMomentsWrite = @"https://www.googleapis.com/auth/plus.moments.write";
NSString * const kGTLAuthScopePlusLogin = @"https://www.googleapis.com/auth/plus.login";
NSString * const kGTLAuthScopePlusMe = @"https://www.googleapis.com/auth/plus.me";
// Collection
NSString * const kGTLPlusCollectionVault = @"vault";
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";

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLPlusItemScope (0 custom class methods, 55 custom properties)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLPlusItemScope (0 custom class methods, 55 custom properties)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLPlusMoment (0 custom class methods, 6 custom properties)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLPlusMoment (0 custom class methods, 6 custom properties)

View File

@ -0,0 +1,76 @@
/* 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

View File

@ -0,0 +1,61 @@
/* 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

View File

@ -0,0 +1,76 @@
/* 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

View File

@ -0,0 +1,61 @@
/* 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

View File

@ -0,0 +1,388 @@
/* 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

View File

@ -0,0 +1,189 @@
/* 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

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,13 +20,13 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLQueryPlus (1 custom class methods, 4 custom properties)
// GTLQueryPlus (12 custom class methods, 15 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLQuery.h"
@ -48,16 +48,123 @@
//
// 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 user activity (e.g Bill watched a video on Youtube)
// 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.
@ -66,11 +173,125 @@
// Optional:
// debug: Return the moment as written. Should be used only for debugging.
// Authorization scope(s):
// kGTLAuthScopePlusMe
// kGTLAuthScopePlusMomentsWrite
// 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

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,21 +20,87 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLQueryPlus (1 custom class methods, 4 custom properties)
// 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 collection, debug, fields, userId;
@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
@ -56,4 +122,61 @@
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

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLServicePlus (0 custom class methods, 0 custom properties)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012 Google Inc.
/* 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.
@ -20,11 +20,11 @@
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Google+ API (plus/v1moments)
// Google+ API (plus/v1)
// Description:
// The Google+ API enables developers to build on top of the Google+ platform.
// Documentation:
// https://developers.google.com/+/history/
// https://developers.google.com/+/api/
// Classes:
// GTLServicePlus (0 custom class methods, 0 custom properties)
@ -38,8 +38,17 @@
+ (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;
}
@ -49,7 +58,7 @@
self = [super init];
if (self) {
// Version from discovery.
self.apiVersion = @"v1moments";
self.apiVersion = @"v1";
// From discovery. Where to send JSON-RPC.
// Turn off prettyPrint for this service to save bandwidth (especially on

View File

@ -116,15 +116,15 @@
#endif
// methodName is the RPC method name to use.
+ (id)queryWithMethodName:(NSString *)methodName;
+ (id)queryWithMethodName:(NSString *)methodName GTL_NONNULL((1));
// methodName is the RPC method name to use.
- (id)initWithMethodName:(NSString *)method;
- (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;
- (void)setCustomParameter:(id)obj forKey:(NSString *)key GTL_NONNULL((2));
// Auto-generated request IDs
+ (NSString *)nextRequestID;

View File

@ -160,11 +160,11 @@ typedef void *GTLServiceUploadProgressBlock;
- (GTLServiceTicket *)executeQuery:(id<GTLQueryProtocol>)query
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
#if NS_BLOCKS_AVAILABLE
- (GTLServiceTicket *)executeQuery:(id<GTLQueryProtocol>)query
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler;
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
#endif
// Automatic page fetches
@ -231,85 +231,85 @@ typedef void *GTLServiceUploadProgressBlock;
parameters:(NSDictionary *)parameters
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithMethodNamed:(NSString *)methodName
insertingObject:(GTLObject *)bodyObject
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
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;
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;
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;
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;
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;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchPublicObjectWithURL:(NSURL *)objectURL
objectClass:(Class)objectClass
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
- (GTLServiceTicket *)fetchObjectByInsertingObject:(GTLObject *)bodyToPut
forURL:(NSURL *)destinationURL
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1,2));
- (GTLServiceTicket *)fetchObjectByUpdatingObject:(GTLObject *)bodyToPut
forURL:(NSURL *)destinationURL
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1,2));
- (GTLServiceTicket *)deleteResourceURL:(NSURL *)destinationURL
ETag:(NSString *)etagOrNil
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
didFinishSelector:(SEL)finishedSelector GTL_NONNULL((1));
#if NS_BLOCKS_AVAILABLE
- (GTLServiceTicket *)fetchObjectWithURL:(NSURL *)objectURL
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler;
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;
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;
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;
completionHandler:(void (^)(GTLServiceTicket *ticket, id object, NSError *error))handler GTL_NONNULL((1));
#endif
#pragma mark User Properties
@ -320,8 +320,8 @@ typedef void *GTLServiceUploadProgressBlock;
//
// The service properties dictionary is copied to become the initial property
// dictionary for each ticket.
- (void)setServiceProperty:(id)obj forKey:(NSString *)key; // pass nil obj to remove property
- (id)servicePropertyForKey:(NSString *)key;
- (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;
@ -391,7 +391,7 @@ typedef void *GTLServiceUploadProgressBlock;
// For http method, pass nil (for default GET method), POST, PUT, or DELETE
- (NSMutableURLRequest *)requestForURL:(NSURL *)url
ETag:(NSString *)etagOrNil
httpMethod:(NSString *)httpMethodOrNil;
httpMethod:(NSString *)httpMethodOrNil GTL_NONNULL((1));
// objectRequestForURL returns an NSMutableURLRequest for a JSON GTL object
//
@ -403,7 +403,7 @@ typedef void *GTLServiceUploadProgressBlock;
httpMethod:(NSString *)httpMethod
isREST:(BOOL)isREST
additionalHeaders:(NSDictionary *)additionalHeaders
ticket:(GTLServiceTicket *)ticket;
ticket:(GTLServiceTicket *)ticket GTL_NONNULL((1));
// The queue used for parsing JSON responses (previously this property
// was called operationQueue)
@ -479,7 +479,7 @@ typedef void *GTLServiceUploadProgressBlock;
- (BOOL)waitForTicket:(GTLServiceTicket *)ticket
timeout:(NSTimeInterval)timeoutInSeconds
fetchedObject:(GTLObject **)outObjectOrNil
error:(NSError **)outErrorOrNil;
error:(NSError **)outErrorOrNil GTL_NONNULL((1));
@end
#pragma mark -
@ -555,7 +555,7 @@ typedef void *GTLServiceUploadProgressBlock;
// Properties and userData are supported for client convenience.
//
// Property keys beginning with _ are reserved by the library.
- (void)setProperty:(id)obj forKey:(NSString *)key; // pass nil obj to remove property
- (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;
@ -567,7 +567,7 @@ typedef void *GTLServiceUploadProgressBlock;
@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; // Returns the query from within the batch with the given id.
- (GTLQuery *)queryForRequestID:(NSString *)requestID GTL_NONNULL((1)); // Returns the query from within the batch with the given id.
@property (nonatomic, retain) NSDictionary *surrogates;

View File

@ -633,7 +633,10 @@ static NSString *ETagIfPresent(GTLObject *obj) {
if (bodyObject != nil) {
GTL_DEBUG_ASSERT([parameters objectForKey:kBodyObjectParamKey] == nil,
@"There was already something under the 'data' key?!");
[worker setObject:[bodyObject JSON] forKey:kBodyObjectParamKey];
NSMutableDictionary *json = [bodyObject JSON];
if (json != nil) {
[worker setObject:json forKey:kBodyObjectParamKey];
}
}
finalParams = worker;
}

View File

@ -52,9 +52,9 @@
@property (assign) BOOL shouldSendUploadOnly;
+ (GTLUploadParameters *)uploadParametersWithData:(NSData *)data
MIMEType:(NSString *)mimeType;
MIMEType:(NSString *)mimeType GTL_NONNULL((1,2));
+ (GTLUploadParameters *)uploadParametersWithFileHandle:(NSFileHandle *)fileHandle
MIMEType:(NSString *)mimeType;
MIMEType:(NSString *)mimeType GTL_NONNULL((1,2));
@end

View File

@ -104,7 +104,7 @@ const CFStringRef kCharsToForceEscape = CFSTR("!*'();:@&=+$,/?%#[]");
for (unsigned int idx = 0; utf8[idx] != '\0'; idx++) {
unsigned char currChar = utf8[idx];
unsigned char currChar = (unsigned char)utf8[idx];
if (currChar < 0x20 || currChar == 0x25 || currChar > 0x7E) {
if (encoded == nil) {
@ -322,19 +322,36 @@ BOOL GTL_AreBoolsEqual(BOOL b1, BOOL 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]]) {
NSDecimalNumber *reallyNum;
// Force the parse to use '.' as the number seperator.
static NSLocale *usLocale = nil;
@synchronized([GTLUtilities class]) {
if (usLocale == nil) {
usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
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];
}
reallyNum = [NSDecimalNumber decimalNumberWithString:(NSString*)num
locale:(id)usLocale];
}
if (reallyNum != nil) {
num = reallyNum;
if (newNum) {
num = newNum;
}
}
return num;

View File

@ -217,21 +217,10 @@
#define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE
#endif
// Provide a symbol to include/exclude extra code for GC support. (This mainly
// just controls the inclusion of finalize methods).
// GC was dropped by Apple, define the old constant incase anyone still keys
// off of it.
#ifndef GTM_SUPPORT_GC
#if GTM_IPHONE_SDK
// iPhone never needs GC
#define GTM_SUPPORT_GC 0
#else
// We can't find a symbol to tell if GC is supported/required, so best we
// do on Mac targets is include it if we're on 10.5 or later.
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
#define GTM_SUPPORT_GC 0
#else
#define GTM_SUPPORT_GC 1
#endif
#endif
#define GTM_SUPPORT_GC 0
#endif
// To simplify support for 64bit (and Leopard in general), we provide the type
@ -352,7 +341,15 @@
#endif
#ifndef GTM_NONNULL
#define GTM_NONNULL(x) __attribute__((nonnull(x)))
#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.

View File

@ -183,13 +183,13 @@ static NSString* const kGTMETagHeader = @"Etag";
- (void)removeExpiredCookies {
// count backwards since we're deleting items from the array
for (NSInteger idx = [cookies_ count] - 1; idx >= 0; idx--) {
for (NSInteger idx = (NSInteger)[cookies_ count] - 1; idx >= 0; idx--) {
NSHTTPCookie *storedCookie = [cookies_ objectAtIndex:idx];
NSHTTPCookie *storedCookie = [cookies_ objectAtIndex:(NSUInteger)idx];
NSDate *expiresDate = [storedCookie expiresDate];
if (expiresDate && [expiresDate timeIntervalSinceNow] < 0) {
[cookies_ removeObjectAtIndex:idx];
[cookies_ removeObjectAtIndex:(NSUInteger)idx];
}
}
}

View File

@ -390,6 +390,8 @@ NSString *GTMApplicationIdentifier(NSBundle *bundle);
- (void)stopAuthorization;
- (void)stopAuthorizationForRequest:(NSURLRequest *)request;
- (BOOL)isAuthorizingRequest:(NSURLRequest *)request;
- (BOOL)isAuthorizedRequest:(NSURLRequest *)request;
@ -472,6 +474,11 @@ NSString *GTMApplicationIdentifier(NSBundle *bundle);
NSString *comment_; // comment for log
NSString *log_;
#if !STRIP_GTM_FETCH_LOGGING
NSString *logRequestBody_;
NSString *logResponseBody_;
BOOL shouldDeferResponseBodyLogging_;
#endif
}
// Create a fetcher
@ -704,7 +711,7 @@ NSString *GTMApplicationIdentifier(NSBundle *bundle);
// Comments are useful for logging
@property (copy) NSString *comment;
- (void)setCommentWithFormat:(id)format, ...;
- (void)setCommentWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
// Log of request and response, if logging is enabled
@property (copy) NSString *log;

View File

@ -54,6 +54,7 @@ static NSString *const kCallbackError = @"error";
- (BOOL)beginFetchMayDelay:(BOOL)mayDelay
mayAuthorize:(BOOL)mayAuthorize;
- (void)failToBeginFetchWithError:(NSError *)error;
- (void)failToBeginFetchDeferWithError:(NSError *)error;
#if GTM_BACKGROUND_FETCHING
- (void)endBackgroundTask;
@ -72,8 +73,6 @@ static NSString *const kCallbackError = @"error";
- (void)addCookiesToRequest:(NSMutableURLRequest *)request;
- (void)handleCookiesForResponse:(NSURLResponse *)response;
- (void)logNowWithError:(NSError *)error;
- (void)invokeFetchCallbacksWithData:(NSData *)data
error:(NSError *)error;
- (void)invokeFetchCallback:(SEL)sel
@ -205,6 +204,10 @@ static NSString *const kCallbackError = @"error";
[retryTimer_ release];
[comment_ release];
[log_ release];
#if !STRIP_GTM_FETCH_LOGGING
[logRequestBody_ release];
[logResponseBody_ release];
#endif
[super dealloc];
}
@ -241,8 +244,8 @@ static NSString *const kCallbackError = @"error";
goto CannotBeginFetch;
}
if (request_ == nil) {
NSAssert(request_ != nil, @"beginFetchWithDelegate requires a request");
if (request_ == nil || [request_ URL] == nil) {
NSAssert(request_ != nil, @"beginFetchWithDelegate requires a request with a URL");
goto CannotBeginFetch;
}
@ -407,10 +410,28 @@ static NSString *const kCallbackError = @"error";
return YES;
CannotBeginFetch:
[self failToBeginFetchWithError:error];
[self failToBeginFetchDeferWithError:error];
return NO;
}
- (void)failToBeginFetchDeferWithError:(NSError *)error {
if (delegateQueue_) {
// Deferring will happen by the callback being invoked on the specified
// queue.
[self failToBeginFetchWithError:error];
} else {
// No delegate queue has been specified, so put the callback
// on an appropriate run loop.
NSArray *modes = (runLoopModes_ ? runLoopModes_ :
[NSArray arrayWithObject:NSRunLoopCommonModes]);
[self performSelector:@selector(failToBeginFetchWithError:)
onThread:[NSThread currentThread]
withObject:error
waitUntilDone:NO
modes:modes];
}
}
- (void)failToBeginFetchWithError:(NSError *)error {
if (error == nil) {
error = [NSError errorWithDomain:kGTMHTTPFetcherErrorDomain
@ -438,14 +459,13 @@ CannotBeginFetch:
#if GTM_BACKGROUND_FETCHING
- (void)backgroundFetchExpired {
// On background expiration, we stop the fetch and invoke the callbacks
NSError *error = [NSError errorWithDomain:kGTMHTTPFetcherErrorDomain
code:kGTMHTTPFetcherErrorBackgroundExpiration
userInfo:nil];
[self invokeFetchCallbacksOnDelegateQueueWithData:nil
error:error];
@synchronized(self) {
// On background expiration, we stop the fetch and invoke the callbacks
NSError *error = [NSError errorWithDomain:kGTMHTTPFetcherErrorDomain
code:kGTMHTTPFetcherErrorBackgroundExpiration
userInfo:nil];
[self invokeFetchCallbacksOnDelegateQueueWithData:nil
error:error];
// Stopping the fetch here will indirectly call endBackgroundTask
[self stopFetchReleasingCallbacks:NO];
@ -455,14 +475,16 @@ CannotBeginFetch:
}
- (void)endBackgroundTask {
// Whenever the connection stops or background execution expires,
// we need to tell UIApplication we're done
if (backgroundTaskIdentifer_) {
// If backgroundTaskIdentifer_ is non-zero, we know we're on iOS 4
UIApplication *app = [UIApplication sharedApplication];
[app endBackgroundTask:backgroundTaskIdentifer_];
@synchronized(self) {
// Whenever the connection stops or background execution expires,
// we need to tell UIApplication we're done
if (backgroundTaskIdentifer_) {
// If backgroundTaskIdentifer_ is non-zero, we know we're on iOS 4
UIApplication *app = [UIApplication sharedApplication];
[app endBackgroundTask:backgroundTaskIdentifer_];
backgroundTaskIdentifer_ = 0;
backgroundTaskIdentifer_ = 0;
}
}
}
#endif // GTM_BACKGROUND_FETCHING
@ -491,7 +513,7 @@ CannotBeginFetch:
finishedWithError:(NSError *)error {
if (error != nil) {
// We can't fetch without authorization
[self failToBeginFetchWithError:error];
[self failToBeginFetchDeferWithError:error];
} else {
[self beginFetchMayDelay:NO
mayAuthorize:NO];
@ -625,6 +647,8 @@ CannotBeginFetch:
// Cancel the fetch of the URL that's currently in progress.
- (void)stopFetchReleasingCallbacks:(BOOL)shouldReleaseCallbacks {
id <GTMHTTPFetcherServiceProtocol> service;
// if the connection or the retry timer is all that's retaining the fetcher,
// we want to be sure this instance survives stopping at least long enough for
// the stack to unwind
@ -632,39 +656,45 @@ CannotBeginFetch:
[self destroyRetryTimer];
if (connection_) {
// in case cancelling the connection calls this recursively, we want
// to ensure that we'll only release the connection and delegate once,
// so first set connection_ to nil
NSURLConnection* oldConnection = connection_;
connection_ = nil;
@synchronized(self) {
service = [[service_ retain] autorelease];
if (!hasConnectionEnded_) {
[oldConnection cancel];
if (connection_) {
// in case cancelling the connection calls this recursively, we want
// to ensure that we'll only release the connection and delegate once,
// so first set connection_ to nil
NSURLConnection* oldConnection = connection_;
connection_ = nil;
if (!hasConnectionEnded_) {
[oldConnection cancel];
}
// this may be called in a callback from the connection, so use autorelease
[oldConnection autorelease];
}
// this may be called in a callback from the connection, so use autorelease
[oldConnection autorelease];
}
// send the stopped notification
[self sendStopNotificationIfNeeded];
[authorizer_ stopAuthorization];
@synchronized(self) {
[authorizer_ stopAuthorizationForRequest:request_];
if (shouldReleaseCallbacks) {
[self releaseCallbacks];
if (shouldReleaseCallbacks) {
[self releaseCallbacks];
self.authorizer = nil;
self.authorizer = nil;
}
if (temporaryDownloadPath_) {
[[NSFileManager defaultManager] removeItemAtPath:temporaryDownloadPath_
error:NULL];
self.temporaryDownloadPath = nil;
}
}
[service_ fetcherDidStop:self];
if (temporaryDownloadPath_) {
[[NSFileManager defaultManager] removeItemAtPath:temporaryDownloadPath_
error:NULL];
self.temporaryDownloadPath = nil;
}
[service fetcherDidStop:self];
#if GTM_BACKGROUND_FETCHING
[self endBackgroundTask];
@ -673,15 +703,19 @@ CannotBeginFetch:
// External stop method
- (void)stopFetching {
@synchronized(self) {
[self stopFetchReleasingCallbacks:YES];
}
[self stopFetchReleasingCallbacks:YES];
}
- (void)sendStopNotificationIfNeeded {
if (isStopNotificationNeeded_) {
isStopNotificationNeeded_ = NO;
BOOL sendNow = NO;
@synchronized(self) {
if (isStopNotificationNeeded_) {
isStopNotificationNeeded_ = NO;
sendNow = YES;
}
}
if (sendNow) {
NSNotificationCenter *defaultNC = [NSNotificationCenter defaultCenter];
[defaultNC postNotificationName:kGTMHTTPFetcherStoppedNotification
object:self];
@ -895,16 +929,28 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
- (void)invokeFetchCallbacksWithData:(NSData *)data
error:(NSError *)error {
// To avoid deadlocks, this should not be called inside of @synchronized(self)
id target;
SEL sel;
#if NS_BLOCKS_AVAILABLE
void (^block)(NSData *, NSError *);
#endif
@synchronized(self) {
target = delegate_;
sel = finishedSel_;
block = completionBlock_;
}
[[self retain] autorelease]; // In case the callback releases us
[self invokeFetchCallback:finishedSel_
target:delegate_
[self invokeFetchCallback:sel
target:target
data:data
error:error];
#if NS_BLOCKS_AVAILABLE
if (completionBlock_) {
completionBlock_(data, error);
if (block) {
block(data, error);
}
#endif
}
@ -1064,42 +1110,56 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
// and copy the cached data.
//
// For other errors or if there's no cached data, just return the actual status.
- (NSInteger)statusAfterHandlingNotModifiedError {
NSInteger status = [self statusCode];
if (status == kGTMHTTPFetcherStatusNotModified
- (NSData *)cachedDataForStatus {
if ([self statusCode] == kGTMHTTPFetcherStatusNotModified
&& [fetchHistory_ shouldCacheETaggedData]) {
NSData *cachedData = [fetchHistory_ cachedDataForRequest:request_];
if (cachedData) {
// Forge the status to pass on to the delegate
status = 200;
return cachedData;
}
return nil;
}
// Copy our stored data
if (downloadFileHandle_ != nil) {
@try {
// Downloading to a file handle won't save to the cache (the data is
// likely inappropriately large for caching), but will still read from
// the cache, on the unlikely chance that the response was Not Modified
// and the URL response was indeed present in the cache.
[downloadFileHandle_ truncateFileAtOffset:0];
[downloadFileHandle_ writeData:cachedData];
downloadedLength_ = [downloadFileHandle_ offsetInFile];
}
@catch (NSException *) {
// Failed to write data, likely due to lack of disk space
status = kGTMHTTPFetcherErrorFileHandleException;
}
} else {
[downloadedData_ setData:cachedData];
downloadedLength_ = [cachedData length];
- (NSInteger)statusAfterHandlingNotModifiedError {
NSInteger status = [self statusCode];
NSData *cachedData = [self cachedDataForStatus];
if (cachedData) {
// Forge the status to pass on to the delegate
status = 200;
// Copy our stored data
if (downloadFileHandle_ != nil) {
@try {
// Downloading to a file handle won't save to the cache (the data is
// likely inappropriately large for caching), but will still read from
// the cache, on the unlikely chance that the response was Not Modified
// and the URL response was indeed present in the cache.
[downloadFileHandle_ truncateFileAtOffset:0];
[downloadFileHandle_ writeData:cachedData];
downloadedLength_ = [downloadFileHandle_ offsetInFile];
}
@catch (NSException *) {
// Failed to write data, likely due to lack of disk space
status = kGTMHTTPFetcherErrorFileHandleException;
}
} else {
[downloadedData_ setData:cachedData];
downloadedLength_ = [cachedData length];
}
}
return status;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
BOOL shouldStopFetching = YES;
BOOL shouldSendStopNotification = NO;
NSError *error = nil;
NSData *downloadedData;
#if !STRIP_GTM_FETCH_LOGGING
BOOL shouldDeferLogging = NO;
#endif
BOOL shouldBeginRetryTimer = NO;
BOOL hasLogged = NO;
@synchronized(self) {
// We no longer need to cancel the connection
hasConnectionEnded_ = YES;
@ -1115,21 +1175,15 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
[[self retain] autorelease]; // in case the callback releases us
[self logNowWithError:nil];
NSInteger status = [self statusCode];
if ([self cachedDataForStatus] != nil) {
// Log the pre-cache response.
[self logNowWithError:nil];
hasLogged = YES;
status = [self statusAfterHandlingNotModifiedError];
}
NSInteger status = [self statusAfterHandlingNotModifiedError];
// We want to send the stop notification before calling the delegate's
// callback selector, since the callback selector may release all of
// the fetcher properties that the client is using to track the fetches.
//
// We'll also stop now so that, to any observers watching the notifications,
// it doesn't look like our wait for a retry (which may be long,
// 30 seconds or more) is part of the network activity.
[self sendStopNotificationIfNeeded];
BOOL shouldStopFetching = YES;
NSError *error = nil;
shouldSendStopNotification = YES;
if (status >= 0 && status < 300) {
// success
@ -1149,10 +1203,15 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
}
}
} else {
// unsuccessful
if (!hasLogged) {
[self logNowWithError:nil];
hasLogged = YES;
}
// Status over 300; retry or notify the delegate of failure
if ([self shouldRetryNowForStatus:status error:nil]) {
// retrying
[self beginRetryTimer];
shouldBeginRetryTimer = YES;
shouldStopFetching = NO;
} else {
NSDictionary *userInfo = nil;
@ -1165,14 +1224,42 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
userInfo:userInfo];
}
}
downloadedData = downloadedData_;
#if !STRIP_GTM_FETCH_LOGGING
shouldDeferLogging = shouldDeferResponseBodyLogging_;
#endif
}
if (shouldStopFetching) {
// Call the callbacks
[self invokeFetchCallbacksWithData:downloadedData_
error:error];
if (shouldBeginRetryTimer) {
[self beginRetryTimer];
}
BOOL shouldRelease = [self shouldReleaseCallbacksUponCompletion];
[self stopFetchReleasingCallbacks:shouldRelease];
if (shouldSendStopNotification) {
// We want to send the stop notification before calling the delegate's
// callback selector, since the callback selector may release all of
// the fetcher properties that the client is using to track the fetches.
//
// We'll also stop now so that, to any observers watching the notifications,
// it doesn't look like our wait for a retry (which may be long,
// 30 seconds or more) is part of the network activity.
[self sendStopNotificationIfNeeded];
}
if (shouldStopFetching) {
// Call the callbacks (outside of the @synchronized to avoid deadlocks.)
[self invokeFetchCallbacksWithData:downloadedData
error:error];
BOOL shouldRelease = [self shouldReleaseCallbacksUponCompletion];
[self stopFetchReleasingCallbacks:shouldRelease];
}
@synchronized(self) {
BOOL shouldLogNow = !hasLogged;
#if !STRIP_GTM_FETCH_LOGGING
if (shouldDeferLogging) shouldLogNow = NO;
#endif
if (shouldLogNow) {
[self logNowWithError:nil];
}
}
}
@ -1198,24 +1285,21 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
hasConnectionEnded_ = YES;
[self logNowWithError:error];
}
// See comment about sendStopNotificationIfNeeded
// in connectionDidFinishLoading:
[self sendStopNotificationIfNeeded];
// See comment about sendStopNotificationIfNeeded
// in connectionDidFinishLoading:
[self sendStopNotificationIfNeeded];
if ([self shouldRetryNowForStatus:0 error:error]) {
if ([self shouldRetryNowForStatus:0 error:error]) {
[self beginRetryTimer];
} else {
[[self retain] autorelease]; // in case the callback releases us
[self beginRetryTimer];
[self invokeFetchCallbacksWithData:nil
error:error];
} else {
[[self retain] autorelease]; // in case the callback releases us
[self invokeFetchCallbacksWithData:nil
error:error];
[self stopFetchReleasingCallbacks:YES];
}
[self stopFetchReleasingCallbacks:YES];
}
}
@ -1333,43 +1417,44 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
waitUntilDone:NO];
return;
}
NSTimeInterval nextInterval = [self nextRetryInterval];
NSTimeInterval maxInterval = [self maxRetryInterval];
NSTimeInterval newInterval = MIN(nextInterval, maxInterval);
[self primeRetryTimerWithNewTimeInterval:newInterval];
}
NSTimeInterval nextInterval = [self nextRetryInterval];
NSTimeInterval maxInterval = [self maxRetryInterval];
NSTimeInterval newInterval = MIN(nextInterval, maxInterval);
[self primeRetryTimerWithNewTimeInterval:newInterval];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:kGTMHTTPFetcherRetryDelayStartedNotification
object:self];
}
- (void)primeRetryTimerWithNewTimeInterval:(NSTimeInterval)secs {
[self destroyRetryTimer];
lastRetryInterval_ = secs;
@synchronized(self) {
lastRetryInterval_ = secs;
retryTimer_ = [NSTimer timerWithTimeInterval:secs
target:self
selector:@selector(retryTimerFired:)
userInfo:nil
repeats:NO];
[retryTimer_ retain];
retryTimer_ = [NSTimer timerWithTimeInterval:secs
target:self
selector:@selector(retryTimerFired:)
userInfo:nil
repeats:NO];
[retryTimer_ retain];
NSRunLoop *timerRL = (self.delegateQueue ?
[NSRunLoop mainRunLoop] : [NSRunLoop currentRunLoop]);
[timerRL addTimer:retryTimer_
forMode:NSDefaultRunLoopMode];
NSNotificationCenter *defaultNC = [NSNotificationCenter defaultCenter];
[defaultNC postNotificationName:kGTMHTTPFetcherRetryDelayStartedNotification
object:self];
NSRunLoop *timerRL = (self.delegateQueue ?
[NSRunLoop mainRunLoop] : [NSRunLoop currentRunLoop]);
[timerRL addTimer:retryTimer_
forMode:NSDefaultRunLoopMode];
}
}
- (void)retryTimerFired:(NSTimer *)timer {
@synchronized(self) {
[self destroyRetryTimer];
[self destroyRetryTimer];
@synchronized(self) {
retryCount_++;
[self retryFetch];
@ -1377,11 +1462,17 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
}
- (void)destroyRetryTimer {
if (retryTimer_) {
[retryTimer_ invalidate];
[retryTimer_ autorelease];
retryTimer_ = nil;
BOOL shouldNotify = NO;
@synchronized(self) {
if (retryTimer_) {
[retryTimer_ invalidate];
[retryTimer_ autorelease];
retryTimer_ = nil;
shouldNotify = YES;
}
}
if (shouldNotify) {
NSNotificationCenter *defaultNC = [NSNotificationCenter defaultCenter];
[defaultNC postNotificationName:kGTMHTTPFetcherRetryDelayStoppedNotification
object:self];
@ -1575,42 +1666,56 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
}
- (id)userData {
return userData_;
@synchronized(self) {
return userData_;
}
}
- (void)setUserData:(id)theObj {
[userData_ autorelease];
userData_ = [theObj retain];
@synchronized(self) {
[userData_ autorelease];
userData_ = [theObj retain];
}
}
- (void)setProperties:(NSMutableDictionary *)dict {
[properties_ autorelease];
@synchronized(self) {
[properties_ autorelease];
// This copies rather than retains the parameter for compatiblity with
// an earlier version that took an immutable parameter and copied it.
properties_ = [dict mutableCopy];
// This copies rather than retains the parameter for compatiblity with
// an earlier version that took an immutable parameter and copied it.
properties_ = [dict mutableCopy];
}
}
- (NSMutableDictionary *)properties {
return properties_;
@synchronized(self) {
return properties_;
}
}
- (void)setProperty:(id)obj forKey:(NSString *)key {
if (properties_ == nil && obj != nil) {
[self setProperties:[NSMutableDictionary dictionary]];
@synchronized(self) {
if (properties_ == nil && obj != nil) {
[self setProperties:[NSMutableDictionary dictionary]];
}
[properties_ setValue:obj forKey:key];
}
[properties_ setValue:obj forKey:key];
}
- (id)propertyForKey:(NSString *)key {
return [properties_ objectForKey:key];
@synchronized(self) {
return [properties_ objectForKey:key];
}
}
- (void)addPropertiesFromDictionary:(NSDictionary *)dict {
if (properties_ == nil && dict != nil) {
[self setProperties:[[dict mutableCopy] autorelease]];
} else {
[properties_ addEntriesFromDictionary:dict];
@synchronized(self) {
if (properties_ == nil && dict != nil) {
[self setProperties:[[dict mutableCopy] autorelease]];
} else {
[properties_ addEntriesFromDictionary:dict];
}
}
}
@ -1620,6 +1725,7 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
if (format) {
va_list argList;
va_start(argList, format);
result = [[[NSString alloc] initWithFormat:format
arguments:argList] autorelease];
va_end(argList);

View File

@ -80,6 +80,19 @@
// internal; called by fetcher
- (void)logFetchWithError:(NSError *)error;
- (BOOL)logCapturePostStream;
// Applications may provide alternative body strings to be displayed in the
// log, such as for binary requests or responses. If deferring is turned
// on, the response log will not be sent until deferring is turned off,
// allowing the application to write the response body after the response
// data has been parsed.
- (void)setLogRequestBody:(NSString *)bodyString;
- (NSString *)logRequestBody;
- (void)setLogResponseBody:(NSString *)bodyString;
- (NSString *)logResponseBody;
- (void)setShouldDeferResponseBodyLogging:(BOOL)flag;
- (BOOL)shouldDeferResponseBodyLogging;
@end
#endif
#endif // !STRIP_GTM_FETCH_LOGGING

View File

@ -294,6 +294,51 @@ static NSString* gLoggingProcessName = nil;
}
}
- (void)setLogRequestBody:(NSString *)bodyString {
@synchronized(self) {
[logRequestBody_ release];
logRequestBody_ = [bodyString copy];
}
}
- (NSString *)logRequestBody {
@synchronized(self) {
return logRequestBody_;
}
}
- (void)setLogResponseBody:(NSString *)bodyString {
@synchronized(self) {
[logResponseBody_ release];
logResponseBody_ = [bodyString copy];
}
}
- (NSString *)logResponseBody {
@synchronized(self) {
return logResponseBody_;
}
}
- (void)setShouldDeferResponseBodyLogging:(BOOL)flag {
@synchronized(self) {
if (flag != shouldDeferResponseBodyLogging_) {
shouldDeferResponseBodyLogging_ = flag;
if (!flag) {
[self performSelectorOnMainThread:@selector(logFetchWithError:)
withObject:nil
waitUntilDone:NO];
}
}
}
}
- (BOOL)shouldDeferResponseBodyLogging {
@synchronized(self) {
return shouldDeferResponseBodyLogging_;
}
}
// stringFromStreamData creates a string given the supplied data
//
// If NSString can create a UTF-8 string from the data, then that is returned.
@ -528,16 +573,16 @@ static NSString* gLoggingProcessName = nil;
// write the date & time, the comment, and the link to the plain-text
// (copyable) log
NSString *dateLineFormat = @"<b>%@ &nbsp;&nbsp;&nbsp;&nbsp; ";
NSString *const dateLineFormat = @"<b>%@ &nbsp;&nbsp;&nbsp;&nbsp; ";
[outputHTML appendFormat:dateLineFormat, [NSDate date]];
NSString *comment = [self comment];
if (comment) {
NSString *commentFormat = @"%@ &nbsp;&nbsp;&nbsp;&nbsp; ";
NSString *const commentFormat = @"%@ &nbsp;&nbsp;&nbsp;&nbsp; ";
[outputHTML appendFormat:commentFormat, comment];
}
NSString *reqRespFormat = @"</b><a href='%@'><i>request/response log</i></a><br>";
NSString *const reqRespFormat = @"</b><a href='%@'><i>request/response log</i></a><br>";
[outputHTML appendFormat:reqRespFormat, copyableFileName];
// write the request URL
@ -601,22 +646,28 @@ static NSString* gLoggingProcessName = nil;
[outputHTML appendFormat:@"&nbsp;&nbsp; data: %d bytes, <code>%@</code><br>\n",
(int)postDataLength, postType ? postType : @"<no type>"];
postDataStr = [self stringFromStreamData:postData
contentType:postType];
if (postDataStr) {
// remove OAuth 2 client secret and refresh token
postDataStr = [[self class] snipSubstringOfString:postDataStr
betweenStartString:@"client_secret="
endString:@"&"];
if (logRequestBody_) {
postDataStr = [[logRequestBody_ copy] autorelease];
[logRequestBody_ release];
logRequestBody_ = nil;
} else {
postDataStr = [self stringFromStreamData:postData
contentType:postType];
if (postDataStr) {
// remove OAuth 2 client secret and refresh token
postDataStr = [[self class] snipSubstringOfString:postDataStr
betweenStartString:@"client_secret="
endString:@"&"];
postDataStr = [[self class] snipSubstringOfString:postDataStr
betweenStartString:@"refresh_token="
endString:@"&"];
postDataStr = [[self class] snipSubstringOfString:postDataStr
betweenStartString:@"refresh_token="
endString:@"&"];
// remove ClientLogin password
postDataStr = [[self class] snipSubstringOfString:postDataStr
betweenStartString:@"&Passwd="
endString:@"&"];
// remove ClientLogin password
postDataStr = [[self class] snipSubstringOfString:postDataStr
betweenStartString:@"&Passwd="
endString:@"&"];
}
}
} else {
// no post data
@ -637,7 +688,7 @@ static NSString* gLoggingProcessName = nil;
NSString *jsonCode = [[jsonError valueForKey:@"code"] description];
NSString *jsonMessage = [jsonError valueForKey:@"message"];
if (jsonCode || jsonMessage) {
NSString *jsonErrFmt = @"&nbsp;&nbsp;&nbsp;<i>JSON error:</i> <FONT"
NSString *const jsonErrFmt = @"&nbsp;&nbsp;&nbsp;<i>JSON error:</i> <FONT"
@" COLOR='#FF00FF'>%@ %@ &nbsp;&#x2691;</FONT>"; // 2691 =
statusString = [statusString stringByAppendingFormat:jsonErrFmt,
jsonCode ? jsonCode : @"",
@ -648,7 +699,7 @@ static NSString* gLoggingProcessName = nil;
} else {
// purple for anything other than 200 or 201
NSString *flag = (status >= 400 ? @"&nbsp;&#x2691;" : @""); // 2691 =
NSString *statusFormat = @"<FONT COLOR='#FF00FF'>%ld %@</FONT>";
NSString *const statusFormat = @"<FONT COLOR='#FF00FF'>%ld %@</FONT>";
statusString = [NSString stringWithFormat:statusFormat,
(long)status, flag];
}
@ -659,7 +710,7 @@ static NSString* gLoggingProcessName = nil;
NSURL *responseURL = [response URL];
if (responseURL && ![responseURL isEqual:[request URL]]) {
NSString *responseURLFormat = @"<FONT COLOR='#FF00FF'>response URL:"
NSString *const responseURLFormat = @"<FONT COLOR='#FF00FF'>response URL:"
"</FONT> <code>%@</code><br>\n";
responseURLStr = [NSString stringWithFormat:responseURLFormat,
[responseURL absoluteString]];
@ -700,13 +751,13 @@ static NSString* gLoggingProcessName = nil;
// Make a small inline image that links to the full image file
[outputHTML appendFormat:@"&nbsp;&nbsp; data: %d bytes, <code>%@</code><br>",
(int)responseDataLength, responseMIMEType];
NSString *fmt = @"<a href=\"%@\"><img src='%@' alt='image'"
NSString *const fmt = @"<a href=\"%@\"><img src='%@' alt='image'"
" style='border:solid thin;max-height:32'></a>\n";
[outputHTML appendFormat:fmt,
escapedResponseFile, escapedResponseFile];
} else {
// The response data was XML; link to the xml file
NSString *fmt = @"&nbsp;&nbsp; data: %d bytes, <code>"
NSString *const fmt = @"&nbsp;&nbsp; data: %d bytes, <code>"
"%@</code>&nbsp;&nbsp;&nbsp;<i><a href=\"%@\">%@</a></i>\n";
[outputHTML appendFormat:fmt,
(int)responseDataLength, responseMIMEType,
@ -747,6 +798,11 @@ static NSString* gLoggingProcessName = nil;
[copyable appendFormat:@"Response body: (%u bytes)\n",
(unsigned int) responseDataLength];
if (responseDataLength > 0) {
if (logResponseBody_) {
responseDataStr = [[logResponseBody_ copy] autorelease];
[logResponseBody_ release];
logResponseBody_ = nil;
}
if (responseDataStr != nil) {
[copyable appendFormat:@"%@\n", responseDataStr];
} else if (status >= 400 && [temporaryDownloadPath_ length] > 0) {

View File

@ -47,8 +47,11 @@ static BOOL ConformsToNSObjectProtocol(Class cls) {
|| (strncmp(className, "__NS", 4) == 0)
|| (strcmp(className, "CFObject") == 0)
|| (strcmp(className, "__IncompleteProtocol") == 0)
|| (strcmp(className, "__ARCLite__") == 0)
|| (strcmp(className, "WebMIMETypeRegistry") == 0)
#if GTM_IPHONE_SDK
|| (strcmp(className, "Object") == 0)
|| (strcmp(className, "UIKeyboardCandidateUtilities") == 0)
#endif
) {
return YES;
@ -80,14 +83,18 @@ void GTMMethodCheckMethodChecker(void) {
// Run through all the classes looking for class methods that are
// prefixed with xxGMMethodCheckMethod. If it finds one, it calls it.
// See GTMMethodCheck.h to see what it does.
#if !defined(__has_feature) || !__has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#else
@autoreleasepool {
#endif
int numClasses = 0;
int newNumClasses = objc_getClassList(NULL, 0);
int i;
Class *classes = NULL;
while (numClasses < newNumClasses) {
numClasses = newNumClasses;
classes = realloc(classes, sizeof(Class) * numClasses);
classes = (Class *)realloc(classes, sizeof(Class) * numClasses);
_GTMDevAssert(classes, @"Unable to allocate memory for classes");
newNumClasses = objc_getClassList(classes, numClasses);
}
@ -157,7 +164,11 @@ void GTMMethodCheckMethodChecker(void) {
free(methods);
}
free(classes);
#if !defined(__has_feature) || !__has_feature(objc_arc)
[pool drain];
#else
} // @autoreleasepool
#endif
}
#endif // DEBUG

View File

@ -149,6 +149,7 @@ _EXTERN NSString* const kGTMOAuth2NetworkFound _INITIALIZE_AS(@"kGTMOAuth
@property (retain) NSString *scope;
@property (retain) NSString *tokenType;
@property (retain) NSString *assertion;
@property (retain) NSString *refreshScope;
// Apps may optionally add parameters here to be provided to the token
// endpoint on token requests and refreshes
@ -176,6 +177,9 @@ _EXTERN NSString* const kGTMOAuth2NetworkFound _INITIALIZE_AS(@"kGTMOAuth
// with the authorizing service.
@property (copy) NSString *serviceProvider;
// User ID; not used for authentication
@property (retain) NSString *userID;
// User email and verified status; not used for authentication
//
// The verified string can be checked with -boolValue. If the result is false,
@ -184,8 +188,8 @@ _EXTERN NSString* const kGTMOAuth2NetworkFound _INITIALIZE_AS(@"kGTMOAuth
@property (retain) NSString *userEmail;
@property (retain) NSString *userEmailIsVerified;
// Property indicating if this auth has a refresh token so is suitable for
// authorizing a request. This does not guarantee that the token is valid.
// Property indicating if this auth has a refresh or access token so is suitable
// for authorizing a request. This does not guarantee that the token is valid.
@property (readonly) BOOL canAuthorize;
// Property indicating if this object will authorize plain http request
@ -273,9 +277,13 @@ _EXTERN NSString* const kGTMOAuth2NetworkFound _INITIALIZE_AS(@"kGTMOAuth
// Check if a request appears to be authorized
- (BOOL)isAuthorizedRequest:(NSURLRequest *)request;
// Stop any pending refresh fetch
// Stop any pending refresh fetch. This will also cancel the authorization
// for all fetch requests pending authorization.
- (void)stopAuthorization;
// Prevents authorization callback for a given request.
- (void)stopAuthorizationForRequest:(NSURLRequest *)request;
// OAuth fetch user-agent header value
- (NSString *)userAgent;

View File

@ -31,9 +31,11 @@ static NSString *const kOAuth2TokenTypeKey = @"token_type";
static NSString *const kOAuth2ExpiresInKey = @"expires_in";
static NSString *const kOAuth2CodeKey = @"code";
static NSString *const kOAuth2AssertionKey = @"assertion";
static NSString *const kOAuth2RefreshScopeKey = @"refreshScope";
// additional persistent keys
static NSString *const kServiceProviderKey = @"serviceProvider";
static NSString *const kUserIDKey = @"userID";
static NSString *const kUserEmailKey = @"email";
static NSString *const kUserEmailIsVerifiedKey = @"isVerified";
@ -178,6 +180,7 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
refreshToken,
code,
assertion,
refreshScope,
errorString,
tokenType,
scope,
@ -478,6 +481,29 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
}
}
- (void)stopAuthorizationForRequest:(NSURLRequest *)request {
@synchronized(authorizationQueue_) {
NSUInteger argIndex = 0;
BOOL found = NO;
for (GTMOAuth2AuthorizationArgs *args in authorizationQueue_) {
if ([args request] == request) {
found = YES;
break;
}
argIndex++;
}
if (found) {
[authorizationQueue_ removeObjectAtIndex:argIndex];
// If the queue is now empty, go ahead and stop the fetcher.
if ([authorizationQueue_ count] == 0) {
[self stopAuthorization];
}
}
}
}
- (BOOL)authorizeRequestImmediateArgs:(GTMOAuth2AuthorizationArgs *)args {
// This authorization entry point never attempts to refresh the access token,
// but does call the completion routine
@ -608,13 +634,15 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
NSString *accessToken = self.accessToken;
NSString *refreshToken = self.refreshToken;
NSString *assertion = self.assertion;
NSString *code = self.code;
BOOL hasRefreshToken = ([refreshToken length] > 0);
BOOL hasAccessToken = ([accessToken length] > 0);
BOOL hasAssertion = ([assertion length] > 0);
BOOL hasCode = ([code length] > 0);
// Determine if we need to refresh the access token
if (hasRefreshToken || hasAssertion) {
if (hasRefreshToken || hasAssertion || hasCode) {
if (!hasAccessToken) {
shouldRefresh = YES;
} else {
@ -666,7 +694,6 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
NSMutableDictionary *paramsDict = [NSMutableDictionary dictionary];
NSString *commentTemplate;
NSString *fetchType;
NSString *refreshToken = self.refreshToken;
@ -677,14 +704,18 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
// We have a refresh token
[paramsDict setObject:@"refresh_token" forKey:@"grant_type"];
[paramsDict setObject:refreshToken forKey:@"refresh_token"];
NSString *refreshScope = self.refreshScope;
if ([refreshScope length] > 0) {
[paramsDict setObject:refreshScope forKey:@"scope"];
}
fetchType = kGTMOAuth2FetchTypeRefresh;
commentTemplate = @"refresh token for %@";
} else if (code) {
// We have a code string
[paramsDict setObject:@"authorization_code" forKey:@"grant_type"];
[paramsDict setObject:code forKey:@"code"];
NSString *redirectURI = self.redirectURI;
if ([redirectURI length] > 0) {
[paramsDict setObject:redirectURI forKey:@"redirect_uri"];
@ -696,13 +727,11 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
}
fetchType = kGTMOAuth2FetchTypeToken;
commentTemplate = @"fetch tokens for %@";
} else if (assertion) {
// We have an assertion string
[paramsDict setObject:assertion forKey:@"assertion"];
[paramsDict setObject:@"http://oauth.net/grant_type/jwt/1.0/bearer"
forKey:@"grant_type"];
commentTemplate = @"fetch tokens for %@";
fetchType = kGTMOAuth2FetchTypeAssertion;
} else {
#if DEBUG
@ -749,7 +778,8 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
}
[fetcher setCommentWithFormat:commentTemplate, [tokenURL host]];
NSString *const template = (refreshToken ? @"refresh token for %@" : @"fetch tokens for %@");
[fetcher setCommentWithFormat:template, [tokenURL host]];
fetcher.postData = paramData;
fetcher.retryEnabled = YES;
fetcher.maxRetryInterval = 15.0;
@ -898,6 +928,7 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
[dict setValue:refreshToken forKey:kOAuth2RefreshTokenKey];
[dict setValue:accessToken forKey:kOAuth2AccessTokenKey];
[dict setValue:self.serviceProvider forKey:kServiceProviderKey];
[dict setValue:self.userID forKey:kUserIDKey];
[dict setValue:self.userEmail forKey:kUserEmailKey];
[dict setValue:self.userEmailIsVerified forKey:kUserEmailIsVerifiedKey];
[dict setValue:self.scope forKey:kOAuth2ScopeKey];
@ -965,6 +996,14 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
[self.parameters setValue:str forKey:kOAuth2AssertionKey];
}
- (NSString *)refreshScope {
return [self.parameters objectForKey:kOAuth2RefreshScopeKey];
}
- (void)setRefreshScope:(NSString *)str {
[self.parameters setValue:str forKey:kOAuth2RefreshScopeKey];
}
- (NSString *)errorString {
return [self.parameters objectForKey:kOAuth2ErrorKey];
}
@ -1024,6 +1063,14 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
[self.parameters setValue:str forKey:kServiceProviderKey];
}
- (NSString *)userID {
return [self.parameters objectForKey:kUserIDKey];
}
- (void)setUserID:(NSString *)str {
[self.parameters setValue:str forKey:kUserIDKey];
}
- (NSString *)userEmail {
return [self.parameters objectForKey:kUserEmailKey];
}

View File

@ -152,6 +152,11 @@
// delegate's finishedSelector
- (void)windowWasClosed;
// Start the sequences for signing in with an authorization code. The
// authentication must contain an authorization code, otherwise the process
// will fail.
- (void)authCodeObtained;
#pragma mark -
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT

View File

@ -46,12 +46,11 @@ NSString *const kOOBString = @"urn:ietf:wg:oauth:2.0:oob";
+ (NSMutableURLRequest *)mutableURLRequestWithURL:(NSURL *)oldURL
paramString:(NSString *)paramStr;
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
- (void)addScopeForGoogleUserInfo;
- (void)fetchGoogleUserInfo;
#endif
- (void)finishSignInWithError:(NSError *)error;
- (void)handleCallbackReached;
- (void)auth:(GTMOAuth2Authentication *)auth
finishedWithFetcher:(GTMHTTPFetcher *)fetcher
error:(NSError *)error;
@ -136,6 +135,27 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
return auth;
}
- (void)addScopeForGoogleUserInfo {
GTMOAuth2Authentication *auth = self.authentication;
if (self.shouldFetchGoogleUserEmail) {
NSString *const emailScope = @"https://www.googleapis.com/auth/userinfo.email";
NSString *scope = auth.scope;
if ([scope rangeOfString:emailScope].location == NSNotFound) {
scope = [GTMOAuth2Authentication scopeWithStrings:scope, emailScope, nil];
auth.scope = scope;
}
}
if (self.shouldFetchGoogleUserProfile) {
NSString *const profileScope = @"https://www.googleapis.com/auth/userinfo.profile";
NSString *scope = auth.scope;
if ([scope rangeOfString:profileScope].location == NSNotFound) {
scope = [GTMOAuth2Authentication scopeWithStrings:scope, profileScope, nil];
auth.scope = scope;
}
}
}
#endif
- (id)initWithAuthentication:(GTMOAuth2Authentication *)auth
@ -217,24 +237,7 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
// For signing in to Google, append the scope for obtaining the authenticated
// user email and profile, as appropriate
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
GTMOAuth2Authentication *auth = self.authentication;
if (self.shouldFetchGoogleUserEmail) {
NSString *const emailScope = @"https://www.googleapis.com/auth/userinfo.email";
NSString *scope = auth.scope;
if ([scope rangeOfString:emailScope].location == NSNotFound) {
scope = [GTMOAuth2Authentication scopeWithStrings:scope, emailScope, nil];
auth.scope = scope;
}
}
if (self.shouldFetchGoogleUserProfile) {
NSString *const profileScope = @"https://www.googleapis.com/auth/userinfo.profile";
NSString *scope = auth.scope;
if ([scope rangeOfString:profileScope].location == NSNotFound) {
scope = [GTMOAuth2Authentication scopeWithStrings:scope, profileScope, nil];
auth.scope = scope;
}
}
[self addScopeForGoogleUserInfo];
#endif
// start the authorization
@ -350,7 +353,7 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
// requested
//
// When the request is for the callback URL, this method invokes
// handleCallbackReached and returns YES
// authCodeObtained and returns YES
- (BOOL)requestRedirectedToRequest:(NSURLRequest *)redirectedRequest {
// for Google's installed app sign-in protocol, we'll look for the
// end-of-sign-in indicator in the titleChanged: method below
@ -400,7 +403,7 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
@"response lacks auth code or error");
#endif
[self handleCallbackReached];
[self authCodeObtained];
}
// tell the delegate that we did handle this request
return YES;
@ -410,7 +413,7 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
// been loadded
//
// When the title indicates sign-in has completed, this method invokes
// handleCallbackReached and returns YES
// authCodeObtained and returns YES
- (BOOL)titleChanged:(NSString *)title {
// return YES if the OAuth flow ending title was detected
@ -432,7 +435,7 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
if (!self.hasHandledCallback) {
[self.authentication setKeysForResponseDictionary:dict];
[self handleCallbackReached];
[self authCodeObtained];
}
return YES;
}
@ -467,7 +470,7 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
return NO;
}
- (void)handleCallbackReached {
- (void)authCodeObtained {
// the callback page was requested, or the authenticate code was loaded
// into a page's title, so exchange the auth code for access & refresh tokens
// and tell the window to close
@ -475,7 +478,19 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
// avoid duplicate signals that the callback point has been reached
self.hasHandledCallback = YES;
[self closeTheWindow];
// If the signin was request for exchanging an authentication token to a
// refresh token, there is no window to close.
if (self.webRequestSelector) {
[self closeTheWindow];
} else {
// For signing in to Google, append the scope for obtaining the
// authenticated user email and profile, as appropriate. This is usually
// done by the startSigningIn method, but this method is not called when
// exchanging an authentication token for a refresh token.
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
[self addScopeForGoogleUserInfo];
#endif
}
NSError *error = nil;
@ -601,6 +616,10 @@ finishedWithFetcher:(GTMHTTPFetcher *)fetcher
if (profileDict) {
self.userProfile = profileDict;
// Save the ID into the auth object
NSString *identifier = [profileDict objectForKey:@"id"];
[auth setUserID:identifier];
// Save the email into the auth object
NSString *email = [profileDict objectForKey:@"email"];
[auth setUserEmail:email];
@ -757,7 +776,8 @@ static void ReachabilityCallBack(SCNetworkReachabilityRef target,
#if !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT
+ (void)revokeTokenForGoogleAuthentication:(GTMOAuth2Authentication *)auth {
if (auth.canAuthorize
if (auth.refreshToken != nil
&& auth.canAuthorize
&& [auth.serviceProvider isEqual:kGTMOAuth2ServiceProviderGoogle]) {
// create a signed revocation request for this authentication object
@ -767,44 +787,45 @@ static void ReachabilityCallBack(SCNetworkReachabilityRef target,
NSString *token = auth.refreshToken;
NSString *encoded = [GTMOAuth2Authentication encodedOAuthValueForString:token];
NSString *body = [@"token=" stringByAppendingString:encoded];
if (encoded != nil) {
NSString *body = [@"token=" stringByAppendingString:encoded];
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPMethod:@"POST"];
NSString *userAgent = [auth userAgent];
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
NSString *userAgent = [auth userAgent];
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
// there's nothing to be done if revocation succeeds or fails
GTMHTTPFetcher *fetcher;
id <GTMHTTPFetcherServiceProtocol> fetcherService = auth.fetcherService;
if (fetcherService) {
fetcher = [fetcherService fetcherWithRequest:request];
} else {
fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
}
fetcher.comment = @"revoke token";
// there's nothing to be done if revocation succeeds or fails
GTMHTTPFetcher *fetcher;
id <GTMHTTPFetcherServiceProtocol> fetcherService = auth.fetcherService;
if (fetcherService) {
fetcher = [fetcherService fetcherWithRequest:request];
} else {
fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
}
fetcher.comment = @"revoke token";
// Use a completion handler fetch for better debugging, but only if we're
// guaranteed that blocks are available in the runtime
// Use a completion handler fetch for better debugging, but only if we're
// guaranteed that blocks are available in the runtime
#if (!TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) || \
(TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000))
// Blocks are available
[fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) {
// Blocks are available
[fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error) {
#if DEBUG
if (error) {
NSString *errStr = [[[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"revoke error: %@", errStr);
}
if (error) {
NSString *errStr = [[[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"revoke error: %@", errStr);
}
#endif // DEBUG
}];
}];
#else
// Blocks may not be available
[fetcher beginFetchWithDelegate:nil didFinishSelector:NULL];
// Blocks may not be available
[fetcher beginFetchWithDelegate:nil didFinishSelector:NULL];
#endif
}
}
[auth reset];
}
#endif // !GTM_OAUTH2_SKIP_GOOGLE_SUPPORT

View File

@ -586,7 +586,7 @@ static Class gSignInClass = Nil;
//
// Even better is for apps to check the system clock and show some more
// helpful, localized instructions for users; this is really a fallback.
NSString *html = @"<html><body><div align=center><font size='7'>"
NSString *const html = @"<html><body><div align=center><font size='7'>"
@"&#x231A; ?<br><i>System Clock Incorrect</i><br>%@"
@"</font></div></body></html>";
NSString *errHTML = [NSString stringWithFormat:html, [NSDate date]];
@ -720,6 +720,13 @@ static Class gSignInClass = Nil;
[super viewWillDisappear:animated];
}
- (void)viewDidLayoutSubviews {
// We don't call super's version of this method because
// -[UIViewController viewDidLayoutSubviews] is documented as a no-op, that
// didn't exist before iOS 5.
[initialActivityIndicator_ setCenter:[webView_ center]];
}
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {

View File

@ -3,12 +3,12 @@
<data>
<int key="IBDocument.SystemTarget">1024</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">2843</string>
<string key="IBDocument.InterfaceBuilderVersion">2840</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1929</string>
<string key="NS.object.0">1926</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -155,7 +155,7 @@
</object>
<object class="IBUIActivityIndicatorView" id="268967673">
<reference key="NSNextResponder" ref="426018584"/>
<int key="NSvFlags">292</int>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{150, 115}, {20, 20}}</string>
<reference key="NSSuperview" ref="426018584"/>
<reference key="NSWindow"/>
@ -489,6 +489,6 @@
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1929</string>
<string key="IBCocoaTouchPluginVersion">1926</string>
</data>
</archive>

View File

@ -0,0 +1,54 @@
// Copyright 2012, Google Inc.
// 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 Google Inc. 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>
// This class is used to check if Google Chrome is installed in the system and
// to open a URL in Google Chrome either with or without a callback URL.
@interface OpenInChromeController : NSObject
// Returns a shared instance of the OpenInChromeController.
+ (OpenInChromeController *)sharedInstance;
// Returns YES if Google Chrome is installed in the user's system.
- (BOOL)isChromeInstalled;
// Opens a URL in Google Chrome.
- (BOOL)openInChrome:(NSURL *)url;
// Open a URL in Google Chrome providing a |callbackURL| to return to the app.
// URLs from the same app will be opened in the same tab unless |createNewTab|
// is set to YES.
// |callbackURL| can be nil.
// The return value of this method is YES if the URL is successfully opened.
- (BOOL)openInChrome:(NSURL *)url
withCallbackURL:(NSURL *)callbackURL
createNewTab:(BOOL)createNewTab;
@end

View File

@ -0,0 +1,135 @@
// Copyright 2012, Google Inc.
// 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 Google Inc. 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 <UIKit/UIKit.h>
#import "OpenInChromeController.h"
static NSString * const kGoogleChromeHTTPScheme = @"googlechrome:";
static NSString * const kGoogleChromeHTTPSScheme = @"googlechromes:";
static NSString * const kGoogleChromeCallbackScheme =
@"googlechrome-x-callback:";
static NSString * encodeByAddingPercentEscapes(NSString *input) {
NSString *encodedValue =
(NSString *)CFURLCreateStringByAddingPercentEscapes(
kCFAllocatorDefault,
(CFStringRef)input,
NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8);
return [encodedValue autorelease];
}
@implementation OpenInChromeController
+ (OpenInChromeController *)sharedInstance {
static OpenInChromeController *sharedInstance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
- (BOOL)isChromeInstalled {
NSURL *simpleURL = [NSURL URLWithString:kGoogleChromeHTTPScheme];
NSURL *callbackURL = [NSURL URLWithString:kGoogleChromeCallbackScheme];
return [[UIApplication sharedApplication] canOpenURL:simpleURL] ||
[[UIApplication sharedApplication] canOpenURL:callbackURL];
}
- (BOOL)openInChrome:(NSURL *)url {
return [self openInChrome:url withCallbackURL:nil createNewTab:NO];
}
- (BOOL)openInChrome:(NSURL *)url
withCallbackURL:(NSURL *)callbackURL
createNewTab:(BOOL)createNewTab {
NSURL *chromeSimpleURL = [NSURL URLWithString:kGoogleChromeHTTPScheme];
NSURL *chromeCallbackURL = [NSURL URLWithString:kGoogleChromeCallbackScheme];
if ([[UIApplication sharedApplication] canOpenURL:chromeCallbackURL]) {
NSString *appName =
[[NSBundle mainBundle]
objectForInfoDictionaryKey:@"CFBundleDisplayName"];
NSString *scheme = [url.scheme lowercaseString];
// Proceed only if scheme is http or https.
if ([scheme isEqualToString:@"http"] ||
[scheme isEqualToString:@"https"]) {
NSMutableString *chromeURLString = [NSMutableString string];
[chromeURLString appendFormat:
@"%@//x-callback-url/open/?x-source=%@&url=%@",
kGoogleChromeCallbackScheme,
encodeByAddingPercentEscapes(appName),
encodeByAddingPercentEscapes([url absoluteString])];
if (callbackURL) {
[chromeURLString appendFormat:@"&x-success=%@",
encodeByAddingPercentEscapes([callbackURL absoluteString])];
}
if (createNewTab) {
[chromeURLString appendString:@"&create-new-tab"];
}
NSURL *chromeURL = [NSURL URLWithString:chromeURLString];
// Open the URL with Google Chrome.
return [[UIApplication sharedApplication] openURL:chromeURL];
}
} else if ([[UIApplication sharedApplication] canOpenURL:chromeSimpleURL]) {
NSString *scheme = [url.scheme lowercaseString];
// Replace the URL Scheme with the Chrome equivalent.
NSString *chromeScheme = nil;
if ([scheme isEqualToString:@"http"]) {
chromeScheme = kGoogleChromeHTTPScheme;
} else if ([scheme isEqualToString:@"https"]) {
chromeScheme = kGoogleChromeHTTPSScheme;
}
// Proceed only if a valid Google Chrome URI Scheme is available.
if (chromeScheme) {
NSString *absoluteString = [url absoluteString];
NSRange rangeForScheme = [absoluteString rangeOfString:@":"];
NSString *urlNoScheme =
[absoluteString substringFromIndex:rangeForScheme.location + 1];
NSString *chromeURLString =
[chromeScheme stringByAppendingString:urlNoScheme];
NSURL *chromeURL = [NSURL URLWithString:chromeURLString];
// Open the URL with Google Chrome.
return [[UIApplication sharedApplication] openURL:chromeURL];
}
}
return NO;
}
@end

View File

@ -1,6 +1,7 @@
This Google+ iOS SDK allows users to sign in with Google+, share with Google+,
and write moments to Google+ history from third-party apps. The SDK contains the
following files:
This Google+ iOS SDK allows users to sign in and share with Google+ from
third-party apps. The SDK also provides Google+ APIs for the app to access
the list of people in user-selected circles and to read and write user's app
activities. The SDK contains the following files:
README -- This file.
@ -22,19 +23,11 @@ OpenSource/ -- Google open source files used by the SDK. Add all files in this
Also see comments for the subdirectory below.
GTL/ -- Google open source files only used by the sample app. Include them
into your project if you're going to use the same functionality,
e.g. Add Moments.
e.g. writing user's app activities.
Resources/ -- Resources that can be used in your app.
For |GPPSignInButton|, the google_plus_sign_in*.png images
For |GPPSignInButton|, the gpp_sign_in_*.png images
are required.
google_plus_share.png -- 82x24 Google+ share button image.
google_plus_share_large.png -- 112x32 Google+ share button image.
google_plus_share@2x.png -- 164x48 Google+ share button image.
google_plus_share_large@2x.png -- 224x64 Google+ share button image.
google_plus_sign_in.png -- 120x32 Google+ sign-in button image.
google_plus_sign_in_wide.png --220x32 Wide Google+ sign-in button image.
google_plus_sign_in@2x.png -- 240x64 Google+ sign-in button image.
google_plus_sign_in_wide@2x.png -- 440x64 Wide Google+ sign-in button image.
SampleCode/ -- Sample code for your reference only.
Do not include this in your project.

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Meld aan";
/* Long form sign-in button text */
"Sign in with Google" = "Meld aan met Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "ይግቡ";
/* Long form sign-in button text */
"Sign in with Google" = "በGoogle ይግቡ";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "تسجيل الدخول";
/* Long form sign-in button text */
"Sign in with Google" = "تسجيل الدخول باستخدام Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Увайсцi";
/* Long form sign-in button text */
"Sign in with Google" = "Увайсці ў Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Вход";
/* Long form sign-in button text */
"Sign in with Google" = "Вход с Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "In. sess.";
/* Long form sign-in button text */
"Sign in with Google" = "Inicia la sessió amb Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Přihlásit se";
/* Long form sign-in button text */
"Sign in with Google" = "Přihlásit se k účtu Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Log ind";
/* Long form sign-in button text */
"Sign in with Google" = "Log ind med Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Anmelden";
/* Long form sign-in button text */
"Sign in with Google" = "Über Google anmelden";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Anmelden";
/* Long form sign-in button text */
"Sign in with Google" = "Über Google anmelden";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Anmelden";
/* Long form sign-in button text */
"Sign in with Google" = "Über Google anmelden";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Σύνδεση";
/* Long form sign-in button text */
"Sign in with Google" = "Συνδεθείτε στο Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Sign in with Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Sign in with Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Sign in with Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Sign in with Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Sign in with Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Sign in with Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Iniciar sesión";
/* Long form sign-in button text */
"Sign in with Google" = "Iniciar sesión con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Acceder";
/* Long form sign-in button text */
"Sign in with Google" = "Acceder con Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Logi sisse";
/* Long form sign-in button text */
"Sign in with Google" = "Logi sisse Google'iga";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "ورود به سیستم";
/* Long form sign-in button text */
"Sign in with Google" = "ورود به سیستم با Google";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Kirjaudu";
/* Long form sign-in button text */
"Sign in with Google" = "Kirjaudu Google-tiliin";

View File

@ -0,0 +1,5 @@
/* Sign-in button text */
"Sign in" = "Sign in";
/* Long form sign-in button text */
"Sign in with Google" = "Mag-sign in sa Google";

Some files were not shown because too many files have changed in this diff Show More