2023-10-16 13:56:00 +00:00
|
|
|
# Go-e621 SDK
|
|
|
|
|
2023-11-15 14:07:35 +00:00
|
|
|
An unofficial e621 SDK (Client) library to interact with **e621**, **e923** and **e6ai**.
|
|
|
|
Maintained by the Anthrove Development Team.
|
2023-10-16 13:56:00 +00:00
|
|
|
|
2023-11-15 14:07:35 +00:00
|
|
|
## Table of Contents
|
2023-10-24 13:10:39 +00:00
|
|
|
|
2023-11-15 14:07:35 +00:00
|
|
|
- [Installation](#installation)
|
|
|
|
- [Usage](#usage)
|
|
|
|
- [Examples](#examples)
|
|
|
|
- [Feature Completeness](#feature-completeness)
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
Include instructions on how to install or get your Golang client API. This might include:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
go get -u git.dragse.it/anthrove/e621-sdk-go
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```golang
|
|
|
|
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:
|
|
|
|
|
|
|
|
````go
|
|
|
|
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:
|
|
|
|
|
|
|
|
````go
|
|
|
|
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:
|
|
|
|
|
|
|
|
````go
|
|
|
|
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
|
2023-10-16 13:56:00 +00:00
|
|
|
|
|
|
|
_Legend_
|
|
|
|
|
|
|
|
| Symbol | Meaning |
|
|
|
|
|:------------------:|:----------------------|
|
|
|
|
| :x: | Not implemented |
|
|
|
|
| :heavy_minus_sign: | Partially implemented |
|
|
|
|
| :heavy_check_mark: | Fully implemented |
|
|
|
|
|
|
|
|
_High Level API_
|
|
|
|
|
2023-11-07 10:28:16 +00:00
|
|
|
| Area | Complete | Comment |
|
|
|
|
|:-----------------|:------------------:|:--------|
|
2023-11-15 14:07:35 +00:00
|
|
|
| Authentication | :heavy_check_mark: | |
|
2023-11-07 10:28:16 +00:00
|
|
|
| Posts | :heavy_minus_sign: | |
|
|
|
|
| Tags | :heavy_minus_sign: | |
|
|
|
|
| Tag aliases | :x: | |
|
|
|
|
| Tag implications | :x: | |
|
|
|
|
| Notes | :x: | |
|
|
|
|
| Pools | :x: | |
|
|
|
|
| Users | :heavy_check_mark: | |
|
|
|
|
| Favorites | :heavy_minus_sign: | |
|
|
|
|
| DB export | :x: | |
|
2023-10-16 13:56:00 +00:00
|
|
|
|
2023-10-23 08:21:51 +00:00
|
|
|
_Mid Level API_
|
|
|
|
|
|
|
|
| Area | Get | Set |
|
|
|
|
|:-----------------|:------------------:|:----|
|
2023-11-15 14:07:35 +00:00
|
|
|
| Authentication | :heavy_check_mark: | |
|
2023-10-23 11:15:55 +00:00
|
|
|
| Posts | :heavy_check_mark: | |
|
|
|
|
| Tags | :heavy_check_mark: | |
|
2023-10-23 08:21:51 +00:00
|
|
|
| Tag aliases | :x: | |
|
|
|
|
| Tag implications | :x: | |
|
2023-10-23 14:02:28 +00:00
|
|
|
| Notes | :heavy_check_mark: | |
|
2023-10-23 12:27:20 +00:00
|
|
|
| Pools | :heavy_check_mark: | |
|
2023-10-23 08:21:51 +00:00
|
|
|
| Users | :heavy_check_mark: | |
|
2023-10-23 14:02:28 +00:00
|
|
|
| Favorites | :heavy_check_mark: | |
|
2023-11-15 14:07:35 +00:00
|
|
|
| DB export | :heavy_check_mark: |
|
2023-10-23 08:21:51 +00:00
|
|
|
|
2023-10-16 13:56:00 +00:00
|
|
|
_Low Level API_
|
|
|
|
|
2023-10-19 13:31:38 +00:00
|
|
|
| Area | Get | Set |
|
|
|
|
|:-----------------|:------------------:|:----|
|
2023-11-15 14:07:35 +00:00
|
|
|
| Authentication | :heavy_check_mark: | |
|
2023-10-19 13:31:38 +00:00
|
|
|
| Posts | :heavy_check_mark: | |
|
2023-10-19 14:12:56 +00:00
|
|
|
| Tags | :heavy_check_mark: | |
|
2023-10-19 13:31:38 +00:00
|
|
|
| Tag aliases | :x: | |
|
|
|
|
| Tag implications | :x: | |
|
|
|
|
| Notes | :heavy_check_mark: | |
|
|
|
|
| Pools | :heavy_check_mark: | |
|
|
|
|
| Users | :heavy_check_mark: | |
|
2023-10-19 14:12:56 +00:00
|
|
|
| Favorites | :heavy_check_mark: | |
|
2023-11-15 14:07:35 +00:00
|
|
|
| DB export | :heavy_check_mark: | |
|