lexicon

Core library for parsing Lexicon in the AT Protocol standard 🦋


GitHub Sponsor GitHub Sponsor

pub package Dart SDK Version Test/Analyzer codecov Issues Pull Requests Stars Contributors Last Commits License Contributor Covenant


1. Guide 🌎

This library provides the easiest way to use Lexicon supported by AT Protocol in Dart and Flutter apps.

Give a ⭐ on GitHub repository and follow shinyakato.dev on Bluesky!

1.1. Getting Started ⚡

1.1.1. Install Library

With Dart:

 dart pub add lexicon

Or With Flutter:

 flutter pub add lexicon

1.1.2. Import

import 'package:lexicon/lexicon.dart';

1.1.3. Implementation

import 'package:lexicon/docs.dart' as docs;
import 'package:lexicon/lexicon.dart';

void main() {
  //* Easy to parse lexicon from JSON.
  final appBskyFeedLike = LexiconDoc.fromJson({
    'lexicon': 1,
    'id': 'app.bsky.feed.like',
    'defs': {
      'main': {
        'type': 'record',
        'description': 'A declaration of a like.',
        'key': 'tid',
        'record': {
          'type': 'object',
          'required': ['subject', 'createdAt'],
          'properties': {
            'subject': {'type': 'ref', 'ref': 'com.atproto.repo.strongRef'},
            'createdAt': {'type': 'string', 'format': 'datetime'}
          }
        }
      }
    }
  });

  print(appBskyFeedLike.id);
  print(appBskyFeedLike.description);
  print(appBskyFeedLike.defs);

  //* Or you can use prepared official lexicons.
  final appBskyFeedPost = LexiconDoc.fromJson(docs.appBskyFeedPost);
  print(appBskyFeedPost);

  //* Also you can see all official lexicons.
  for (final lexicon in docs.lexicons) {
    final lexiconDoc = LexiconDoc.fromJson(lexicon);

    print(lexiconDoc.id);
    print(lexiconDoc.description);
    print(lexiconDoc.defs);
  }
}

1.2. Contribution 🏆

If you would like to contribute to lexicon, please create an issue or create a Pull Request.

There are many ways to contribute to the OSS. For example, the following subjects can be colexiconered:

  • There are request parameters or response fields that are not implemented.
  • Documentation is outdated or incomplete.
  • Have a better way or idea to achieve the functionality.
  • etc...

You can see more details from resources below:

Or you can create a discussion if you like.

Feel free to join this development, diverse opinions make software better!

1.3. Support ❤️

The simplest way to show us your support is by giving the project a star at GitHub and Pub.dev.

You can also support this project by becoming a sponsor on GitHub:

myconsciousness

You can also show on your repository that your app is made with lexicon by using one of the following badges:

Powered by lexicon Powered by lexicon Powered by lexicon

[![Powered by lexicon](https://img.shields.io/badge/Powered%20by-lexicon-00acee.svg)](https://github.com/myConsciousness/atproto.dart)
[![Powered by lexicon](https://img.shields.io/badge/Powered%20by-lexicon-00acee.svg?style=flat-square)](https://github.com/myConsciousness/atproto.dart)
[![Powered by lexicon](https://img.shields.io/badge/Powered%20by-lexicon-00acee.svg?style=for-the-badge)](https://github.com/myConsciousness/atproto.dart)

1.4. License 🔑

All resources of lexicon is provided under the BSD-3 license.

Copyright 2023 Shinya Kato. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the conditions.

Note
License notices in the source are strictly validated based on .github/header-checker-lint.yml. Please check header-checker-lint.yml for the permitted standards.

1.5. More Information 🧐

lexicon was designed and implemented by Shinya Kato (@myConsciousness).

Libraries

docs
lexicon