Skip to content

Commit

Permalink
DXOC-831 Updated codegen with '$identify' event type
Browse files Browse the repository at this point in the history
  • Loading branch information
falconandy committed May 14, 2023
1 parent 3b643ec commit 3984120
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class Identify extends Event {
private Identify(Builder builder) {
super("$identify", builder.properties);
super(com.amplitude.api.Constants.IDENTIFY_EVENT, builder.properties);
}

public static IRequiredNumber builder() { return new Builder(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public class Identify extends BaseEvent {
private Identify(Builder builder) {
eventType = "$identify";
eventType = com.amplitude.core.Constants.IDENTIFY_EVENT;
setEventProperties(builder.properties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.json.JSONObject

import com.amplitude.api.Amplitude
import com.amplitude.api.AmplitudeClient
import com.amplitude.api.Constants
import com.amplitude.api.MiddlewareExtra
import com.amplitude.api.Plan

Expand Down Expand Up @@ -63,7 +64,7 @@ class LoadClientOptions(
class Identify private constructor(
eventProperties: Map<String, Any?>?,
options: EventOptions? = null
) : Event<Identify>("Identify", eventProperties, options, ::Identify) {
) : Event<Identify>(Constants.IDENTIFY_EVENT, eventProperties, options, ::Identify) {
/**
* Identify
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import com.amplitude.android.Configuration
import com.amplitude.android.events.BaseEvent
import com.amplitude.android.events.EventOptions
import com.amplitude.android.events.Plan
import com.amplitude.core.Constants
import com.amplitude.core.platform.Plugin

enum class EventType(val value: String) {
Identify("\$identify"),
GroupIdentify("\$groupidentify"),
Identify(Constants.IDENTIFY_EVENT),
GroupIdentify(Constants.GROUP_IDENTIFY_EVENT),
}

class LoadOptions(
Expand Down
6 changes: 3 additions & 3 deletions browser/javascript/v1/react-app/src/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export const ApiKey = {
*/

export const SpecialEventType = {
Identify: "Identify",
Group: "Group"
Identify: "$identify",
Group: "$groupidentify"
}

/**
Expand All @@ -144,7 +144,7 @@ export const DefaultOptions = {

export class Identify {
constructor(properties) {
this.event_type = 'Identify';
this.event_type = SpecialEventType.Identify;
this.event_properties = properties;
}
}
Expand Down
2 changes: 1 addition & 1 deletion browser/javascript/v2/ember-app/app/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const DefaultConfiguration = {

export class Identify {
constructor(properties) {
this.event_type = 'Identify';
this.event_type = amplitude.Types.SpecialEventType.IDENTIFY;
this.event_properties = properties;
}
}
Expand Down
2 changes: 1 addition & 1 deletion browser/javascript/v2/react-app/src/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const DefaultConfiguration = {

export class Identify {
constructor(properties) {
this.event_type = 'Identify';
this.event_type = amplitude.Types.SpecialEventType.IDENTIFY;
this.event_properties = properties;
}
}
Expand Down
6 changes: 3 additions & 3 deletions browser/typescript/v1/react-app/src/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements BaseEvent {
event_type = 'Identify';
event_type = SpecialEventType.Identify;

constructor(
public event_properties: IdentifyProperties,
Expand Down Expand Up @@ -906,8 +906,8 @@ export type Plan = {
}

export enum SpecialEventType {
Identify = "Identify",
Group = "Group"
Identify = "$identify",
Group = "$groupidentify"
}

export type BaseEvent = {
Expand Down
2 changes: 1 addition & 1 deletion browser/typescript/v2/react-app/src/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements BaseEvent {
event_type = 'Identify';
event_type = amplitude.Types.SpecialEventType.IDENTIFY;

constructor(
public event_properties: IdentifyProperties,
Expand Down
2 changes: 1 addition & 1 deletion go/simple/v2/ampli/ampli.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (b *identifyBuilder) OptionalArray(optionalArray []string) IdentifyBuilder

func (b *identifyBuilder) Build() IdentifyEvent {
return &identifyEvent{
newBaseEvent(`Identify`, b.properties),
newBaseEvent(IdentifyEventType, b.properties),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ + (instancetype)requiredNumber:(Float64)requiredNumber builderBlock:(void (^)(Id

- (instancetype)initWithRequiredNumber_Identify:(Float64)requiredNumber
optionalArray:(NSArray<NSString *> * _Nullable)optionalArray {
self = [super initWithEventType:@"Identify"
self = [super initWithEventType:IDENTIFY_EVENT
withEventProperties:@{
@"optionalArray": optionalArray ?: NSNull.null,
@"requiredNumber": @(requiredNumber)
Expand Down
2 changes: 1 addition & 1 deletion ios/swift/AmpliSwiftSampleApp/Shared/Ampli/Ampli.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class Identify : GenericEvent<Identify> {

private init(_ eventProperties: [String: Any?]?, _ options: EventOptions? = nil) {
super.init(
eventType: "Identify",
eventType: Constants.IDENTIFY_EVENT,
eventProperties: eventProperties,
options: options,
eventFactory: Identify.init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LoadClientOptions(
class Identify private constructor(
eventProperties: Map<String, Any?>?,
options: EventOptions? = null
) : Event<Identify>("Identify", eventProperties, options, ::Identify) {
) : Event<Identify>("\$identify", eventProperties, options, ::Identify) {
/**
* Identify
*
Expand Down
2 changes: 1 addition & 1 deletion jre/kotlin/AmpliApp/src/test/kotlin/AmpliTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class AmpliTest {
verify(client, times(1)).logEvent(eventCaptor.capture(), extraCaptor.capture())

val event = eventCaptor.value
assertEquals("Identify", event.eventType)
assertEquals("\$identify", event.eventType)
assertEquals(userId, event.userId)
assertEquals(deviceId, event.deviceId)
assertEquals(
Expand Down
1 change: 1 addition & 0 deletions node/javascript/v1/AmpliApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dependencies": {
"@amplitude/identify": "1.10.0",
"@amplitude/node": "1.10.2",
"@amplitude/types": "1.10.2",
"@itly/plugin-segment-node": "^2.3.4",
"@itly/sdk": "^2.3.4",
"@types/analytics-node": "^3.1.6",
Expand Down
3 changes: 2 additions & 1 deletion node/javascript/v1/AmpliApp/src/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const { Identify: AmplitudeIdentify, IdentifyEvent } = require('@amplitude/identify');
const { init: initNodeClient, NodeClient, Status, Options } = require('@amplitude/node');
const { SpecialEventType } = require('@amplitude/types');

/**
* @typedef {Object} BaseEvent
Expand Down Expand Up @@ -104,7 +105,7 @@ const DefaultOptions = {

class Identify {
constructor(properties) {
this.event_type = 'Identify';
this.event_type = SpecialEventType.IDENTIFY;
this.event_properties = properties;
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/javascript/v2/AmpliApp/src/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const DefaultConfiguration = {

class Identify {
constructor(properties) {
this.event_type = 'Identify';
this.event_type = amplitude.Types.SpecialEventType.IDENTIFY;
this.event_properties = properties;
}
}
Expand Down
4 changes: 2 additions & 2 deletions node/nextjs/ampli-app/lib/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { Identify as AmplitudeIdentify } from '@amplitude/identify';
import { init as initNodeClient, NodeClient, Response, Status } from '@amplitude/node';
import {
BaseEvent, Event, EventOptions, GroupOptions, IdentifyEvent, IdentifyOptions, Options, MiddlewareExtra,
BaseEvent, Event, EventOptions, GroupOptions, IdentifyEvent, IdentifyOptions, Options, MiddlewareExtra, SpecialEventType,
} from '@amplitude/types';

export type Environment = 'prod' | 'dev';
Expand Down Expand Up @@ -380,7 +380,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements BaseEvent {
event_type = 'Identify';
event_type = SpecialEventType.IDENTIFY;

constructor(
public event_properties: IdentifyProperties,
Expand Down
4 changes: 2 additions & 2 deletions node/typescript/v1/AmpliApp/src/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { Identify as AmplitudeIdentify } from '@amplitude/identify';
import { init as initNodeClient, NodeClient, Response, Status } from '@amplitude/node';
import {
BaseEvent, Event, EventOptions, GroupOptions, IdentifyEvent, IdentifyOptions, Options, MiddlewareExtra,
BaseEvent, Event, EventOptions, GroupOptions, IdentifyEvent, IdentifyOptions, Options, MiddlewareExtra, SpecialEventType,
} from '@amplitude/types';

export type Environment = 'prod' | 'dev';
Expand Down Expand Up @@ -380,7 +380,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements BaseEvent {
event_type = 'Identify';
event_type = SpecialEventType.IDENTIFY;

constructor(
public event_properties: IdentifyProperties,
Expand Down
2 changes: 1 addition & 1 deletion node/typescript/v2/AmpliApp/src/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements BaseEvent {
event_type = 'Identify';
event_type = amplitude.Types.SpecialEventType.IDENTIFY;

constructor(
public event_properties: IdentifyProperties,
Expand Down
3 changes: 2 additions & 1 deletion react-native/javascript/v1/AmpliApp/src/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Identify as AmplitudeIdentify,
MiddlewareExtra,
Plan,
SpecialEventType,
} from '@amplitude/react-native';

/**
Expand Down Expand Up @@ -97,7 +98,7 @@ export const DefaultOptions = {

export class Identify {
constructor(properties) {
this.eventType = 'Identify';
this.eventType = SpecialEventType.IDENTIFY;
this.eventProperties = properties;
}
}
Expand Down
2 changes: 1 addition & 1 deletion react-native/javascript/v2/AmpliApp/src/ampli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const DefaultConfiguration = {

export class Identify {
constructor(properties) {
this.event_type = 'Identify';
this.event_type = amplitude.Types.SpecialEventType.IDENTIFY;
this.event_properties = properties;
}
}
Expand Down
3 changes: 2 additions & 1 deletion react-native/typescript/v1/AmpliApp/src/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
BaseEvent as Event,
MiddlewareExtra,
Plan,
SpecialEventType,
} from '@amplitude/react-native';

export type EventOptions = {
Expand Down Expand Up @@ -389,7 +390,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements Event {
eventType = 'Identify';
eventType = SpecialEventType.IDENTIFY;

constructor(
public eventProperties: IdentifyProperties,
Expand Down
2 changes: 1 addition & 1 deletion react-native/typescript/v2/AmpliApp/src/ampli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export interface SourceTemplateProperties {
}

export class Identify implements BaseEvent {
event_type = 'Identify';
event_type = amplitude.Types.SpecialEventType.IDENTIFY;

constructor(
public event_properties: IdentifyProperties,
Expand Down

0 comments on commit 3984120

Please sign in to comment.