public void TestMethod1() { ResvAlipayTradeNo test = new ResvAlipayTradeNo(); test.ResvId = "test_ResvId"; test.AlipayTradeNo = "test_AlipayTradeNo"; TestSend.MyTest(test); }
/// <summary> /// Send a test send of a campaign. /// </summary> /// <param name="accessToken">Constant Contact OAuth2 access token.</param> /// <param name="apiKey">The API key for the application</param> /// <param name="campaignId">Id of campaign to send test of.</param> /// <param name="testSend">Test send details.</param> /// <returns>Returns the sent test object.</returns> public TestSend SendTest(string accessToken, string apiKey, string campaignId, TestSend testSend) { TestSend test = null; string url = String.Concat(Config.Endpoints.BaseUrl, String.Format(Config.Endpoints.CampaignTestSends, campaignId)); string json = testSend.ToJSON(); CUrlResponse response = RestClient.Post(url, accessToken, apiKey, json); if (response.IsError) { throw new CtctException(response.GetErrorMessage()); } if (response.HasData) { test = Component.FromJSON <TestSend>(response.Body); } return(test); }
/// <summary> /// Send a test send of a campaign. /// </summary> /// <param name="campaignId">Id of campaign to send test of.</param> /// <param name="testSend">Test send details.</param> /// <returns>Returns the sent test object.</returns> public TestSend SendTest(string campaignId, TestSend testSend) { if (string.IsNullOrEmpty(campaignId) || testSend == null) { throw new IllegalArgumentException(ConstantContactClient.Resources.Errors.ScheduleOrId); } string url = String.Concat(Settings.Endpoints.Default.BaseUrl, String.Format(Settings.Endpoints.Default.CampaignTestSends, campaignId)); string json = testSend.ToJSON(); RawApiResponse response = RestClient.Post(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json); try { var test = response.Get <TestSend>(); return(test); } catch (Exception ex) { throw new ConstantContactClientException(ex.Message, ex); } }