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 cdf042d79d docs: reworked README
Signed-off-by: SoXX <soxx@fenpa.ws>
2023-11-15 15:07:35 +01:00
.idea/runConfigurations refactor: tests use premade json files to test against. 2023-10-24 16:28:24 +02:00
example feat: added partial implementation for low, mid and high level api for db exports 2023-11-15 13:21:13 +01:00
pkg/e621 docs: added more & unified documentation format 2023-11-15 14:41:16 +01:00
tests refactor: tests use premade json files to test against. 2023-10-24 16:28:24 +02:00
.editorconfig initial commit 2023-10-16 15:56:00 +02:00
.gitignore refactor: tests use premade json files to test against. 2023-10-24 16:28:24 +02:00
go.mod feat: added partial implementation for low, mid and high level api for db exports 2023-11-15 13:21:13 +01:00
go.sum feat: added partial implementation for low, mid and high level api for db exports 2023-11-15 13:21:13 +01:00
README.md docs: reworked README 2023-11-15 15:07:35 +01:00
README.md.OLD docs: reworked README 2023-11-15 15:07:35 +01:00

Go-e621 SDK

An unofficial e621 SDK (Client) library to interact with e621, e923 and e6ai.
Maintained by the Anthrove Development Team.

Table of Contents

Installation

Include instructions on how to install or get your Golang client API. This might include:

go get -u git.dragse.it/anthrove/e621-sdk-go

Usage

package main

import (
    "git.dragse.it/anthrove/e621-sdk-go/pkg/e621"
    "log"
)

func main() {

    ApiUser := ""
    ApiKey := ""
    e621User := ""

    client := e621.NewClient(ApiUser, ApiKey)
    user, err := client.GetUserByName(e621User).Execute()
    if err != nil {
        log.Panic(err)
    }
    log.Printf("User ID of user %s: %d ", user.Name, user.ID)
}

Examples

This SDK Supports three levels of usage, Low Level, Mid Level & High Level.

All of those are available to you, you find some examples in the example directory.

High Level:

package main

import (
    "git.dragse.it/anthrove/e621-sdk-go/pkg/e621"
    "log"
)

func main() {

    ApiUser := ""
    ApiKey := ""
    e621User := ""

    client := e621.NewClient(ApiUser, ApiKey)
    user, err := client.GetUserByName(e621User).Execute()
    if err != nil {
        log.Panic(err)
    }
    log.Printf("User ID of user %s: %d ", user.Name, user.ID)
}

Mid Level:

package main

import (
    "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/builder"
    "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
    "log"
    "net/http"
)

func main() {
    // Define the request context with essential information.
    requestContext := model.RequestContext{
        Client:    http.Client{},
        Host:      "https://e621.net",
        UserAgent: "Go-e621-SDK (@username)",
        Username:  "API_USER", // Replace with your username
        APIKey:    "API_KEY",  // Replace with your API key
    }

    // Specify the username for retrieval.
    username := "" // Replace with the desired username.

    // Call the GetUser function to retrieve the specified user.
    userBuilder := builder.NewGetUserBuilder(requestContext)
    user, err := userBuilder.SetUsername(username).Execute()

    if err != nil {
        panic(err)
    }

    log.Printf("User ID of user %s: %d ", user.Name, user.ID)

}

Low Level:

package main

import (
    "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/endpoints"
    "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
    "log"
    "net/http"
)

func main() {
    // Define the request context with essential information.
    requestContext := model.RequestContext{
        Client:    http.Client{},
        Host:      "https://e621.net",
        UserAgent: "Go-e621-SDK (@username)",
        Username:  "API_USER", // Replace with your username
        APIKey:    "API_KEY",  // Replace with your API key
    }

    // Specify the username for retrieval.
    username := "" // Replace with the desired username.

    // Call the GetUser function to retrieve the specified user.
    user, err := endpoints.GetUser(requestContext, username)

    if err != nil {
        panic(err)
    }

    log.Printf("User ID of user %s: %d ", user.Name, user.ID)
}

Feature Completeness

Legend

Symbol Meaning
Not implemented
Partially implemented
✔️ Fully implemented

High Level API

Area Complete Comment
Authentication ✔️
Posts
Tags
Tag aliases
Tag implications
Notes
Pools
Users ✔️
Favorites
DB export

Mid Level API

Area Get Set
Authentication ✔️
Posts ✔️
Tags ✔️
Tag aliases
Tag implications
Notes ✔️
Pools ✔️
Users ✔️
Favorites ✔️
DB export ✔️

Low Level API

Area Get Set
Authentication ✔️
Posts ✔️
Tags ✔️
Tag aliases
Tag implications
Notes ✔️
Pools ✔️
Users ✔️
Favorites ✔️
DB export ✔️