示例#1
0
        private const int CONTENT_ID = 0; // TODO: Fill in with an existing contact ID

        #endregion Fields

        #region Methods

        static void ContactDeleteExample(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Id = CONTENT_ID
            };

            contentRepo.Delete(content);
            Console.WriteLine("Content deleted successfully");
        }
示例#2
0
        private const int ACCOUNT_ID = 0; // TODO: Fill in with your account ID

        #endregion Fields

        #region Methods

        private static Campaign CampaignSetup(T70Context context)
        {
            /*
             * NOTE: A campaign only needs to be setup once.
             *
             * After the initial setup you can send that campaign as many times as you would like.
             */
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name = "SDK Test Content",
            };

            contentRepo.Add(content);

            var templateRepo = context.Repository<ContentTemplate>(new { AccountId = ACCOUNT_ID, ContentId = content.Id });

            var template = new ContentTemplate
            {
                LanguageType = LanguageType.English,
                ChannelType = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template = "Hi there from our demo!"
            };

            templateRepo.Add(template);

            var campaign = new Campaign
            {
                Name = "SDK Test Campaign",
                SubscriptionId = 183,
                CampaignType = CampaignType.Basic,
                ContentId = content.Id
            };

            var campaignRepo = context.Repository<Campaign>(new { AccountId = ACCOUNT_ID });

            campaignRepo.Add(campaign);

            return campaign;
        }
示例#3
0
        private static Content CreateContent(T70Context context)
        {
            /*
             * Content provides a grouping mechanism that can be used to
             * hold multiple translations for a single campaign.
             */
            var contentRepo = context.Repository<Content>(new {AccountId = ACCOUNT_ID});

            var content = new Content
            {
                Name = "SDK Test Content",
            };

            contentRepo.Add(content);

            var templateRepo = context.Repository<ContentTemplate>(new {AccountId = ACCOUNT_ID, ContentId = content.Id});

            var template = new ContentTemplate
            {
                LanguageType = LanguageType.English,
                ChannelType = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template = "Hi there from our demo!"
            };

            templateRepo.Add(template);

            // Also provide a French translation (not required)
            template = new ContentTemplate
            {
                LanguageType = LanguageType.French,
                ChannelType = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template = "Bonjour!"
            };

            templateRepo.Add(template);

            return content;
        }
示例#4
0
        static void ContentUpdate(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Id = CONTENT_ID,
                Name = "SDK_Test_Content3",
                Description = "Content 3 for test .net SDK."
            };

            contentRepo.Update(content);
            var updateContent = contentRepo.Get(CONTENT_ID);

            Console.WriteLine("Id: {0}", updateContent.Id);
            Console.WriteLine("AccountId: {0}", updateContent.AccountId);
            Console.WriteLine("Name: {0}", updateContent.Name);
            Console.WriteLine("Description: {0}", updateContent.Description);
            Console.WriteLine("Created: {0}", updateContent.Created);
            Console.WriteLine("Modified: {0}", updateContent.Modified);
            Console.WriteLine();
            Console.WriteLine("Content updated successfully");
        }
示例#5
0
        static void CreateContent(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name = "SDK_Test_Content190",
                Description = "Content 190 for test .net SDK by Ravi"
            };

            contentRepo.Add(content);
            Console.WriteLine("Added content {0}: {1}", content.Id, content.Name);
        }