This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
SoXX 521c11ee2e
All checks were successful
Gitea Build Check / Build (push) Successful in 9m49s
Update README.md
2024-07-08 13:43:02 +00:00
.gitea/workflows ci: ignore generated grpc files 2024-07-08 15:29:14 +02:00
pkg feat: updated module name 2024-07-08 15:16:59 +02:00
scripts feat: updated protobuf files 2024-07-06 22:08:19 +02:00
third_party feat: updated to latest protobuf 2024-07-07 00:43:21 +02:00
.gitignore fix: added protoc files 2024-02-20 21:21:41 +01:00
.gitmodules feat: updated to latest protobuf 2024-07-07 00:42:00 +02:00
go.mod feat: dependencies 2024-07-08 15:19:03 +02:00
go.sum feat: dependencies 2024-07-08 15:19:03 +02:00
README.md Update README.md 2024-07-08 13:43:02 +00:00

Anthrove Plug SDK

Anthrove Plug SDK is a Golang-based Software Development Kit (SDK) that provides a gRPC server implementation for the Anthrove system. This SDK enables users to easily set up a server, establish a database connection, and set a task execution function.

Installation

To install the Anthrove Plug SDK, you will need to have Go installed on your system. You can then use the go get command to fetch the SDK:

go get git.dragse.it/anthrove/plug-sdk/v2

Usage

Below is a basic example of how to use the SDK:

import "git.dragse.it/anthrove/plug-sdk/v2/pkg/plug"

// Define what Source this Plug is used for
source := models.Source{
    DisplayName: "e621",
    Domain:      "e621.net",
    Icon:        "e621.net/icon.png",
}

// Create a new Plug instance
p := plug.NewPlug(ctx, "localhost", "50051", source)

// Set the OtterSpace database
p.WithOtterSpace(database)

// Set the task execution function
p.TaskExecutionFunction(func(ctx context.Context, database database.OtterSpace, sourceUsername string, anthroveUser models.User, deepScrape bool, apiKey string, cancelFunction func()) error {
// Your task execution logic here
})

// Set the send message execution function
p.SendMessageExecution(func(ctx context.Context, userSourceID string, message string) error {
// Your message sending logic here
})

// Start the server
err := p.Listen()
    if err != nil {
    log.Fatalf("Failed to start server: %v", err)
}