Exemplo n.º 1
0
        /// <summary>
        /// Updates a given company entity, any changed properties are updated
        /// </summary>
        /// <typeparam name="T">Implementation of CompanyHubSpotModel</typeparam>
        /// <param name="entity">The company entity</param>
        /// <returns>The updated company entity</returns>
        public Task <CompanyHubSpotModel> UpdateAsync(CompanyHubSpotModel entity, CancellationToken cancellationToken = default)
        {
            if (entity.Id < 1)
            {
                throw new ArgumentException("Company entity must have an id set!");
            }

            return(_client.ExecuteAsync <CompanyHubSpotModel, CompanyHubSpotModel>(GetRoute <CompanyHubSpotModel>("companies", entity.Id.ToString()), entity, Method.PUT, cancellationToken));
        }
        /// <summary>
        /// Updates a given company entity, any changed properties are updated
        /// </summary>
        /// <typeparam name="T">Implementation of CompanyHubSpotModel</typeparam>
        /// <param name="entity">The company entity</param>
        /// <returns>The updated company entity</returns>
        public CompanyHubSpotModel Update(CompanyHubSpotModel entity)
        {
            if (entity.Id < 1)
            {
                throw new ArgumentException("Company entity must have an id set!");
            }

            return(_client.Execute <CompanyHubSpotModel, CompanyHubSpotModel>(GetRoute <CompanyHubSpotModel>("companies", entity.Id.ToString()), entity, Method.PUT));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a Company entity
 /// </summary>
 /// <typeparam name="T">Implementation of CompanyHubSpotModel</typeparam>
 /// <param name="entity">The entity</param>
 /// <returns>The created entity (with ID set)</returns>
 /// <exception cref="NotImplementedException"></exception>
 public Task <CompanyHubSpotModel> CreateAsync(CompanyHubSpotModel entity, CancellationToken cancellationToken = default)
 => _client.ExecuteAsync <CompanyHubSpotModel, CompanyHubSpotModel>(GetRoute <CompanyHubSpotModel>("companies"), entity, Method.POST, cancellationToken);
 /// <summary>
 /// Creates a Company entity
 /// </summary>
 /// <typeparam name="T">Implementation of CompanyHubSpotModel</typeparam>
 /// <param name="entity">The entity</param>
 /// <returns>The created entity (with ID set)</returns>
 /// <exception cref="NotImplementedException"></exception>
 public CompanyHubSpotModel Create(CompanyHubSpotModel entity)
 => _client.Execute <CompanyHubSpotModel, CompanyHubSpotModel>(GetRoute <CompanyHubSpotModel>("companies"), entity, Method.POST);