Ejemplo n.º 1
0
        /// <summary>Makes a call to the MangoPay API.
        /// This generic method handles calls targeting collections of
        /// DTO instances. In order to process single objects,
        /// use <code>Request</code> method instead.
        /// </summary>
        /// <typeparam name="T">Type on behalf of which the request is being called.</typeparam>
        /// <param name="endPoint">An instance of <see cref="ApiEndPoint"/> that specifies API url and method to call</param>
        /// <param name="requestData">Collection of key-value pairs of request parameters.</param>
        /// <param name="pagination">Pagination object.</param>
        /// <param name="additionalUrlParams"></param>
        /// <returns>Collection of DTO instances returned from API.</returns>
        public async Task <ListPaginated <T> > RequestList <T>(ApiEndPoint endPoint, Dictionary <String, String> requestData, Pagination pagination, Dictionary <String, String> additionalUrlParams)
            where T : new()
        {
            this._requestType     = endPoint.RequestType;
            this._includeClientId = endPoint.IncludeClientId;
            this._requestData     = requestData;

            ListPaginated <T> responseResult = await this.DoRequestList <T>(endPoint.GetUrl(), pagination, additionalUrlParams);

            return(responseResult);
        }
Ejemplo n.º 2
0
        /// <summary>Makes a call to the MangoPay API.
        /// This generic method handles calls targeting single
        /// DTO instances. In order to process collections of objects,
        /// use <code>RequestList</code> method instead.
        /// </summary>
        /// <typeparam name="U">Return type.</typeparam>
        /// <typeparam name="T">Type on behalf of which the request is being called.</typeparam>
        /// <param name="idempotencyKey">Idempotency key for this request.</param>
        /// <param name="endPoint">An instance of <see cref="ApiEndPoint"/> that specifies API url and method to call</param>
        /// <param name="requestData">Collection of key-value pairs of request parameters.</param>
        /// <param name="pagination">Pagination object.</param>
        /// <param name="entity">Instance of DTO class that is going to be sent in case of PUTting or POSTing.</param>
        /// <returns>The DTO instance returned from API.</returns>
        public async Task <U> Request <U, T>(String idempotencyKey, ApiEndPoint endPoint, Dictionary <String, String> requestData, Pagination pagination, T entity)
            where U : new()
        {
            this._requestType     = endPoint.RequestType;
            this._includeClientId = endPoint.IncludeClientId;
            this._requestData     = requestData;

            U responseResult = await this.DoRequest <U, T>(idempotencyKey, endPoint.GetUrl(), pagination, entity);

            return(responseResult);
        }