コード例 #1
0
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>CustomModelDto</c> populated with the result of the call </returns>
        /// <seealso cref="CustomModelDto"/>
        public Task CallDeleteCustomModelAsync(CustomModelParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (string.IsNullOrEmpty(parameters.Id))
            {
                throw new ArgumentException(ErrorMessages.WrongId, ErrorMessages.Id);
            }

            return(_apiClient.CallApiAsync <CustomModelDto>(ApiClient.CustomModelUriBuilder(), ApiClient.DeleteCustomModelContentBuilder(parameters), HttpMethod.Delete));
        }
コード例 #2
0
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>CustomModelDto</c> populated with the result of the call </returns>
        /// <seealso cref="CustomModelDto"/>
        public Task <CustomModelDto> CallCreateCustomModelAsync(CustomModelParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (parameters.Data == null)
            {
                throw new ArgumentException(ErrorMessages.MissingData, ErrorMessages.Data);
            }
            if (parameters.Data.Categories == null)
            {
                throw new ArgumentException(ErrorMessages.MissingCategories, ErrorMessages.Categories);
            }
            if (parameters.Data.Categories.Count <= 0)
            {
                throw new ArgumentException(ErrorMessages.EmptyList, ErrorMessages.Categories);
            }

            return(_apiClient.CallApiAsync <CustomModelDto>(ApiClient.CustomModelUriBuilder(), ApiClient.CreateCustomModelContentBuilder(parameters), HttpMethod.Post));
        }
コード例 #3
0
 /// <summary>
 ///     Allocates a dictionary that contains the parameters for the call
 /// </summary>
 /// <param name="parameters"></param>
 /// <returns>Returns the dictionary </returns>
 public static List <KeyValuePair <string, string> > DeleteCustomModelContentBuilder(CustomModelParameters parameters)
 {
     return(ReadCustomModelContentBuilder(parameters));
 }
コード例 #4
0
        /// <summary>
        ///     Allocates a dictionary that contains the parameters for the call
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns the dictionary </returns>
        public static List <KeyValuePair <string, string> > ReadCustomModelContentBuilder(CustomModelParameters parameters)
        {
            var content = new List <KeyValuePair <string, string> >();

            content.Add(new KeyValuePair <string, string>("token", parameters.Token));
            content.Add(new KeyValuePair <string, string>("id", parameters.Id));
            return(content);
        }
コード例 #5
0
        /// <summary>
        ///     Allocates a dictionary that contains the parameters for the call
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns the dictionary </returns>
        public static List <KeyValuePair <string, string> > UpdateCustomModelContentBuilder(CustomModelParameters parameters)
        {
            var content = new List <KeyValuePair <string, string> >();

            content.Add(new KeyValuePair <string, string>("token", parameters.Token));
            content.Add(new KeyValuePair <string, string>("id", parameters.Id));
            content.Add(new KeyValuePair <string, string>("data", JsonConvert.SerializeObject(parameters.Data)));
            return(content);
        }
コード例 #6
0
 /// <summary>
 ///     Asyncronous method that returns the list of all your <see href="https://dandelion.eu/docs/api/datatxt/cl/models/v1/#list">Custom Models</see>
 /// </summary>
 /// <param name="parameters"> Contains all the informations related to the custom models</param>
 /// <returns>Returns a <c>CustomModelsListDto</c> populated with the result of the process </returns>
 /// <seealso cref="CustomModelsListDto"/>
 public static Task <CustomModelsListDto> ListAllCustomModelsAsync(CustomModelParameters parameters)
 {
     Init();
     return(_customModelService.CallListAllCustomModelsAsync());
 }
コード例 #7
0
 /// <summary>
 ///     Asyncronous method that delete a <see href="https://dandelion.eu/docs/api/datatxt/cl/models/v1/#delete">Custom Model</see>
 /// </summary>
 /// <param name="parameters"> Contains all the informations related to the custom model</param>
 public static Task DeleteCustomModelAsync(CustomModelParameters parameters)
 {
     Init();
     return(_customModelService.CallDeleteCustomModelAsync(parameters));
 }
コード例 #8
0
 /// <summary>
 ///     Asyncronous method that update a <see href="https://dandelion.eu/docs/api/datatxt/cl/models/v1/#update">Custom Model</see>
 /// </summary>
 /// <param name="parameters"> Contains all the informations related to the custom model</param>
 /// <returns>Returns a <c>CustomModelDto</c> populated with the result of the process </returns>
 /// <seealso cref="CustomModelDto"/>
 public static Task <CustomModelDto> UpdateCustomModelAsync(CustomModelParameters parameters)
 {
     Init();
     return(_customModelService.CallUpdateCustomModelAsync(parameters));
 }