FLUTTER ECOSYSTEM

samarthagarwal/woocommerce_dart

WooCommerce REST API와 상호 작용하기 위한 Dart 패키지입니다.

woocommerce_dart 프로젝트 이미지
Stars
91
Forks
45
최근 푸시(UTC)
2024. 2. 12.
프로젝트 상태
활성
Samarth Agarwal GitHub avatar
GITHUB User

Samarth Agarwal ↗

App/Web Developer, Instructor, Author, Content Creator Visit https://www.youtube.com/user/thesamarthagarwal to learn from me.

언어DartObjective-CJava

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 4 개
  • flutter{"sdk":"flutter"}
  • crypto^3.0.1
  • http^0.13.3
  • flutter_test개발 의존성{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

WooCommerce SDK for Dart

A dart package to interact with the WooCommerce API (now with null-safety). It uses OAuth1.0a behind the scenes to generate the signature and URL string for http based websites. It then makes calls and returns the data back to the calling function asynchronously.

Example code and preview

Examples

GET request (Fetch products)
Future getProducts() async {
  // Initialize the API
  WooCommerceAPI wooCommerceAPI = WooCommerceAPI(
      url: "https://www.yourwebsite.com",
      consumerKey: "ck_your_consumer_key",
      consumerSecret: "cs_your_consumer_secret");

  // Get data using the "products" endpoint
  var products = await wooCommerceAPI.getAsync("products");
  return products;
}

You can find a full example here

POST request (Create a customer)
Future createCustomer() async {
  try {
    var response = await wooCommerceAPI.postAsync(
      "customers",
      {
        "email": 's@c.com',
        "password": "123",
        "billing": {
          "first_name": "Samarth",
        }
      },
    );
    print(response); // JSON Object with response
  } catch (e) {
    print(e);
  }
}
Report any issues if you face any or drop me an email at samarthagarwal@live.com