chanomhub_flutter 1.0.0 copy "chanomhub_flutter: ^1.0.0" to clipboard
chanomhub_flutter: ^1.0.0 copied to clipboard

retracted

Official Flutter SDK for Chanomhub API. Access articles, authentication, downloads, and automated image processing with imgproxy support.

example/main.dart

import 'package:chanomhub_flutter/chanomhub_flutter.dart';

void main() async {
  // 1. Initialize the SDK
  final sdk = ChanomhubClient(
    baseUrl: 'https://api.chanomhub.com',
    cdnUrl: 'https://imgproxy.chanomhub.com',
  );

  print('๐Ÿงช Chanomhub SDK Test Drive ๐Ÿงช');

  try {
    // 2. Fetch Latest Articles
    print('\n[Fetching Articles...]');
    final response = await sdk.articles.getAllPaginated(
      options: ArticleListOptions(limit: 3),
    );

    print('โœ… Found ${response.total} articles total.');
    for (var article in response.items) {
      print('  ๐Ÿ“„ ${article.title}');
      print('  ๐Ÿ–ผ๏ธ Image: ${article.mainImage}'); // Auto-transformed URL
    }

    // 3. Search for a specific query
    print('\n[Searching for "visual novel" with Thai tag...]');
    final searchResult = await sdk.search.articles(
      'visual novel',
      options: SearchOptions(tag: 'Thai', limit: 2),
    );
    print('โœ… Search found ${searchResult.items.length} results.');

    // 4. Test Error Handling (Invalid Login)
    print('\n[Testing Error Handling (Invalid Login)...]');
    try {
      await sdk.auth.login(
        email: 'invalid@example.com',
        password: 'wrong_password',
      );
    } on AuthenticationException catch (e) {
      print('โœ… Caught expected exception: ${e.message} (Status: ${e.statusCode})');
    }

  } catch (e) {
    print('โŒ Unexpected error: $e');
  } finally {
    sdk.dispose();
  }
}
0
likes
0
points
230
downloads

Publisher

verified publisherchanomhub.com

Weekly Downloads

Official Flutter SDK for Chanomhub API. Access articles, authentication, downloads, and automated image processing with imgproxy support.

Repository (GitHub)
View/report issues

Topics

#sdk #graphql #rest #api-client #image-processing

License

unknown (license)

Dependencies

dio, flutter, json_annotation

More

Packages that depend on chanomhub_flutter