From 931cdc04b024018e3b306cf30a8037ad8b4e0b7f Mon Sep 17 00:00:00 2001 From: soxx Date: Tue, 20 Feb 2024 21:20:33 +0100 Subject: [PATCH] docs: added basic docs --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..95ba089 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# 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 graph 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: + +```bash +go get git.dragse.it/anthrove/plug-sdk +``` +## Usage + +Below is a basic example of how to use the SDK: + +````go +package main + +import ( + "context" + "git.dragse.it/anthrove/plug-sdk/pkg/otter" + "log" + "net" + "git.dragse.it/anthrove/otter-space-sdk/pkg/graph" + "git.dragse.it/anthrove/otter-space-sdk/pkg/models" + "git.dragse.it/anthrove/plug-sdk/pkg/plug" +) + +func main() { + var ctx context.Context + + // Initialize a new server + server := plug.NewServer(ctx, "localhost", "8080") + + graph := otter.ConnectToDatabase(ctx, "endpoint", "username", "password", false) + + // Set the graph database connection + server.WithGraphConnection(graph) + + // Set the task execution function + server.TaskExecutionFunction(taskExecution) + + // Listen for connections + if err := server.Listen(); err != nil { + log.Fatalf("Failed to listen: %v", err) + } +} + +func taskExecution(ctx context.Context, graph graph.OtterSpace, sourceUsername string, anthroveUser models.AnthroveUser, deepScrape bool, cancelFunction func()) error { + // SOME EXECUTION MAGIC +} + +````