Beispiel #1
0
 /// <summary>Snippet for GetCampaign</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCampaignResourceNames()
 {
     // Create client
     CampaignServiceClient campaignServiceClient = CampaignServiceClient.Create();
     // Initialize request argument(s)
     CampaignName resourceName = CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]");
     // Make the request
     Campaign response = campaignServiceClient.GetCampaign(resourceName);
 }
        /// <summary>Snippet for GetCampaignAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetCampaignResourceNamesAsync()
        {
            // Create client
            CampaignServiceClient campaignServiceClient = await CampaignServiceClient.CreateAsync();

            // Initialize request argument(s)
            CampaignName resourceName = CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]");
            // Make the request
            Campaign response = await campaignServiceClient.GetCampaignAsync(resourceName);
        }
Beispiel #3
0
 /// <summary>Snippet for GetCampaign</summary>
 public void GetCampaignResourceNames()
 {
     // Snippet: GetCampaign(CampaignName, CallSettings)
     // Create client
     CampaignServiceClient campaignServiceClient = CampaignServiceClient.Create();
     // Initialize request argument(s)
     CampaignName resourceName = CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]");
     // Make the request
     Campaign response = campaignServiceClient.GetCampaign(resourceName);
     // End snippet
 }
 /// <summary>Snippet for GetCampaign</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCampaignRequestObject()
 {
     // Create client
     CampaignServiceClient campaignServiceClient = CampaignServiceClient.Create();
     // Initialize request argument(s)
     GetCampaignRequest request = new GetCampaignRequest
     {
         ResourceNameAsCampaignName = CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
     };
     // Make the request
     Campaign response = campaignServiceClient.GetCampaign(request);
 }
        /// <summary>Snippet for GetCampaignAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetCampaignRequestObjectAsync()
        {
            // Create client
            CampaignServiceClient campaignServiceClient = await CampaignServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetCampaignRequest request = new GetCampaignRequest
            {
                ResourceNameAsCampaignName = CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
            };
            // Make the request
            Campaign response = await campaignServiceClient.GetCampaignAsync(request);
        }
 /// <summary>Snippet for SuggestSmartCampaignBudgetOptions</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void SuggestSmartCampaignBudgetOptionsRequestObject()
 {
     // Create client
     SmartCampaignSuggestServiceClient smartCampaignSuggestServiceClient = SmartCampaignSuggestServiceClient.Create();
     // Initialize request argument(s)
     SuggestSmartCampaignBudgetOptionsRequest request = new SuggestSmartCampaignBudgetOptionsRequest
     {
         CustomerId             = "",
         CampaignAsCampaignName = CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
     };
     // Make the request
     SuggestSmartCampaignBudgetOptionsResponse response = smartCampaignSuggestServiceClient.SuggestSmartCampaignBudgetOptions(request);
 }
Beispiel #7
0
        public void Init()
        {
            string budgetResourceName   = ExampleTestsUtils.CreateBudget(client, false);
            string campaignResourceName = ExampleTestsUtils.CreateCampaign(client,
                                                                           budgetResourceName);

            campaignId = long.Parse(CampaignName.Parse(campaignResourceName).CampaignId);
            string campaignDraftResourceName = ExampleTestsUtils.CreateCampaignDraft(client,
                                                                                     config.ClientCustomerId, campaignId);

            draftId = long.Parse(CampaignDraftName.Parse(campaignDraftResourceName)
                                 .DraftId);
        }
Beispiel #8
0
        /// <summary>Snippet for GetCampaignAsync</summary>
        public async Task GetCampaignResourceNamesAsync()
        {
            // Snippet: GetCampaignAsync(CampaignName, CallSettings)
            // Additional: GetCampaignAsync(CampaignName, CancellationToken)
            // Create client
            CampaignServiceClient campaignServiceClient = await CampaignServiceClient.CreateAsync();

            // Initialize request argument(s)
            CampaignName resourceName = CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]");
            // Make the request
            Campaign response = await campaignServiceClient.GetCampaignAsync(resourceName);

            // End snippet
        }
        /// <summary>Snippet for SuggestSmartCampaignBudgetOptionsAsync</summary>
        public async Task SuggestSmartCampaignBudgetOptionsRequestObjectAsync()
        {
            // Snippet: SuggestSmartCampaignBudgetOptionsAsync(SuggestSmartCampaignBudgetOptionsRequest, CallSettings)
            // Additional: SuggestSmartCampaignBudgetOptionsAsync(SuggestSmartCampaignBudgetOptionsRequest, CancellationToken)
            // Create client
            SmartCampaignSuggestServiceClient smartCampaignSuggestServiceClient = await SmartCampaignSuggestServiceClient.CreateAsync();

            // Initialize request argument(s)
            SuggestSmartCampaignBudgetOptionsRequest request = new SuggestSmartCampaignBudgetOptionsRequest
            {
                CustomerId             = "",
                CampaignAsCampaignName = CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
            };
            // Make the request
            SuggestSmartCampaignBudgetOptionsResponse response = await smartCampaignSuggestServiceClient.SuggestSmartCampaignBudgetOptionsAsync(request);

            // End snippet
        }
        public async Task <string> AddCampaignName([FromBody] CampaignName campaignName)
        {
            if (ModelState.IsValid)
            {
                var headers        = new Dictionary <string, string>();
                var tokenGenerated = HttpContext.Session.GetHmacToken();
                headers.Add("X-Hmac", tokenGenerated);
                headers.Add("X-PublicKey", HttpContext.Session.GetUserPublicKey());
                string queryStr = _queryCreater.GetQueryStringFromObject(campaignName);
                var    response = await HttpClientRequestFactory.Get("http://proxy.mansis.co.za:18443/SlimProxyBoot.php?" + queryStr, headers);

                var data = response.Content.ReadAsStringAsync().Result;
                return(data.ToString());
            }
            else
            {
                throw new Exception("Model state is not valid");
            }
        }
Beispiel #11
0
        public async Task GetCampaignAsync()
        {
            Mock <CampaignService.CampaignServiceClient> mockGrpcClient = new Mock <CampaignService.CampaignServiceClient>(MockBehavior.Strict);
            GetCampaignRequest expectedRequest = new GetCampaignRequest
            {
                ResourceName = new CampaignName("[CUSTOMER]", "[CAMPAIGN]").ToString(),
            };
            Campaign expectedResponse = new Campaign
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Campaign>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignServiceClient client   = new CampaignServiceClientImpl(mockGrpcClient.Object, null);
            string   formattedResourceName = new CampaignName("[CUSTOMER]", "[CAMPAIGN]").ToString();
            Campaign response = await client.GetCampaignAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #12
0
        public void GetCampaign()
        {
            Mock <CampaignService.CampaignServiceClient> mockGrpcClient = new Mock <CampaignService.CampaignServiceClient>(MockBehavior.Strict);
            GetCampaignRequest expectedRequest = new GetCampaignRequest
            {
                ResourceName = new CampaignName("[CUSTOMER]", "[CAMPAIGN]").ToString(),
            };
            Campaign expectedResponse = new Campaign
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaign(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignServiceClient client   = new CampaignServiceClientImpl(mockGrpcClient.Object, null);
            string   formattedResourceName = new CampaignName("[CUSTOMER]", "[CAMPAIGN]").ToString();
            Campaign response = client.GetCampaign(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }