/// <summary> /// Update update campaign. /// </summary> /// <param name="campaignId">Id</param> /// <param name="campaign"><see cref="Campaign"/></param> /// <returns><see cref="Campaign"/></returns> /// <exception cref="CloudApiException">CloudApiException</exception> /// <example> /// <code> /// try /// { /// var campaign = updateApi.GetCampaign("015baf5f4f04000000000001001003d5"); /// var fieldsToUpdate = new Campaign /// { /// Name = "updatedName", /// }; /// var updatedCampaign = updateApi.UpdateCampaign(campaign.Id, fieldsToUpdate); /// return updatedCampaign; /// } /// catch (CloudApiException) /// { /// throw; /// } /// </code> /// </example> public Campaign UpdateCampaign(string campaignId, Campaign campaign) { try { var response = Api.UpdateCampaignUpdate(campaignId, campaign.CreatePutRequest()); return(Campaign.Map(response)); } catch (update_service.Client.ApiException e) { throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent); } }
/// <summary> /// Start update campaign. /// </summary> /// <param name="campaignId">Id of the campaign to start</param> /// <param name="campaign"><see cref="Campaign"/></param> /// <returns><see cref="Campaign"/></returns> /// <exception cref="CloudApiException">CloudApiException</exception> /// <example> /// <code> /// try /// { /// var campaign = api.GetCampaign("015baf5f4f04000000000001001003d5"); /// var startedCampaign = updateApi.StartCampaign(campaign.Id, campaign); /// return startedCampaign; /// } /// catch (CloudApiException) /// { /// throw; /// } /// </code> /// </example> public Campaign StartCampaign(string campaignId, Campaign campaign) { try { campaign.State = CampaignStateEnum.Scheduled; var resp = Api.UpdateCampaignUpdate(campaignId, campaign.CreatePutRequest()); return(Campaign.Map(resp)); } catch (update_service.Client.ApiException e) { throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent); } }