/// <summary> /// Creates an engagement /// </summary> /// <param name="entity">The engagement to create</param> /// <returns>The created engagement (with ID set)</returns> public EngagementHubSpotModel Create(EngagementHubSpotModel entity) { var path = $"{entity.RouteBasePath}/engagements"; var data = _client.Execute <EngagementHubSpotModel>(path, entity, Method.POST, false); return(data); }
/// <summary> /// Updates a given engagement /// </summary> /// <param name="entity">The updated engagement</param> public void Update(EngagementHubSpotModel entity) { if (entity.Engagement.Id < 1) throw new ArgumentException("Engagement entity must have an id set!"); _client.ExecuteOnly(GetRoute<EngagementHubSpotModel>(entity.Engagement.Id.ToString()), entity, Method.PATCH); }
/// <summary> /// Updates a given engagement /// </summary> /// <param name="entity">The updated engagement</param> public Task UpdateAsync(EngagementHubSpotModel entity, CancellationToken cancellationToken = default) { if (entity.Engagement.Id < 1) { throw new ArgumentException("Engagement entity must have an id set!"); } return(_client.ExecuteOnlyAsync(GetRoute <EngagementHubSpotModel>(entity.Engagement.Id.ToString()), entity, Method.PATCH, cancellationToken)); }
/// <summary> /// Updates a given engagement /// </summary> /// <param name="entity">The updated engagement</param> public void Update(EngagementHubSpotModel entity) { if (entity.Engagement.Id < 1) { throw new ArgumentException("Engagement entity must have an id set!"); } var path = $"{entity.RouteBasePath}/engagements/{entity.Engagement.Id}"; _client.Execute(path, entity, Method.PATCH, false); }
/// <summary> /// Creates an engagement /// </summary> /// <param name="entity">The engagement to create</param> /// <returns>The created engagement (with ID set)</returns> public EngagementHubSpotModel Create(EngagementHubSpotModel entity) => _client.Execute <EngagementHubSpotModel, EngagementHubSpotModel>(GetRoute <EngagementHubSpotModel>(), entity, Method.POST);
/// <summary> /// Creates an engagement /// </summary> /// <param name="entity">The engagement to create</param> /// <returns>The created engagement (with ID set)</returns> public Task <EngagementHubSpotModel> CreateAsync(EngagementHubSpotModel entity, CancellationToken cancellationToken = default) => _client.ExecuteAsync <EngagementHubSpotModel, EngagementHubSpotModel>(GetRoute <EngagementHubSpotModel>(), entity, Method.POST, cancellationToken);