Go to file
2024-08-24 23:50:02 +02:00
.gitea/workflows migration from old git (no git history) 2024-07-19 15:28:48 +02:00
pkg fix: Fix error handling for source retrieval in Listen method 2024-08-24 23:50:02 +02:00
scripts migration from old git (no git history) 2024-07-19 15:28:48 +02:00
third_party/grpc-proto fix: change old git urls to anthrove urls 2024-07-19 21:57:14 +02:00
.gitignore migration from old git (no git history) 2024-07-19 15:28:48 +02:00
.gitmodules refactor: changed protobuf git repository path 2024-07-19 21:30:26 +02:00
go.mod refactor(source): function header 2024-08-17 20:23:11 +02:00
go.sum refactor(source): function header 2024-08-17 20:23:11 +02:00
README.md fix(module): Update SDK import paths to use correct casing 2024-08-14 16:16:42 +02:00
sonar-project.properties migration from old git (no git history) 2024-07-19 15:28:48 +02: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.anthrove.art/Anthrove/plug-sdk/v3

Usage

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

import "git.anthrove.art/Anthrove/plug-sdk/v3/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)
}