bitpic

package
v0.3.28 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package bitpic interfaces with unwriter's "bitpic.network" Read more at: https://bitpic.network/about

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultImage string             // custom default image (if no image is found)
	Network      = bitPicURL        // override the default network
	UserAgent    = defaultUserAgent // override the default user agent
)

Override the package defaults

Functions

func URL added in v0.3.2

func URL(alias, domain string) string

URL will return an HTTP url for the bitpic avatar using alias and domain Specs: https://bitpic.network/about

func URLFromPaymail added in v0.3.2

func URLFromPaymail(paymail string) string

URLFromPaymail will return an HTTP url for the bitpic avatar using a paymail Specs: https://bitpic.network/about

Types

type Data added in v0.1.11

type Data struct {
	BitFs   string `json:"bitfs"`
	Paymail string `json:"paymail"`
	URI     string `json:"uri"`
}

Data is the required bitpic information

type Meta added in v0.1.11

type Meta struct {
	Content     string `json:"content"`
	Description string `json:"description"`
	Image       string `json:"image"`
	Title       string `json:"title"`
	URL         string `json:"url"`
}

Meta is additional information

type Post added in v0.1.11

type Post struct {
	CreatedAt string      `json:"created_at"`
	Data      *Data       `json:"data"`
	Message   string      `json:"message"`
	Meta      *Meta       `json:"meta"`
	Name      string      `json:"name"`
	Tags      interface{} `json:"tags"`
	TxID      string      `json:"tx_id"`
}

Post is a BitPic post

type Response

type Response struct {
	Found      bool            `json:"found"`       // Flag if the bitpic was found
	StatusCode int             `json:"status_code"` // Status code returned on the request
	Tracing    resty.TraceInfo `json:"tracing"`     // Trace information if enabled on the request
	URL        string          `json:"url"`         // The bitpic url for the image
}

Response is the standard fields returned on all responses

func GetPic

func GetPic(alias, domain string, tracing bool) (response *Response, err error)

GetPic will check if a bitpic exists for the given paymail address and fetch the url if found Specs: https://bitpic.network/about

type SearchResponse added in v0.1.11

type SearchResponse struct {
	Result     *SearchResult   `json:"result"`      // Result from BitPics
	StatusCode int             `json:"status_code"` // Status code returned on the request
	Tracing    resty.TraceInfo `json:"-"`           // Trace information if enabled on the request
}

SearchResponse is the response from /search

func Search(alias, domain string, tracing bool) (response *SearchResponse, err error)

Search will perform a search on the BitPic network https://txt.bitpic.network/search/json?text=alias@domain

type SearchResult added in v0.1.11

type SearchResult struct {
	Posts []*Post `json:"posts"`
	Query string  `json:"query"`
}

SearchResult is the child of the response

Jump to

Keyboard shortcuts

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