Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update artemis version #19

Merged
merged 24 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions example/lib/APIs.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:mmd_ecommerce_fl_lib/mmd_ecommerce.dart';

callBrandsApi() {
GeneralApiManager.brandsApi((List<Brand> brands) {}, () {});
GeneralApiManager.brandsApi((List<Brands$Query$Brand> brands) {}, () {});
BeshoyMelika marked this conversation as resolved.
Show resolved Hide resolved
}

sliderApi() async {
await GeneralApiManager.sliderApi(
(List<Slider> list) {}, (ApiErrorModel error) {});
(List<Sliders$Query$Slider> list) {}, (ApiErrorModel error) {});
}
11 changes: 7 additions & 4 deletions example/lib/apis/address_apis.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:mmd_ecommerce_fl_lib/mmd_ecommerce.dart';

getAllAddress() async {
await AddressApiManager.addressesApi(5, 1,
(UserAddressPaginator addressPaginator) {}, (ApiErrorModel error) {});
await AddressApiManager.addressesApi(
5,
1,
(GetAllAddress$Query$UserAddressPaginator addressPaginator) {},
(ApiErrorModel error) {});
}

createAddress() async {
Expand Down Expand Up @@ -43,11 +46,11 @@ deleteAddress() async {

getCitiesAsset() async {
await AddressApiManager.citiesApi(
(List<City> list) {}, (ApiErrorModel error) {});
(List<Cities$Query$City> list) {}, (ApiErrorModel error) {});
}

getAreaByIdAsset(String cityId) async {
await AddressApiManager.areaByIdApi(cityId, (List<Area> list) {
await AddressApiManager.areaByIdApi(cityId, (List<AreaByID$Query$Area> list) {
//
}, (ApiErrorModel error) {});
}
2 changes: 1 addition & 1 deletion example/lib/apis/auth_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:mmd_ecommerce_fl_lib/mmd_ecommerce.dart';

callRegisterApi() {
AuthApiManager.registerApi("mmd10", "[email protected]", "123456",
(UserRegister user) {}, (ApiErrorModel error) {});
(SignUp$Mutation$User register) {}, (ApiErrorModel error) {});
}

callForgetPasswordApi(String email) {
Expand Down
7 changes: 4 additions & 3 deletions example/lib/apis/cart_api.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:mmd_ecommerce_fl_lib/mmd_ecommerce.dart';

getVoucherByCode() async {
await CartApiManager.voucherByCodeApi(
"2121", (Voucher voucher) {}, (ApiErrorModel error) {});
await CartApiManager.voucherByCodeApi("2121",
(GetVoucherByCode$Query$Voucher voucher) {}, (ApiErrorModel error) {});
}

shippingFeesApi() async {
Expand All @@ -16,5 +16,6 @@ addToCard() async {
}

getCard() async {
await CartApiManager.cartDataApi((Cart cart) {}, (ApiErrorModel error) {});
await CartApiManager.cartDataApi(
BeshoyMelika marked this conversation as resolved.
Show resolved Hide resolved
(GetCart$Query$Cart cart) {}, (ApiErrorModel error) {});
}
33 changes: 20 additions & 13 deletions example/lib/apis/product_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,47 @@ import 'package:mmd_ecommerce_fl_lib/mmd_ecommerce.dart';

categoriesApi() async {
await GeneralApiManager.categoriesApi(
(List<Category> list) {}, (ApiErrorModel error) {});
(List<Categories$Query$Category> list) {}, (ApiErrorModel error) {});
}

productApi() async {
await ProductApiManager.productsApi(
10, 1, (ProductPaginatorModel item) {}, (ApiErrorModel error) {});
await ProductApiManager.productsApi(10, 1,
(Products$Query$ProductPaginator item) {}, (ApiErrorModel error) {});
}

productByCategoryIdApi() async {
await ProductApiManager.productByCategoryIdApi(
10, 1, "1", (ProductPaginatorModel item) {}, (ApiErrorModel error) {});
await ProductApiManager.productByCategoryIdApi(10, 1, "1",
(Products$Query$ProductPaginator item) {}, (ApiErrorModel error) {});
}

newProductApi() async {
await ProductApiManager.newProductApi(
10, 1, (NewProductsModel item) {}, (ApiErrorModel error) {});
10,
1,
SortOrder.desc,
ProductsOrderByColumn.id,
(OrderProducts$Query$ProductPaginator item) {},
(ApiErrorModel error) {});
}

getProductDetailsApi() async {
await ProductApiManager.productDetailsApi(
"1", (ProductDetailsModel item) {}, (ApiErrorModel error) {});
"1",
(Products$Query$ProductPaginator$Product item) {},
(ApiErrorModel error) {});
}

productByNameApi() async {
await ProductApiManager.productsByNameApi(
10, 1, "ad", (ProductPaginatorModel item) {}, (ApiErrorModel error) {});
await ProductApiManager.productsByNameApi(10, 1, "ad",
(Products$Query$ProductPaginator item) {}, (ApiErrorModel error) {});
}

relatedProductByIdApi() async {
await ProductApiManager.relatedProductsByIdApi(
"1", (RelatedProductsModel item) {}, (ApiErrorModel error) {});
await ProductApiManager.relatedProductsByIdApi("1",
(List<RelatedProducts$Query$Product> items) {}, (ApiErrorModel error) {});
}

getRatingsForProductApi() async {
await ProductApiManager.reviewsForProductApi(
10, 1, "1", (RatingPaginatorModel item) {}, (ApiErrorModel error) {});
await ProductApiManager.reviewsForProductApi(10, 1, "1",
(Ratings$Query$RatingPaginator item) {}, (ApiErrorModel error) {});
}
10 changes: 6 additions & 4 deletions example/lib/apis/user_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ callUpdateProfileApi(String name, String mobile) {
}

callMyProfileApi() {
UserApiManager.myProfileApi((UserMyProfile user) {
UserApiManager.myProfileApi((Profile$Query$User user) {
//

//
Expand All @@ -21,11 +21,13 @@ callMyProfileApi() {

callRefreshTokenApi(String refreshToken) {
// var token = "def50200ff07466059c5bfbf0689902c06002bb5990e9c4ea0d8750c51e07b42ae1e86072c400ae807c7e06e9cac45864abb0c7a910ce9eb2ad629e495a73caca9fd32c3ee756580f62b883008ef03eb5dc91d48724ec4ffe595c4a72d832d8420eac5cced2a6e000ebd7bf2db21534970a8eca26121e760b7dfdda3652416d2c4f756f5eaa46605a7b6377238257f3b3fee3dff2763e227b2c8657fb46c549e76a6e825af62db5d5c77813eac04162a7118145890ec2182d4603dcce28e24d910a148dc50345ed199ab851e59f939c0d27205458fb823e949d1af4af461922c1bf75cccc8f680c740680e50d7242f50128f2cc1b184ae6a06da2f17ea7a7eb8203d37fff5aab86abaab64e9ea9d661985fd015cc393872bea47f633ce6baf91e4be0c439df984452c74359619b2e764bf4e7d073bfd120fca3b5bda6b3777a4f4fddb0b72590dacf9f7ea661c415b724da74ddc0113f48c6ff1ecd6de4567c6a077f0e6";
UserApiManager.refreshTokenApi(refreshToken,
(AuthPayloadRefreshToken authPayload) {}, (ApiErrorModel error) {});
UserApiManager.refreshTokenApi(
refreshToken,
(RefreshToken$Mutation$AuthPayload authPayload) {},
(ApiErrorModel error) {});
}

getAllOrdersApi() {
UserApiManager.allOrdersApi(
20, 1, (OrderPaginator orders) {}, (ApiErrorModel error) {});
20, 1, (Orders$Query$OrderPaginator orders) {}, (ApiErrorModel error) {});
}
42 changes: 20 additions & 22 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MyHomePage extends StatefulWidget {

class _MyHomePageState extends State<MyHomePage> {
var isLoading = false;
AuthPayloadLogin auth;
SignIn$Mutation$AuthPayload auth;
var isError = false;

TextEditingController emailController = TextEditingController();
Expand All @@ -60,20 +60,20 @@ class _MyHomePageState extends State<MyHomePage> {
body: Center(child: isLoading ? getLoadingView() : getNormalView()));
}

callApi() async {
setState(() {
isLoading = true;
});
AuthApiManager.loginApi('[email protected]', '123456789', "123",
(AuthPayloadLogin auth) {
setState(() {
this.isLoading = false;
this.auth = auth;
});
}, () {
this.isError = true;
});
}
// callApi() async {
// setState(() {
// isLoading = true;
// });
// AuthApiManager.loginApi('[email protected]', '123456789', "123",
// (SignIn$Mutation$AuthPayload auth) {
// setState(() {
// this.isLoading = false;
// this.auth = auth;
// });
// }, () {
// this.isError = true;
// });
// }

Widget getLoadingView() {
return CircularProgressIndicator();
Expand All @@ -85,14 +85,13 @@ class _MyHomePageState extends State<MyHomePage> {
} else {
return Column(
children: [
Text("Result Success \n${auth?.authPayload?.access_token}"),
Text("Result Success \n${auth?.accessToken}"),
RaisedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MainSecond(auth.authPayload.refresh_token)),
builder: (context) => MainSecond(auth.refreshToken)),
);
},
child: Text("Open Main Second"),
Expand Down Expand Up @@ -229,12 +228,11 @@ class _MyHomePageState extends State<MyHomePage> {
}

callLoginApi() async {
await AuthApiManager.loginApi("[email protected]", "1234567890", "123",
(AuthPayloadLogin authPayload) async {
await AuthApiManager.loginApi("[email protected]", "123456789", "123",
(SignIn$Mutation$AuthPayload authPayload) async {
auth = authPayload;
MmdECommerceFlLib.submitTokeAndTokenType(
authPayload.authPayload.access_token,
authPayload.authPayload.token_type);
authPayload.accessToken, authPayload.tokenType);
}, (ApiErrorModel error) {});
}
}
Loading