-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
156 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,92 @@ | ||
# Atproto | ||
# ProtoRune | ||
|
||
**TODO: Add description** | ||
**ProtoRune** is an Elixir framework and client library for building applications on top of the ATProtocol, including **Bluesky** integration. Whether you're developing **bots**, **labelers**, **moderators**, or custom **app views**, ProtoRune provides a flexible and powerful way to interact with the protocol using Elixir. | ||
|
||
## Features | ||
|
||
- **XRPC Client**: Interact with ATProto services through a simple, extensible XRPC client. | ||
- **Schema Generation**: Automatically generate schemas from ATProto `defs.json` files. | ||
- **Bots & Labelers**: Create bots for content moderation, automated interactions, and more. | ||
- **Moderation Tools**: Build labelers and moderation tools integrated with ATProto's labeling system. | ||
- **Flexible Framework**: Use ProtoRune to build custom ATProto applications, including custom feeds, notifications, and more. | ||
|
||
## Installation | ||
|
||
If [available in Hex](https://hex.pm/docs/publish), the package can be installed | ||
by adding `atproto` to your list of dependencies in `mix.exs`: | ||
Add ProtoRune to your `mix.exs`: | ||
|
||
```elixir | ||
def deps do | ||
[ | ||
{:atproto, "~> 0.1.0"} | ||
{:proto_rune, "~> 0.1.0"} | ||
] | ||
end | ||
``` | ||
|
||
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) | ||
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can | ||
be found at <https://hexdocs.pm/atproto>. | ||
Run `mix deps.get` to install it. | ||
|
||
## Getting Started | ||
|
||
### 1. Setting Up a Simple Query | ||
|
||
```elixir | ||
defmodule MyApp.ProfileFetcher do | ||
alias ProtoRune.Session | ||
alias ProtoRune.Bsky.Actor.Defs.Profile | ||
|
||
@spec get_profile(Session.t, actor: String.t) :: {:ok, Profile.t} | {:error, term} | ||
def get_profile(%Session{} = session, actor: actor) do | ||
ProtoRune.Bsky.Actor.get_profile(session, actor: actor) | ||
end | ||
end | ||
``` | ||
|
||
### 2. Creating a Bot | ||
|
||
```elixir | ||
defmodule MyBot do | ||
use ProtoRune.Bot | ||
|
||
@impl true | ||
def handle_message(%{text: "Hello"}) do | ||
"Hi there!" | ||
end | ||
end | ||
``` | ||
|
||
### 3. Building Moderation Tools | ||
|
||
```elixir | ||
defmodule MyModerator do | ||
use ProtoRune.Moderator | ||
|
||
def label_inappropriate_content(content) do | ||
# Custom logic to label content | ||
ProtoRune.Label.apply_label(content, :inappropriate) | ||
end | ||
end | ||
``` | ||
|
||
## Dynamic Schema Generation | ||
|
||
ProtoRune includes tools for dynamically generating Elixir modules for ATProto schemas: | ||
|
||
1. **Generate Schemas from defs.json** | ||
- Use the built-in Mix task to generate Elixir structs and typespecs for the schemas defined in the `defs.json` file. | ||
```bash | ||
mix proto_rune.gen.schemas | ||
``` | ||
|
||
2. **Customizable Structs and Typespecs** | ||
- ProtoRune generates user-friendly typespecs for all query and procedure parameters, ensuring type safety and ease of use. | ||
|
||
## Contributing | ||
|
||
1. Fork the repository. | ||
2. Create your feature branch (`git checkout -b feature/my-feature`). | ||
3. Commit your changes (`git commit -am 'Add new feature'`). | ||
4. Push to the branch (`git push origin feature/my-feature`). | ||
5. Create a new pull request. | ||
|
||
## License | ||
|
||
ProtoRune is licensed under the MIT License. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule ProtoRune.Application do | ||
# See https://hexdocs.pm/elixir/Application.html | ||
# for more information on OTP Applications | ||
@moduledoc false | ||
|
||
use Application | ||
|
||
@impl true | ||
def start(_type, _args) do | ||
children = [] | ||
|
||
opts = [strategy: :one_for_one, name: ProtoRune.Supervisor] | ||
Supervisor.start_link(children, opts) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule Atproto.Session do | ||
defmodule ProtoRune.Atproto.Session do | ||
@moduledoc false | ||
|
||
@t %{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/bsky/chat/moderation.ex → lib/proto_rune/bsky/chat/moderation.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/bsky/notification.ex → lib/proto_rune/bsky/notification.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule Bsky.Profile do | ||
defmodule ProtoRune.Bsky.Profile do | ||
@moduledoc false | ||
|
||
defstruct [:handle, :did] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule XRPC.Case do | ||
defmodule ProtoRune.XRPC.Case do | ||
@moduledoc """ | ||
Yeah, in house string casing | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.