Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Packages/Audience/Runtime/AudienceConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Immutable.Audience
{
/// <summary>Configuration passed to <see cref="ImmutableAudience.Init"/>.</summary>
public class AudienceConfig
{
public string PublishableKey { get; set; }
public ConsentLevel Consent { get; set; } = ConsentLevel.None;
/// <summary>
/// Distribution platform the game is running on.
/// Use <see cref="DistributionPlatforms"/> for common values, or pass any custom string.
/// </summary>
public string DistributionPlatform { get; set; }
public bool Debug { get; set; } = false;
public int FlushIntervalSeconds { get; set; } = Constants.DefaultFlushIntervalSeconds;
public int FlushSize { get; set; } = Constants.DefaultFlushSize;
}
}
11 changes: 11 additions & 0 deletions src/Packages/Audience/Runtime/AudienceConfig.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions src/Packages/Audience/Runtime/AudienceError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace Immutable.Audience
{
public enum AudienceErrorCode
{
FlushFailed,
ValidationRejected,
ConsentSyncFailed,
NetworkError
}

public class AudienceError : Exception
{
public AudienceErrorCode Code { get; }

public AudienceError(AudienceErrorCode code, string message)
: base(message)
{
Code = code;
}
}
}
11 changes: 11 additions & 0 deletions src/Packages/Audience/Runtime/AudienceError.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/Packages/Audience/Runtime/ConsentLevel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Immutable.Audience
{
/// <summary>Controls what the Audience SDK tracks.</summary>
public enum ConsentLevel
{
/// <summary>SDK inert. No events queued or sent. No IDs persisted to disk.</summary>
None,
/// <summary>Track events with anonymousId only. Identify/Alias discarded with warning.</summary>
Anonymous,
/// <summary>All events. Identify/Alias send. userId attached to track events.</summary>
Full
}
}
11 changes: 11 additions & 0 deletions src/Packages/Audience/Runtime/ConsentLevel.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/Packages/Audience/Runtime/Core.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions src/Packages/Audience/Runtime/Core/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace Immutable.Audience
{
internal static class Constants
{
internal const string TestKeyPrefix = "pk_imapik-test-";
internal const string SandboxBaseUrl = "https://api.sandbox.immutable.com";
internal const string ProductionBaseUrl = "https://api.immutable.com";

internal const string MessagesPath = "/v1/audience/messages";
internal const string ConsentPath = "/v1/audience/tracking-consent";
internal const string DataPath = "/v1/audience/data";

internal const int DefaultFlushIntervalSeconds = 5;
internal const int DefaultFlushSize = 20;
internal const int MaxBatchSize = 100;
internal const int StaleEventDays = 30;

internal const string LibraryName = "com.immutable.audience";
internal const string Surface = "unity";
internal const string ConsentSource = "UnitySDK";

internal static string BaseUrl(string publishableKey) =>
publishableKey != null && publishableKey.StartsWith(TestKeyPrefix)
? SandboxBaseUrl
: ProductionBaseUrl;
}

/// <summary>
/// String constants for common game distribution platforms.
/// Any string is accepted -- studios are not limited to these values.
/// </summary>
public static class DistributionPlatforms
{
public const string Steam = "steam";
public const string Epic = "epic";
public const string GOG = "gog";
public const string Itch = "itch";
public const string Standalone = "standalone";
}
}
11 changes: 11 additions & 0 deletions src/Packages/Audience/Runtime/Core/Constants.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions src/Packages/Audience/Runtime/ImmutableAudience.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ namespace Immutable.Audience
{
/// <summary>
/// Entry point for the Immutable Audience SDK.
/// Call Init once on startup, then use the static methods from any thread.
/// Call <see cref="Init"/> once on startup, then use the static methods from any thread.
/// </summary>
public static class ImmutableAudience
{
// Core types (AudienceConfig, ConsentLevel, AudienceError) and Init
// are added in the next PR once those types exist. See SDK-119.
// Scaffold only -- implementation follows in subsequent sub-issues (see SDK-99).

/// <summary>Initialise the SDK. Call once, typically in your game's entry scene.</summary>
public static void Init(AudienceConfig config)
{
throw new System.NotImplementedException(
"Immutable Audience SDK: implementation pending. See SDK-99.");
}
}
}
2 changes: 1 addition & 1 deletion src/Packages/Audience/Runtime/ImmutableAudience.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading