bookgmt_api_package 0.0.2 copy "bookgmt_api_package: ^0.0.2" to clipboard
bookgmt_api_package: ^0.0.2 copied to clipboard

unlistedoutdated

Official Flutter package client for the BookGMT API.

example/main.dart

import 'package:bookgmt_api_package/api/service/handler/index.dart';
import 'package:bookgmt_api_package/models/index.dart';

// create main function
void main() async{
  // create a user instance
  final user = User.instance;
  // set the user data
  user.userData =
    UserModel(
      id: '5f9f1c1c1c9d440000f1b1b1',
      name: NameModel(
        first: 'John',
        last: 'Doe',
      ),
      email: ' ser@gmail.com',
      phone: '1234567890',
      provider: AuthProvider.google,
      avatar: 'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50',
      status: StatusModel(
        hasBusiness: false,
      ),
      role: RoleModel(
        isAdmin: false,
      ),
      socialIdentityId: null,
      otp: OTPModel(
        code: '123456',
        expiresAt: DateTime.now().add(const Duration(minutes: 5)),
      ),
    );
  // print the user data
  print(user.userData.toJson());
  final user2 = User.instance;
  print(user2.userData.name?.first);

  // create a service instance
  final service = Services.instance;
  // set the service data
  service.services = <ServiceModel>[ServiceModel(
    id: '5f9f1c1c1c9d440000f1b1b1',
    duration: 60,
    businessId: '5f9f1c1c1c9d440000f1b1b1',
    categoryId: '5f9f1c1c1c9d440000f1b1b1',
    customStyle: [
      CustomStyleModel(
       styleCategory: StyleType.color,
        name: StyleNames.colored,
        price: 100,
      ),
    ],
    description: 'description',
    name: 'African Braids',
    price: 100,
    hasCustomStyle: true,
    subServices: [
      SubServiceModel(
        id: '5f9f1c1c1c9d440000f1b1b1',
        name: 'name',
        price: 100,
        hasCustomStyle: true,
        categoryId: '5f9f1c1c1c9d440000f1b1b1',
        businessId: '5f9f1c1c1c9d440000f1b1b1',
        customStyle: [
          CustomStyleModel(
            styleCategory: StyleType.color,
            name: StyleNames.colored,
            price: 100,
          ),
          CustomStyleModel(
            styleCategory: StyleType.size,
            name: StyleNames.jumbo,
            price: 100,
          ),
        ],
      ), SubServiceModel(
        id: '5f9f1c1c1c9d440000f1db1b1',
        name: 'name',
        price: 100,
        description: 'description',
        discount: [
          DiscountModel(
             name: 'discount',
             price: 30,
             percentage:0.5,
             businessId: '5f9f1c1c1c9d440000f1b1b1',
              endDate: DateTime.now().add(const Duration(days: 5)),
          ),
        ],
        hasCustomStyle: true,
        categoryId: '5f9f1c1c1c9d440d000f1b1b1',
        businessId: '5f9f1c1c1c9d440w000f1b1b1',
        customStyle: [
          CustomStyleModel(
            styleCategory: StyleType.length,
            name: StyleNames.shoulder,
            price: 200,
          ),
        ],
      ),
    ],

  )
  ];
  // print the service data
  // print(service.services?[0].toString());
  final service2 = Services.instance;
  // print(service2.services?[0].subServices?[0].toString());
  service.selectedService = service.services?[0];
  final service3 = Services.instance;
  print('selected service: ${service3.selectedService?.toString()}');

   final result = await makeRequest(
     method: HttpMethod.GET,
     endPoint: 'https://jsonplaceholder.typicode.com/todos/1',
   );
    print(result);
}
1
likes
0
points
21
downloads

Publisher

verified publisherpackages.bookgmt.com

Weekly Downloads

Official Flutter package client for the BookGMT API.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on bookgmt_api_package