behindthename

package
v0.0.0-...-9c49dea Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Lookup(ctx context.Context, name string) (result []byte, err error)
	RandomName(ctx context.Context) (result []byte, err error)
	RelatedNames(ctx context.Context, name string) (result []byte, err error)
}

Client is an interface to behindthenames api

type ClientImpl

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

ClientImpl is an implementation of the poeditor client interface

func NewClient

func NewClient(apiToken string, httpClient *http.Client) *ClientImpl

NewClient creates a new poeditor api client

func (*ClientImpl) Lookup

func (c *ClientImpl) Lookup(ctx context.Context, name string, params LookupParams) (*LookupResponse, error)

Lookup will return information about a given name. https://www.behindthename.com/api/help.php

func (*ClientImpl) RandomName

func (c *ClientImpl) RandomName(ctx context.Context, params RandomNameParameters) (*RandomNameResponse, error)

RandomName will return a random name. https://www.behindthename.com/api/help.php

func (*ClientImpl) RelatedNames

func (c *ClientImpl) RelatedNames(ctx context.Context, name string, params RelatedNamesParameters) (*RelatedNamesResponse, error)

RelatedNames will return potential aliases for a given name. https://www.behindthename.com/api/help.php

type ErrResponse

type ErrResponse struct {
	ErrorCode int    `json:"error_code,omitempty" yaml:"error_code,omitempty"`
	Error     string `json:"error,omitempty" yaml:"error,omitempty"`
}

type LookupParams

type LookupParams struct {
	Exact bool
}

type LookupResponse

type LookupResponse []LookupResponseElement

type LookupResponseElement

type LookupResponseElement struct {
	Name   string  `json:"name"`
	Gender string  `json:"gender"`
	Usages []Usage `json:"usages"`
}

type RandomNameParameters

type RandomNameParameters struct {
	Gender        string
	Usage         string
	Number        int
	RandomSurname bool
}

type RandomNameResponse

type RandomNameResponse struct {
	ErrorCode int      `json:"error_code,omitempty" yaml:"error_code,omitempty"`
	Error     string   `json:"error,omitempty" yaml:"error,omitempty"`
	Names     []string `json:"names,omitempty" yaml:"names,omitempty"`
}

func (*RandomNameResponse) GetNames

func (r *RandomNameResponse) GetNames() []string

type RelatedNamesParameters

type RelatedNamesParameters struct {
	Gender string
	Usage  string
}

type RelatedNamesResponse

type RelatedNamesResponse struct {
	ErrorCode int      `json:"error_code,omitempty" yaml:"error_code,omitempty"`
	Error     string   `json:"error,omitempty" yaml:"error,omitempty"`
	Names     []string `json:"names,omitempty" yaml:"names,omitempty"`
}

func (*RelatedNamesResponse) GetNames

func (r *RelatedNamesResponse) GetNames() []string

type Usage

type Usage struct {
	UsageCode   string `json:"usage_code"`
	UsageFull   string `json:"usage_full"`
	UsageGender string `json:"usage_gender"`
}

Jump to

Keyboard shortcuts

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