UrbanAirshipCore 1.2.2

dotnet add package UrbanAirshipCore --version 1.2.2                
NuGet\Install-Package UrbanAirshipCore -Version 1.2.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UrbanAirshipCore" Version="1.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UrbanAirshipCore --version 1.2.2                
#r "nuget: UrbanAirshipCore, 1.2.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UrbanAirshipCore as a Cake Addin
#addin nuget:?package=UrbanAirshipCore&version=1.2.2

// Install UrbanAirshipCore as a Cake Tool
#tool nuget:?package=UrbanAirshipCore&version=1.2.2                

UrbanAirshipCore

A .NET Core class library for calling the Urban Airship API.

This is based on <a href="https://github.com/JeffGos/urbanairsharp" alt="UrbanAirSharp">UrbanAirSharp</a> but updated to .NET Core framework. I've also added in pipeline methods and additional push options such as in-app messages.

Installation

To use UrbanAirshipCore in your C# project, you can either download the UrbanAirshipCore C# .NET libraries directly from the Github repository or, if you have the NuGet package manager installed, you can grab them automatically.

PM> Install-Package UrbanAirshipCore

Once you have the UrbanAirshipCore libraries properly referenced in your project, you can include calls to them in your code.

Add the following namespaces to use the library:

using UrbanAirshipCore;

Usage

This is intended for usage in .NET Core projects.

<a href="https://docs.urbanairship.com/api/ua/#send-push" alt="Push">Push</a>

            UrbanAirshipCoreClient client = new UrbanAirshipCoreClient("<APP_KEY>", "<APP_MASTER_SECRET>");
            Push push = new Push();

            IosChannelAudience audience = new IosChannelAudience();
            audience.IosChannel = new List<string>() { "9c36e8c7-5a73-47c0-9716-99fd3d4197d5" };

            Notification notification = new Notification();
            notification.Alert = "Hello!";

            push.DeviceTypes = "all";

            push.Audience = audience;
            push.Notification = notification;

            PushResponse pushResponse = client.Push(push);

<a href="https://docs.urbanairship.com/api/ua/#api-in-app-object" alt="Push with in-app">Push with in-app</a>

            UrbanAirshipCoreClient client = new UrbanAirshipCoreClient("<APP_KEY>", "<APP_MASTER_SECRET>");
            Push push = new Push();

            List<DeviceType> deviceTypes = new List<DeviceType>();
            deviceTypes.Add(DeviceType.Ios);
            deviceTypes.Add(DeviceType.Android);

            Notification notification = new Notification();
            notification.Alert = "This part appears on the lockscreen";

            InApp inApp = new InApp();
            inApp.Alert = "This part appears in-app!";
            inApp.DisplayType = DisplayTypeType.Banner;
            inApp.Expiry = DateTime.Parse("2015-04-01T12:00:00");
            inApp.Display = new Display();
            inApp.Display.Position = PositionType.Top;
            inApp.Actions = new Actions();
            inApp.Actions.AddTag = new List<string>() { "in-app" };

            push.DeviceTypes = deviceTypes;
            push.Notification = notification;
            push.InApp = inApp;

            PushResponse pushResponse = client.Push(push);

<a href="https://docs.urbanairship.com/api/ua/#post-api-schedule" alt="Schedule">Schedule</a>

            UrbanAirshipCoreClient client = new UrbanAirshipCoreClient("<APP_KEY>", "<APP_MASTER_SECRET>");
            Schedule schedule = new Schedule();

            schedule.Name = "Booyah Sports";
            schedule.ScheduleInfo = new ScheduleInfo();
            schedule.ScheduleInfo.ScheduleTime = DateTime.Parse("2013-04-01T18:45:00");

            Push push = new Push();

            Audience audience = new Audience(AudienceType.Tag, new List<string>() { "spoaaaarts" });
            Notification notification = new Notification();
            notification.Alert = "Booyah";

            push.Audience = audience;
            push.Notification = notification;

            schedule.Push = push;

            ScheduleCreateResponse scheduleCreateResponse = client.CreateSchedule(schedule);

<a href="https://docs.urbanairship.com/api/ua/#pipelines-api" alt="Pipeline">Pipeline</a>

            UrbanAirshipCoreClient client = new UrbanAirshipCoreClient("<APP_KEY>", "<APP_MASTER_SECRET>");

            Pipeline pipeline = new Pipeline();

            pipeline.Name = "The Darkest Pipeline";
            pipeline.Enabled = true;

            EventIdentifier immediateTrigger = new EventIdentifier();
            immediateTrigger.SimpleFirstOpen = true;
            pipeline.ImmediateTrigger = immediateTrigger;

            Push push = new Push();

            push.Audience = new Audience() { Override = "triggered" };

            List<DeviceType> deviceTypes = new List<DeviceType>();
            deviceTypes.Add(DeviceType.Ios);
            deviceTypes.Add(DeviceType.Android);

            push.DeviceTypes = deviceTypes;

            push.Notification = new Notification() { Alert = "Cool goatee, Abed" };

            pipeline.Outcome = new List<Outcome>() { new Outcome() { Push = push } };

            Timing timing = new Timing();
            timing.Delay = new Delay() { Seconds = 7200 };
            timing.Schedule = new TimingSchedule() { Type = TimingScheduleType.Local, MissBehavior = MissBehaviorType.Wait };
            timing.Schedule = new TimingSchedule() { Type = TimingScheduleType.Local };

            Daypart daypart = new Daypart();
            daypart.DaysOfWeek = new List<DaysOfWeekType>() { DaysOfWeekType.Thursday };
            daypart.AllowedTimes = new List<AllowedTime>() { new AllowedTime() { Preferred = "21:30:00" } };

            timing.Schedule.Dayparts = new List<Daypart>() { daypart };

            pipeline.Timing = timing;

            client.CreatePipeline(pipeline);

<a href="https://docs.urbanairship.com/api/ua/#api-create-template" alt="Create template">Create template</a>

            UrbanAirshipCoreClient client = new UrbanAirshipCoreClient("<APP_KEY>", "<APP_MASTER_SECRET>");

            Template template = new Template();

            template.Name = "Welcome Message";
            template.Description = "Our welcome message";

            template.Variables = new List<TemplateVariable>()
            {
                new TemplateVariable() { Key = "TITLE", Name = "Title", Description = "e.g. Mr, Ms, Dr, etc.", DefaultValue = "" },
                new TemplateVariable() { Key = "FIRST_NAME", Name = "First Name", Description = "e.g. Mr, Ms, Dr, etc.", DefaultValue = "" },
                new TemplateVariable() { Key = "LAST_NAME", Name = "Last Name", Description = "Family name", DefaultValue = null }
            };

            template.Push = new TemplatePush()
            {
                Notification = new Notification()
                {
                    Alert = "Hello {{FIRST_NAME}}, this is your welcome message!"
                }
            };

            client.CreateTemplate(template);

<a href="https://docs.urbanairship.com/api/ua/#api-template-push" alt="Push to template">Push to template</a>

            UrbanAirshipCoreClient client = new UrbanAirshipCoreClient("<APP_KEY>", "<APP_MASTER_SECRET>");

            PushTemplate pushTemplate = new PushTemplate()
            {
                Audience = new Audience(AudienceType.Ios, new List<string>() { "b8f9b663-0a3b-cf45-587a-be880946e881" }),
                MergeData = new TemplateSelector()
                {
                    TemplateId = "ef34a8d9-0ad7-491c-86b0-aea74da15161",
                    Substitutions = new Dictionary<string, string>()
                    {
                        { "FIRST_NAME", "Bob" },
                        { "LAST_NAME", "Smith" },
                        { "TITLE", "" }
                    }
                }
            };

            client.PushTemplate(pushTemplate);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.2 7,757 11/2/2017

Updated guids in response to be strings.