saucenao

package module
Version: v0.0.0-...-8556911 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package saucenao provides a wrapper to saucenao.coms' json api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ResultsService *ResultsService
}

Client for saucenao

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new Client

type Results

type Results struct {
	Header struct {
		Similarity string `json:"similarity"`
		Thumbnail  string `json:"thumbnail"`
		IndexID    int    `json:"index_id"`
		IndexName  string `json:"index_name"`
	} `json:"header,omitempty"`
	Data struct {
		DeviantartID   int `json:"da_id,omitempty"`
		GelbooruID     int `json:"gelbooru_id,omitempty"`
		YandereID      int `json:"yandere_id,omitempty"`
		PixivID        int `json:"pixiv_id,omitempty"`
		DanbooruID     int `json:"danbooru_id,omitempty"`
		SeigaID        int `json:"seiga_id,omitempty"`
		E621ID         int `json:"e621_id,omitempty"`
		SankakuID      int `json:"sankaku_id,omitempty"`
		MemberID       int `json:"member_id,omitempty"`
		AnidbAID       int `json:"anidb_aid,omitempty"`
		PawooID        int `json:"pawoo_id,omitempty"`
		MangadexID     int `json:"md_id,omitempty"`
		MangaUpdatesID int `json:"mu_id,omitempty"`
		MemberLinkID   int `json:"member_link_id,omitempty"`

		AuthorName string      `json:"author_name,omitempty"`
		AuthorURL  string      `json:"author_url,omitempty"`
		MemberName string      `json:"member_name,omitempty"`
		Title      string      `json:"title,omitempty"`
		ExtURLS    []string    `json:"ext_urls"`
		Creator    interface{} `json:"creator,omitempty"`
		Material   interface{} `json:"material,omitempty"`
		Source     interface{} `json:"source,omitempty"`
		Characters interface{} `json:"characters,omitempty"`
		Part       string      `json:"part,omitempty"`
		Year       string      `json:"year,omitempty"`
		EstTime    string      `json:"est_time,omitempty"`
		CreatedAt  time.Time   `json:"created_at,omitempty"`

		PawooUserAcct        string      `json:"pawoo_user_acct,omitempty"`
		PawooUserUsername    string      `json:"pawoo_user_username,omitempty"`
		PawooUserDisplayName string      `json:"pawoo_user_display_name,omitempty"`
		Type                 interface{} `json:"type,omitempty"`
		BcyType              string      `json:"bcy_type,omitempty"`
		EngName              string      `json:"eng_name,omitempty"`
		JpName               string      `json:"jp_name,omitempty"`
	} `json:"data,omitempty"`
}

Results is data returned about search results from saucenao

type ResultsService

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

ResultsService is a method to get results from saucenao

func NewResultsService

func NewResultsService(httpClient *http.Client) *ResultsService

NewResultsService returns a new ResultsService.

func (*ResultsService) ImageSearchByFile

func (s *ResultsService) ImageSearchByFile(apiKey string, numResults int, filePath string) (SauceResults, *http.Response, error)

ImageSearchByFile searches saucenao by file upload and returns results If numResults is set to 0 it defaults to defaultResults @param apiKey string @param numResults int @param filePath string @return SauceResults *http.Response error

func (*ResultsService) ImageSearchByInterface

func (s *ResultsService) ImageSearchByInterface(apiKey string, numResults int, file io.Reader, fileName string) (SauceResults, *http.Response, error)

ImageSearchByInterface searches saucenao by file upload and returns results If numResults is set to 0 it defaults to defaultResults @param apiKey string @param numResults int @param file io.Reader @param fileName name of file string @return SauceResults *http.Response error

func (*ResultsService) ImageSearchByURL

func (s *ResultsService) ImageSearchByURL(apiKey string, numResults int, uri string) (SauceResults, *http.Response, error)

ImageSearchByURL searches saucenao by url and returns results If numResults is set to 0 it defaults to defaultResults @param apiKey string @param uri string @param numResults int @return SauceResults @return *http.Response @return error

type SauceResults

type SauceResults struct {
	// Header contains information about user, api limits, and indexes.
	Header struct {
		UserID           interface{} `json:"user_id,omitempty"`
		AccountType      interface{} `json:"account_type,omitempty"`
		ShortLimit       string      `json:"short_limit"`
		LongLimit        string      `json:"long_limit"`
		LongRemaining    int         `json:"long_remaining"`
		ShortRemaining   int         `json:"short_remaining"`
		Status           int         `json:"status"`
		ResultsRequested int         `json:"results_requested"`

		Index struct {
			Status   int `json:"status"`
			ParentID int `json:"parent_id"`
			ID       int `json:"id"`
			Results  int `json:"results"`
		} `json:"index,omitempty"`

		SearchDepth       string  `json:"search_depth"`
		MinimumSimilarity float64 `json:"minimum_similarity"`
		QueryImageDisplay string  `json:"query_image_display"`
		QueryImage        string  `json:"query_image"`
		ResultsReturned   int     `json:"results_returned"`
	} `json:"header"`
	// Results is data returned about search results from saucenao
	Results []Results `json:"results"`
}

SauceResults is the results of a query to api

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL