예제 #1
0
        public Task <Result <IEnumerable <Category>, Error.ExceptionalError> > GetCategoriesWithIdNameAndDescription()
        {
            var query = RequestAdapter <ResponsesAdapter.CategoriesResponse, IEnumerable <Category> > .Build(
                "{ categories { id, name, description } }",
                response => response.Categories !);

            return(_client.SendQueryAsync(query));
        }
예제 #2
0
        public Task <Result <IEnumerable <Model.Attribute>, Error.ExceptionalError> > GetAttributes()
        {
            var request = RequestAdapter <ResponsesAdapter.AttributesResponse, IEnumerable <Model.Attribute> > .Build(
                "{ attributes { id, name } }",
                response => response.Attributes !
                );

            return(_client.SendQueryAsync(request));
        }
예제 #3
0
        public Task <Result <IEnumerable <Product>, Error.ExceptionalError> > GetProductsWithIdNameDescriptionAndMicroName()
        {
            var request = RequestAdapter <ResponsesAdapter.ProductsResponse, IEnumerable <Product> > .Build(
                "{ products { id, name, category { name } } }",
                response => response.Products !
                );

            return(_client.SendQueryAsync(request));
        }
예제 #4
0
        public Task <Result <Model.Attribute, Error.ExceptionalError> > UpdateAttribute(Guid id, Model.Attribute attribute)
        {
            var request = RequestAdapter <ResponsesAdapter.AttributeResponse, Model.Attribute> .Build(
                "mutation UpdateAttribute($attribute: AttributeInput!) { updateAttribute(attribute: $attribute) { id } }",
                response => response.Attribute !,
                new { attribute = SerializeAttribute(attribute) },
                "UpdateAttribute"
                );

            return(_client.SendQueryAsync(request));
        }
예제 #5
0
        public Task <Result <Model.Attribute, Error.ExceptionalError> > GetAttribute(Guid id)
        {
            var request = RequestAdapter <ResponsesAdapter.AttributeResponse, Model.Attribute> .Build(
                "query GetAttributeById($id: String) { attribute(id: $id) { id, name } }",
                response => response.Attribute !,
                new { id },
                "GetAttributeById"
                );

            return(_client.SendQueryAsync(request));
        }
예제 #6
0
        public Task <Result <Category, Error.ExceptionalError> > UpdateCategory(Guid id, Category category)
        {
            var query = RequestAdapter <ResponsesAdapter.CategoryResponse, Category> .Build(
                "mutation UpdateCategory($category: CategoryInput!) { updateCategory(category: $category) { id } }",
                response => response.Category,
                new { category = SerializeMicro(category) },
                "UpdateCategory"
                );

            return(_client.SendQueryAsync(query));
        }
예제 #7
0
        public Task <Result <Category, Error.ExceptionalError> > GetCategoryById(Guid id)
        {
            var query = RequestAdapter <ResponsesAdapter.CategoryResponse, Category> .Build(
                "query GetCategoryById($id: String) { category(id: $id) {id, name, description } }",
                request => request.Category,
                new { id },
                "GetCategoryById"
                );

            return(_client.SendQueryAsync(query));
        }
예제 #8
0
        public Task <Result <Product, Error.ExceptionalError> > UpdateProduct(Product product, Guid productId)
        {
            var query = RequestAdapter <ResponsesAdapter.ProductResponse, Product> .Build(
                "mutation UpdateProduct($product: ProductInput!) { updateProduct(product: $product) { id } }",
                response => response.Product !,
                new { product = SerializeProduct(product) },
                "UpdateProduct"
                );

            return(_client.SendQueryAsync(query));
        }