GithubHelp home page GithubHelp logo

anasfik / youcan_flutter_sdk Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 1.46 MB

The YouCan E-commerce platform SDK for Flutter/Dart, built for a better developer experience.

Home Page: https://anasfik.github.io/Youcan_flutter_sdk

License: MIT License

Dart 100.00%
dart flutter youcan api-rest dart-lib dart-packages flutter-plugin sdk youcan-pay youcanbookme

youcan_flutter_sdk's Introduction


YouCan API


GitHub Star on GitHub GitHub contributors GitHub commit activity GitHub top language GitHub language count

A wrapper into the YouCan platform API that enables developers to extend its features inside a Dart/Flutter project


YOU CAN HELP THIS PROJECT MAINTAINED CONTINUOUSLY BY THE AUTHOR WITH A STAR ✨✨



Motivation

Well, we might need a flexible and easy way to exchange requests from this API to our project, this could get developers more unnecessary extra work such as dealing with configuring and using the API's multiple endpoints, loose types of data, HTTP requests, modeling data...

This library aims to cover the developers from all those sides and provide easy call methods that bring them to their goals.

NOTE: This is still under development

Documentation

Get the full documentation of all that this library offers from this link

Usage

Store configuration

To configure this library to get the data directly from your store, you will need to set it like this:

void main() {
  YouCan.instance.storeLink = 'https://example.youcan.shop'; // change it with your store's link
}

Authentication

You can authenticate your customers to your store by calling the login() and create() methods on the customers instance like this:

// Login
String loginToken = await YouCan.instance.customers.login(
        email: "YOUR EMAIL HERE",
        password: "YOUR PASSWORD HERE",
      );

// Sign Up.
CustomerCreationResponse customerCreationResult = await YouCan.instance.customers.create(
        email: "YOUR EMAIL HERE",
        password: "YOUR PASSWORD HERE",
        confirmPassword: "THE PASSWORD CONFIRMATION HERE",
      );

Get Products

To get a List` with all your store's products:

  List<Product> products = await YouCan.instance.products.all();

Get Reviews

You can also get a product's reviews as List<Review> like this:

  List<Product> products = await YouCan.instance.products.all();
  Product oneProduct = products.first;
  List<Review> review = await oneProduct.reviews();

Get Categories

to get all your store's categories as List<Category>, you will need to do this:

  List<Category> categories = await YouCan.instance.categories.all();

Querying

Search

Search queries are made easy:

  List<Product> products = await YouCan.instance.products.search("YOUR SEARCH TEXT").all();

Pagination

Pagination queries are also made easy, this example will get us the second page's products :

  List<Product> products = await YouCan.instance.products.pagination(2).all();

Limit

You can also limit the requested elements to a specific number

  List<Product> products = await YouCan.instance.products.limit(10).all();

Combining Queries

in brief, you can query your targets (products, reviews...) based on your store's implementation way, this means that you can query by categories, pages, and limiting elements... :

  List<Product> products = await YouCan.instance.categories.category("Category id").products.pagination(2).limit(15).all();

Contact

You can get in contact with your users using the sendMessage() :

bool isSent = await YouCan.instance.contact.sendMessage(
email: 'email',
subject: 'subject',
message: 'message',
),

Contributing

Our open-source project is making a difference in the E-commerce/Flutter community and we need your help to continue improving and expanding it. any kind of contribution is welcome.

Thank you!

License

MIT License

Copyright (c) 2023 Gwhyyy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

youcan_flutter_sdk's People

Contributors

anasfik avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

devfirdavs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.