api_client_generator 0.1.0 copy "api_client_generator: ^0.1.0" to clipboard
api_client_generator: ^0.1.0 copied to clipboard

A Dart package to generate API client code from an OpenAPI schema.

example/main.dart

import 'package:api_client_generator/api_client.dart';

void main() async {
  final apiClient = ApiClient('https://api.example.com');

  try {
    // GET request
    final response = await apiClient.fetchSomeResources(queryParams: {
      'page': 1,
      'pageSize': 10,
    });
    print('Fetched resources: $response');

    // POST request
    final newResource = await apiClient.createSomeResource({
      'name': 'example',
      'description': 'An example resource',
    });
    print('Created resource: $newResource');

    // PUT request
    final updatedResource = await apiClient.updateSomeResource(
      1,
      {
        'name': 'updated_example',
        'description': 'Updated description',
      },
    );
    print('Updated resource: $updatedResource');

    // DELETE request
    await apiClient.deleteSomeResource(1);
    print('Deleted resource');
  } catch (e) {
    print('Error: $e');
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A Dart package to generate API client code from an OpenAPI schema.

Homepage
Repository (GitHub)
View/report issues

Topics

#api #client #generator #openapi #code-generation

License

unknown (license)

Dependencies

http, yaml

More

Packages that depend on api_client_generator