Esempio n. 1
0
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>CustomSpotDto</c> populated with the result of the call </returns>
        /// <seealso cref="CustomSpotDto"/>
        public Task CallDeleteCustomSpotAsync(CustomSpotParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (string.IsNullOrEmpty(parameters.Id))
            {
                throw new ArgumentException(ErrorMessages.WrongId, ErrorMessages.Id);
            }

            return(_apiClient.CallApiAsync <CustomSpotDto>(ApiClient.CustomSpotUriBuilder(), ApiClient.DeleteCustomSpotContentBuilder(parameters), HttpMethod.Delete));
        }
Esempio n. 2
0
        /// <summary>
        ///     Asyncronous method that validate the user parameters and call <c>ApiClient</c>
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Returns a <c>CustomSpotDto</c> populated with the result of the call </returns>
        /// <seealso cref="CustomSpotDto"/>
        public Task <CustomSpotDto> CallCreateCustomSpotAsync(CustomSpotParameters parameters)
        {
            ServiceUtils.ParameterValidation(parameters);
            if (parameters.Data == null)
            {
                throw new ArgumentException(ErrorMessages.MissingData, ErrorMessages.Data);
            }
            if (parameters.Data.List == null)
            {
                throw new ArgumentException(ErrorMessages.MissingList, ErrorMessages.List);
            }
            if (parameters.Data.List.Count <= 0)
            {
                throw new ArgumentException(ErrorMessages.EmptyList, ErrorMessages.List);
            }

            return(_apiClient.CallApiAsync <CustomSpotDto>(ApiClient.CustomSpotUriBuilder(), ApiClient.CreateCustomSpotContentBuilder(parameters), HttpMethod.Post));
        }
Esempio n. 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> > DeleteCustomSpotContentBuilder(CustomSpotParameters parameters)
 {
     return(ReadCustomSpotContentBuilder(parameters));
 }
Esempio n. 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> > ReadCustomSpotContentBuilder(CustomSpotParameters 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);
        }
Esempio n. 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> > UpdateCustomSpotContentBuilder(CustomSpotParameters 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);
        }
Esempio n. 6
0
 /// <summary>
 ///     Asyncronous method that returns the list of all your <see href="https://dandelion.eu/docs/api/datatxt/custom-spots/v1/#list">Custom Spots</see>
 /// </summary>
 /// <param name="parameters"> Contains all the informations related to the custom spots</param>
 /// <returns>Returns a <c>CustomSpotsListDto</c> populated with the result of the process </returns>
 /// <seealso cref="CustomSpotsListDto"/>
 public static Task <CustomSpotsListDto> ListAllCustomSpotsAsync(CustomSpotParameters parameters)
 {
     Init();
     return(_customSpotService.CallListAllCustomSpotsAsync());
 }
Esempio n. 7
0
 /// <summary>
 ///     Asyncronous method that delete a <see href="https://dandelion.eu/docs/api/datatxt/custom-spots/v1/#delete">Custom Spot</see>
 /// </summary>
 /// <param name="parameters"> Contains all the informations related to the custom spot</param>
 public static Task DeleteCustomSpotAsync(CustomSpotParameters parameters)
 {
     Init();
     return(_customSpotService.CallDeleteCustomSpotAsync(parameters));
 }
Esempio n. 8
0
 /// <summary>
 ///     Asyncronous method that update a <see href="https://dandelion.eu/docs/api/datatxt/custom-spots/v1/#update">Custom Spot</see>
 /// </summary>
 /// <param name="parameters"> Contains all the informations related to the custom spot</param>
 /// <returns>Returns a <c>CustomSpotDto</c> populated with the result of the process </returns>
 /// <seealso cref="CustomSpotDto"/>
 public static Task <CustomSpotDto> UpdateCustomSpotAsync(CustomSpotParameters parameters)
 {
     Init();
     return(_customSpotService.CallUpdateCustomSpotAsync(parameters));
 }