poego

package module
v0.0.0-...-8e51b84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

poe-go

poe.com Golang API. Base on web API.

Why not graphQL?

Because it's Golang!

Documentation

Index

Constants

View Source
const (
	GraphQLPOSTURL = "https://poe.com/api/gql_POST"
	GraphQLRecvURL = "https://poe.com/api/receive_POST"
	HomeURL        = "https://poe.com"
	SettingsURL    = "https://poe.com/api/settings"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatInputMetadata

type ChatInputMetadata struct {
	UseVoiceRecord bool `json:"useVoiceRecord"`
}

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

Client poego client do every request

func New

func New(conf *Config) *Client

NewClient new poe-go client

func NewWithHTTPClient

func NewWithHTTPClient(conf *Config, cli *http.Client) *Client

type Config

type Config struct {
	// Log into Poe on any desktop web browser, then open your browser's developer tools (also known as "inspect") and look for the value of the p-b cookie in the following menus:
	// Chromium: Devtools > Application > Cookies > poe.com
	// Firefox: Devtools > Storage > Cookies
	// Safari: Devtools > Storage > Cookies
	Token string
	// The device ID to use. If this is not specified, it will be randomly generated and stored on the disk.
	DeviceID string

	// The headers to use. This defaults to the headers specified in
	// poego.Headers
	Headers []string

	Proxy string // TODO
}

Config poe-go config struct

type Extensions

type Extensions struct {
	Hash string `json:"hash"`
}

type GraphQLPostPayload

type GraphQLPostPayload struct {
	QueryName  string      `json:"queryName"`
	Variables  interface{} `json:"variables"`
	Extensions Extensions  `json:"extensions"`
}

type SendMessageArgs

type SendMessageArgs struct {
	ChatID        int           `json:"chatId"`
	Bot           string        `json:"bot"`
	Query         string        `json:"query"`
	Source        Source        `json:"source"`
	WithChatBreak bool          `json:"withChatBreak"`
	ClientNonce   string        `json:"clientNonce"`
	Sdid          string        `json:"sdid"`
	Attachments   []interface{} `json:"attachments"`
}

type Source

type Source struct {
	SourceType        SourceType        `json:"sourceType"`
	ChatInputMetadata ChatInputMetadata `json:"chatInputMetadata"`
}

type SourceType

type SourceType string

SourceTypeChatInput

const SourceTypeChatInput SourceType = "chat_input"

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip implement http.RoundTripper

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL