예제 #1
0
        /// <summary>
        /// Allows to specify multiple keys to be selected from the database
        /// </summary>
        /// <see cref="https://docs.couchdb.org/en/stable/api/database/bulk-api.html?highlight=batch#post--db-_all_docs" />
        /// <returns></returns>
        public async Task <CouchResponse> SelectAsync(string ids)
        {
            var request = new RestSharp.RestRequest("_all_docs", RestSharp.Method.POST);

            DocsBuilder expression = new DocsBuilder();

            expression.Add(ids);

            request.AddParameter("application/json", expression.ToString(), RestSharp.ParameterType.RequestBody);
            return(await client.http.ExecuteAsync(request));
        }
예제 #2
0
        /// <summary>
        /// http://docs.couchdb.org/en/2.2.0/api/database/bulk-api.html#api-db-all-docs
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public async Task <CouchResponse> BulkInsertAsync(dynamic[] documentsObjects)
        {
            var request = new RestSharp.RestRequest("_bulk_docs", RestSharp.Method.POST);

            DocsBuilder expression = new DocsBuilder();

            expression.Add(documentsObjects);

            request.AddParameter("application/json", expression.ToString(), ParameterType.RequestBody);
            return(await client.http.ExecuteAsync(request));
        }