public async Task RunAsync(string[] args)
        {
            Console.WriteLine("Async app");
            this.logger.LogInformation("Starting ...");

            var targetClientConfig = new TargetClientConfig.Builder("adobetargetmobile", "B8A054D958807F770A495DD6@AdobeOrg")
                                     .SetLogger(this.logger)
                                     .Build();

            this.targetClient.Initialize(targetClientConfig);

            var deliveryRequest = new TargetDeliveryRequest.Builder()
                                  .SetThirdPartyId("testThirdPartyId")
                                  .SetContext(new Context(ChannelType.Web))
                                  .SetExecute(new ExecuteRequest(null, new List <MboxRequest>
            {
                new MboxRequest(index: 1, name: "a1-serverside-ab")
            }))
                                  .Build();

            var response = await this.targetClient.GetOffersAsync(deliveryRequest);

            App.PrintCookies(this.logger, response);

            var notificationRequest = new TargetDeliveryRequest.Builder()
                                      .SetSessionId(response.Request.SessionId)
                                      .SetTntId(response.Response?.Id?.TntId)
                                      .SetThirdPartyId("testThirdPartyId")
                                      .SetContext(new Context(ChannelType.Web))
                                      .SetNotifications(new List <Notification>()
            {
                { new(id: "notificationId1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                      tokens: new List <string>()) }
            })
Exemple #2
0
        public async Task RunAsync(string[] args)
        {
            Console.WriteLine("Async app");

            // Initialize the SDK

            var targetClientConfig = new TargetClientConfig.Builder("adobetargetmobile", "B8A054D958807F770A495DD6@AdobeOrg")
                                     .SetLogger(this.logger)
                                     .SetDecisioningMethod(DecisioningMethod.OnDevice)
                                     .SetOnDeviceDecisioningReady(this.DecisioningReady)
                                     .SetArtifactDownloadSucceeded(artifact => Console.WriteLine("ArtifactDownloadSucceeded: " + artifact))
                                     .SetArtifactDownloadFailed(exception => Console.WriteLine("ArtifactDownloadFailed " + exception.Message))
                                     .Build();

            this.targetClient.Initialize(targetClientConfig);

            // sample server-side GetOffers call

            var deliveryRequest = new TargetDeliveryRequest.Builder()
                                  .SetDecisioningMethod(DecisioningMethod.ServerSide)
                                  .SetThirdPartyId("testThirdPartyId")
                                  .SetContext(new Context(ChannelType.Web))
                                  .SetExecute(new ExecuteRequest(null, new List <MboxRequest>
            {
                new MboxRequest(index: 1, name: "a1-serverside-ab")
            }))
                                  .Build();

            var response = await this.targetClient.GetOffersAsync(deliveryRequest);

            App.PrintCookies(this.logger, response);

            // sample SendNotifications call

            var notificationRequest = new TargetDeliveryRequest.Builder()
                                      .SetDecisioningMethod(DecisioningMethod.ServerSide)
                                      .SetSessionId(response.Request.SessionId)
                                      .SetTntId(response.Response?.Id?.TntId)
                                      .SetThirdPartyId("testThirdPartyId")
                                      .SetContext(new Context(ChannelType.Web))
                                      .SetNotifications(new List <Notification>()
            {
                { new(id: "notificationId1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                      tokens: new List <string>()) }
            })