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

Pure Dart client for the Sanity.io Content Lake API. Run GROQ queries, create and patch documents, commit transactions and upload assets, from Dart servers, CLIs and Flutter apps alike. No Flutter dependency.

example/sanity_api_example.dart

import 'package:sanity_api/sanity_api.dart';

Future<void> main() async {
  final client = SanityClient(
    SanityConfig(
      projectId: 'abc123',
      dataset: 'production',
      apiVersion: '2024-05-03',
    ),
  );

  final exercises = await client.fetch<List<Object?>>(
    r'*[_type == "exercise" && $tag in tags][0...10]{_id, title}',
    params: {'tag': 'shoulder'},
  );
  print('Found ${exercises.length} exercises');

  final response = await client.fetchFull<Object?>('count(*[_type == "exercise"])');
  print('Counted in ${response.ms}ms');

  client.close();
}
0
likes
150
points
133
downloads

Documentation

API reference

Publisher

verified publisherfullphysio.com

Weekly Downloads

Pure Dart client for the Sanity.io Content Lake API. Run GROQ queries, create and patch documents, commit transactions and upload assets, from Dart servers, CLIs and Flutter apps alike. No Flutter dependency.

Repository (GitHub)
View/report issues

Topics

#sanity #cms #groq #client

License

MIT (license)

Dependencies

http, meta

More

Packages that depend on sanity_api