Пример #1
0
        /// <summary>
        /// Creates a new <see cref="Collect"/> on the store. Map product to collection
        /// </summary>
        /// <param name="collect">A new <see cref="Collect"/>. Id should be set to null.</param>
        /// <returns>The new <see cref="Collect"/>.</returns>
        public virtual async Task <Collect> CreateAsync(Collect collect)
        {
            var req     = PrepareRequest("collects.json");
            var content = new JsonContent(new
            {
                collect = collect
            });

            return(await ExecuteRequestAsync <Collect>(req, HttpMethod.Post, content, "collect"));
        }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="Collect"/> on the store. Map product to collection
        /// </summary>
        /// <param name="collect">A new <see cref="Collect"/>. Id should be set to null.</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <returns>The new <see cref="Collect"/>.</returns>
        public virtual async Task <Collect> CreateAsync(Collect collect, CancellationToken cancellationToken = default)
        {
            var req     = PrepareRequest("collects.json");
            var content = new JsonContent(new
            {
                collect = collect
            });

            var response = await ExecuteRequestAsync <Collect>(req, HttpMethod.Post, cancellationToken, content, "collect");

            return(response.Result);
        }