https://github.com/anasfik/youcan_flutter_sdk
The YouCan E-commerce platform SDK for Flutter/Dart, built for a better developer experience.
https://github.com/anasfik/youcan_flutter_sdk
api-rest dart dart-lib dart-packages e-commerce e-commerce-api e-commerceplatform flutter flutter-plugin sdk youcan youcan-pay youcanbookme youcanpay
Last synced: 3 months ago
JSON representation
The YouCan E-commerce platform SDK for Flutter/Dart, built for a better developer experience.
- Host: GitHub
- URL: https://github.com/anasfik/youcan_flutter_sdk
- Owner: anasfik
- License: mit
- Created: 2022-12-28T18:11:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-23T12:38:11.000Z (over 3 years ago)
- Last Synced: 2025-04-03T08:59:55.258Z (about 1 year ago)
- Topics: api-rest, dart, dart-lib, dart-packages, e-commerce, e-commerce-api, e-commerceplatform, flutter, flutter-plugin, sdk, youcan, youcan-pay, youcanbookme, youcanpay
- Language: Dart
- Homepage: https://anasfik.github.io/Youcan_flutter_sdk
- Size: 1.42 MB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
YouCan API
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:
```dart
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:
```dart
// 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:
```dart
List products = await YouCan.instance.products.all();
```
### Get Reviews
You can also get a product's reviews as `List` like this:
```dart
List products = await YouCan.instance.products.all();
Product oneProduct = products.first;
List review = await oneProduct.reviews();
```
### Get Categories
to get all your store's categories as `List`, you will need to do this:
```dart
List categories = await YouCan.instance.categories.all();
```
### Querying
#### Search
Search queries are made easy:
```dart
List 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 :
```dart
List products = await YouCan.instance.products.pagination(2).all();
```
#### Limit
You can also limit the requested elements to a specific number
```dart
List 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... :
```dart
List 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()` :
```dart
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.
```