Skip to content

Commit

Permalink
DXOC-661 Updated Objective-C/Swift codegen (#210)
Browse files Browse the repository at this point in the history
* DXOC-661 Updated Objective-C/Swift codegen

* DXOC-661 Update Objective-C/Swift examples

* DXOC_661 Updated Objective-C codegen

* DXOC-652 update iOS ObjC tests to check optional properties are undefined in event payload

---------

Co-authored-by: Justin Fiedler <[email protected]>
  • Loading branch information
falconandy and justin-fiedler authored Mar 20, 2023
1 parent 085e473 commit 7848ab3
Show file tree
Hide file tree
Showing 9 changed files with 470 additions and 430 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This file is generated by Amplitude.
* To update run 'ampli pull obj-c-ampli'
*
* Required dependencies: Amplitude-iOS^8.10.0
* Required dependencies: Amplitude ~> 8.10
* Tracking Plan Version: 0
* Build: 1.0.0
* Runtime: ios:obj-c-ampli
Expand All @@ -21,8 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
typedef NSMutableDictionary<NSString *, id> MiddlewareExtra;

typedef NS_ENUM(NSInteger, AmpliEnvironment) {
dev,
prod
prod,
dev
};

@interface Event: NSObject
Expand Down Expand Up @@ -75,22 +75,6 @@ typedef NS_ENUM(NSInteger, AmpliEnvironment) {
+ (instancetype)new NS_UNAVAILABLE;
@end

#pragma mark - EventMaxIntForTest

@interface EventMaxIntForTest: Event
/**
Event to test schema validation
Owner: Test codegen
@param intMax10 property to test schema validation
*/
+ (instancetype) intMax10:(NSInteger)intMax10 NS_SWIFT_NAME(build(intMax10:));

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

#pragma mark - EventNoProperties

@interface EventNoProperties: Event
Expand Down Expand Up @@ -163,11 +147,12 @@ typedef NS_ENUM(NSInteger, EventWithAllPropertiesRequiredEnum) {
Owner: Test codegen
@param requiredBooleanArray description for required boolean array
@param requiredEnumArray Description for enum array property
@param requiredNumberArray Description for required number array
@param requiredObjectArray Description for required object array
@param requiredStringArray description for required string array
*/
+ (instancetype) requiredBooleanArray:(NSArray<NSNumber *> *)requiredBooleanArray requiredNumberArray:(NSArray<NSNumber *> *)requiredNumberArray requiredObjectArray:(NSArray<NSDictionary<NSString *, NSObject *> *> *)requiredObjectArray requiredStringArray:(NSArray<NSString *> *)requiredStringArray NS_SWIFT_NAME(build(requiredBooleanArray:requiredNumberArray:requiredObjectArray:requiredStringArray:));
+ (instancetype) requiredBooleanArray:(NSArray<NSNumber *> *)requiredBooleanArray requiredEnumArray:(NSArray<NSString *> *)requiredEnumArray requiredNumberArray:(NSArray<NSNumber *> *)requiredNumberArray requiredObjectArray:(NSArray<NSDictionary<NSString *, NSObject *> *> *)requiredObjectArray requiredStringArray:(NSArray<NSString *> *)requiredStringArray NS_SWIFT_NAME(build(requiredBooleanArray:requiredEnumArray:requiredNumberArray:requiredObjectArray:requiredStringArray:));

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
Expand All @@ -184,47 +169,6 @@ typedef NS_ENUM(NSInteger, EventWithAllPropertiesRequiredEnum) {
- (instancetype)init;
@end

#pragma mark - EventWithDifferentCasingTypes Enums

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumCamelCase) {
EventWithDifferentCasingTypesEnumCamelCaseEnumCamelCase
};

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumPascalCase) {
EventWithDifferentCasingTypesEnumPascalCaseEnumPascalCase
};

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumSnakeCase) {
EventWithDifferentCasingTypesEnumSnakeCaseEnumSnakeCase
};

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumWithSpace) {
EventWithDifferentCasingTypesEnumWithSpaceEnumWithSpace
};

#pragma mark - EventWithDifferentCasingTypes

@interface EventWithDifferentCasingTypes: Event
/**
Description for case with space
Owner: Test codegen
@param enumCamelCase descriptionForEnumCamelCase
@param enumPascalCase DescirptionForEnumPascalCase
@param enumSnakeCase description_for_enum_snake_case
@param enumWithSpace Description for enum with space
@param propertyWithCamelCase descriptionForCamelCase
@param propertyWithPascalCase DescriptionForPascalCase
@param propertyWithSnakeCase Description_for_snake_case
@param propertyWithSpace Description for case with space
*/
+ (instancetype) enumCamelCase:(EventWithDifferentCasingTypesEnumCamelCase)enumCamelCase enumPascalCase:(EventWithDifferentCasingTypesEnumPascalCase)enumPascalCase enumSnakeCase:(EventWithDifferentCasingTypesEnumSnakeCase)enumSnakeCase enumWithSpace:(EventWithDifferentCasingTypesEnumWithSpace)enumWithSpace propertyWithCamelCase:(NSString*)propertyWithCamelCase propertyWithPascalCase:(NSString*)propertyWithPascalCase propertyWithSnakeCase:(NSString*)propertyWithSnakeCase propertyWithSpace:(NSString*)propertyWithSpace NS_SWIFT_NAME(build(enumCamelCase:enumPascalCase:enumSnakeCase:enumWithSpace:propertyWithCamelCase:propertyWithPascalCase:propertyWithSnakeCase:propertyWithSpace:));

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

#pragma mark - EventWithEnumTypes Enums

typedef NS_ENUM(NSInteger, EventWithEnumTypesOptionalEnum) {
Expand Down Expand Up @@ -265,6 +209,7 @@ typedef NS_ENUM(NSInteger, EventWithEnumTypesRequiredEnum) {

@interface EventWithOptionalArrayTypesBuilder: NSObject
@property (nonatomic) NSArray<NSNumber *> * _Nullable optionalBooleanArray;
@property (nonatomic) NSArray<NSString *> * _Nullable optionalEnumArray;
@property (nonatomic) NSArray<NSDictionary<NSString *, NSObject *> *> * _Nullable optionalJsonArray;
@property (nonatomic) NSArray<NSNumber *> * _Nullable optionalNumberArray;
@property (nonatomic) NSArray<NSString *> * _Nullable optionalStringArray;
Expand Down Expand Up @@ -331,6 +276,63 @@ typedef NS_ENUM(NSInteger, EventWithEnumTypesRequiredEnum) {
+ (instancetype)new NS_UNAVAILABLE;
@end

#pragma mark - EventWithDifferentCasingTypes Enums

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumWithSpace) {
EventWithDifferentCasingTypesEnumWithSpaceEnumWithSpace
};

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumSnakeCase) {
EventWithDifferentCasingTypesEnumSnakeCaseEnumSnakeCase
};

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumCamelCase) {
EventWithDifferentCasingTypesEnumCamelCaseEnumCamelCase
};

typedef NS_ENUM(NSInteger, EventWithDifferentCasingTypesEnumPascalCase) {
EventWithDifferentCasingTypesEnumPascalCaseEnumPascalCase
};

#pragma mark - EventWithDifferentCasingTypes

@interface EventWithDifferentCasingTypes: Event
/**
Description for case with space
Owner: Test codegen
@param enumWithSpace Description for enum with space
@param enumSnakeCase description_for_enum_snake_case
@param enumCamelCase descriptionForEnumCamelCase
@param enumPascalCase DescirptionForEnumPascalCase
@param propertyWithSpace Description for case with space
@param propertyWithSnakeCase Description_for_snake_case
@param propertyWithCamelCase descriptionForCamelCase
@param propertyWithPascalCase DescriptionForPascalCase
*/
+ (instancetype) enumWithSpace:(EventWithDifferentCasingTypesEnumWithSpace)enumWithSpace enumSnakeCase:(EventWithDifferentCasingTypesEnumSnakeCase)enumSnakeCase enumCamelCase:(EventWithDifferentCasingTypesEnumCamelCase)enumCamelCase enumPascalCase:(EventWithDifferentCasingTypesEnumPascalCase)enumPascalCase propertyWithSpace:(NSString*)propertyWithSpace propertyWithSnakeCase:(NSString*)propertyWithSnakeCase propertyWithCamelCase:(NSString*)propertyWithCamelCase propertyWithPascalCase:(NSString*)propertyWithPascalCase NS_SWIFT_NAME(build(enumWithSpace:enumSnakeCase:enumCamelCase:enumPascalCase:propertyWithSpace:propertyWithSnakeCase:propertyWithCamelCase:propertyWithPascalCase:));

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

#pragma mark - EventMaxIntForTest

@interface EventMaxIntForTest: Event
/**
Event to test schema validation
Owner: Test codegen
@param intMax10 property to test schema validation
*/
+ (instancetype) intMax10:(NSInteger)intMax10 NS_SWIFT_NAME(build(intMax10:));

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@class EventOptionsBuilder;

@interface EventOptions : NSObject
Expand Down Expand Up @@ -363,48 +365,6 @@ typedef NS_ENUM(NSInteger, EventWithEnumTypesRequiredEnum) {
- (void)identify:(NSString *_Nullable)userId event:(Identify *)event extra:(MiddlewareExtra *_Nullable)extra;
- (void)identify:(NSString *_Nullable)userId event:(Identify *)event options:(EventOptions *_Nullable)options extra:(MiddlewareExtra *_Nullable)extra;
- (void)flush;
/**
EventMaxIntForTest
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest)
Event to test schema validation
Owner: Test codegen
@param event The event
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventMaxIntForTest:(EventMaxIntForTest *)event extra:(MiddlewareExtra *_Nullable)extra;

/**
EventMaxIntForTest
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest)
Event to test schema validation
Owner: Test codegen
@param event The event
@param options Optional EventOptions
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventMaxIntForTest:(EventMaxIntForTest *)event options:(EventOptions *_Nullable)options extra:(MiddlewareExtra *_Nullable)extra;

/**
EventMaxIntForTest
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest)
Event to test schema validation
Owner: Test codegen
@param event The event
*/
- (void)eventMaxIntForTest:(EventMaxIntForTest *)event;

/**
Event No Properties
Expand Down Expand Up @@ -609,48 +569,6 @@ Owner: Test codegen
*/
- (void)eventWithConstTypes;

/**
event withDifferent_CasingTypes
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes)
Description for case with space
Owner: Test codegen
@param event The event
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event extra:(MiddlewareExtra *_Nullable)extra;

/**
event withDifferent_CasingTypes
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes)
Description for case with space
Owner: Test codegen
@param event The event
@param options Optional EventOptions
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event options:(EventOptions *_Nullable)options extra:(MiddlewareExtra *_Nullable)extra;

/**
event withDifferent_CasingTypes
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes)
Description for case with space
Owner: Test codegen
@param event The event
*/
- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event;

/**
Event With Enum Types
Expand Down Expand Up @@ -818,6 +736,90 @@ Owner: Test codegen
@param event The event
*/
- (void)eventWithTemplateProperties:(EventWithTemplateProperties *)event;

/**
event withDifferent_CasingTypes
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes)
Description for case with space
Owner: Test codegen
@param event The event
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event extra:(MiddlewareExtra *_Nullable)extra;

/**
event withDifferent_CasingTypes
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes)
Description for case with space
Owner: Test codegen
@param event The event
@param options Optional EventOptions
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event options:(EventOptions *_Nullable)options extra:(MiddlewareExtra *_Nullable)extra;

/**
event withDifferent_CasingTypes
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/event%20withDifferent_CasingTypes)
Description for case with space
Owner: Test codegen
@param event The event
*/
- (void)eventWithDifferentCasingTypes:(EventWithDifferentCasingTypes *)event;

/**
EventMaxIntForTest
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest)
Event to test schema validation
Owner: Test codegen
@param event The event
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventMaxIntForTest:(EventMaxIntForTest *)event extra:(MiddlewareExtra *_Nullable)extra;

/**
EventMaxIntForTest
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest)
Event to test schema validation
Owner: Test codegen
@param event The event
@param options Optional EventOptions
@param extra Extra untyped parameters for use in middleware.
*/
- (void)eventMaxIntForTest:(EventMaxIntForTest *)event options:(EventOptions *_Nullable)options extra:(MiddlewareExtra *_Nullable)extra;

/**
EventMaxIntForTest
[View in Tracking Plan](https://data.amplitude.com/test-codegen/Test%20Codegen/events/main/latest/EventMaxIntForTest)
Event to test schema validation
Owner: Test codegen
@param event The event
*/
- (void)eventMaxIntForTest:(EventMaxIntForTest *)event;
@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 7848ab3

Please sign in to comment.