public virtual async Task <PostCollectionResponse> PostCollectionAsync(PostCollectionBody body,
                                                                        PostCollectionOptions options = null, CancellationToken cancellationToken = default)
 {
     return(await PostRequestAsync(
                ApiRootPath,
                errorResponse => new PostCollectionResponse(errorResponse),
                body, options, cancellationToken));
 }
        public async Task <PostCollectionResponse> PostCollectionAsync(PostCollectionBody body, PostCollectionQuery options = null)
        {
            string uriString = _collectionApiPath;

            if (options != null)
            {
                uriString += "?" + options.ToQueryString();
            }
            var content = GetContent(body, true, true);

            using (var response = await _transport.PostAsync(uriString, content))
            {
                var stream = await response.Content.ReadAsStreamAsync();

                if (response.IsSuccessStatusCode)
                {
                    return(DeserializeJsonFromStream <PostCollectionResponse>(stream));
                }
                throw await GetApiErrorException(response);
            }
        }