genius

package module
v0.0.0-...-b7f36c0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: BSD-3-Clause Imports: 2 Imported by: 1

README

Welcome to go-genius 👋 *** Work In Progress ***

GitHub code size in bytes GitHub go.mod Go version GitHub closed pull requests GitHub pull requests GitHub issues GitHub contributors

go-genius is a Go client library for accessing the Genius API

🚚 Install

go get github.com/tsirysndr/go-genius

🚀 Usage

Import the package into your project.

import "github.com/tsirysndr/go-genius"

Construct a new Genius client, then use the various services on the client to access different parts of the Genius API. For example:

client := genius.NewClient("<YOUR ACCESS TOKEN>")
res, _ := client.Search.Get("Kendrick Lamar")
hits, _ := json.Marshal(res)
fmt.Println(string(hits))

Coverage

Currently the following services are supported:

  • Search
  • Get artist
  • Get documents (songs) for the artist specified
  • Get referents
  • Get annotation
  • Get song
  • Web Pages

Author

👤 Tsiry Sandratraina

Show your support

Give a ⭐️ if this project helped you!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountService

type AccountService service

type Album

type Album struct {
	ApiPath     string  `json:"api_path,omitempty"`
	CoverArtURL string  `json:"cover_art_url,omitempty"`
	FullTitle   string  `json:"full_title,omitempty"`
	ID          int     `json:"id,omitempty"`
	Name        string  `json:"name,omitempty"`
	URL         string  `json:"url,omitempty"`
	Artist      *Artist `json:"artist,omitempty"`
}

type Annotation

type Annotation struct {
	ApiPath             string      `json:"api_path,omitempty"`
	Body                interface{} `json:"body,omitempty"`
	CommentCount        int         `json:"comment_count,omitempty"`
	Community           bool        `json:"community,omitempty"`
	CustomPreview       bool        `json:"custom_preview,omitempty"`
	HasVoters           bool        `json:"has_voters,omitempty"`
	ID                  int         `json:"id,omitempty"`
	Pinned              bool        `json:"pinned,omitempty"`
	ShareURL            string      `json:"share_url,omitempty"`
	Source              string      `json:"source,omitempty"`
	State               string      `json:"state,omitempty"`
	URL                 string      `json:"url,omitempty"`
	Verified            bool        `json:"verified,omitempty"`
	VotesTotal          int         `json:"votes_total,omitempty"`
	CurrentUserMetadata *struct {
		Permissions         []string `json:"permissions,omitempty"`
		ExcludedPermissions []string `json:"excluded_permissions,omitempty"`
		Interactions        *struct {
			Following bool `json:"following,omitempty"`
		} `json:"interactions,omitempty"`
	} `json:"current_user_metadata,omitempty"`
	Authors          []Author      `json:"authors,omitempty"`
	CosignedBy       []interface{} `json:"cosigned_by,omitempty"`
	RejectionComment string        `json:"rejection_comment,omitempty"`
	VerifiedBy       *User         `json:"verified_by,omitempty"`
	Referent         *Referent     `json:"referent,omitempty"`
}

type AnnotationsParams

type AnnotationsParams struct {
	TextFormat string `url:"text_format,omitempty"`
}

type AnnotationsService

type AnnotationsService service

func (*AnnotationsService) Get

func (s *AnnotationsService) Get(ID string) (*Annotation, error)

type ApiResponse

type ApiResponse struct {
	Meta *struct {
		Status int `json:"status,omitempty"`
	} `json:"meta,omitempty"`
	Response *struct {
		Annotation *Annotation `json:"annotation,omitempty"`
		Referents  []Referent  `json:"referents,omitempty"`
		Song       *Song       `json:"song,omitempty"`
		Artist     *Artist     `json:"artist,omitempty"`
		Hits       []Hit       `json:"hits,omitempty"`
	} `json:"response,omitempty"`
}

type Artist

type Artist struct {
	AlternateNames      []string    `json:"alternate_names,omitempty"`
	ApiPath             string      `json:"api_path,omitempty"`
	Description         interface{} `json:"description,omitempty"`
	FacebookName        string      `json:"facebook_name,omitempty"`
	FollowersCount      int         `json:"followers_count,omitempty"`
	HeaderImageURL      string      `json:"header_image_url,omitempty"`
	ID                  string      `json:"id,omitempty"`
	ImageURL            string      `json:"image_url,omitempty"`
	InstagramName       string      `json:"instagram_name,omitempty"`
	IsMemeVerified      bool        `json:"is_meme_verified,omitempty"`
	IsVerified          bool        `json:"is_verified,omitempty"`
	Name                string      `json:"name,omitempty"`
	TranslationArtist   bool        `json:"translation_artist,omitempty"`
	TwitterName         string      `json:"twitter_name,omitempty"`
	URL                 string      `json:"url,omitempty"`
	CurrentUserMetadata *struct {
		Permissions         []string `json:"permissions,omitempty"`
		ExcludedPermissions []string `json:"excluded_permissions,omitempty"`
		Interactions        *struct {
			Following bool `json:"following,omitempty"`
		} `json:"interactions,omitempty"`
	} `json:"current_user_metadata,omitempty"`
	IQ                    int `json:"iq,omitempty"`
	DescriptionAnnotation *struct {
		Type           string `json:"_type,omitempty"`
		AnnotatorID    int    `json:"annotator_id,omitempty"`
		AnnotatorLogin string `json:"annotator_login,omitempty"`
		ApiPath        string `json:"api_path,omitempty"`
		Classification string `json:"classification,omitempty"`
		Fragment       string `json:"fragment,omitempty"`
		ID             int    `json:"id,omitempty"`
		IsDescription  bool   `json:"is_description,omitempty"`
		Path           string `json:"path,omitempty"`
		Range          *struct {
			Content string `json:"content,omitempty"`
		} `json:"range,omitempty"`
		SongID               int    `json:"song_id,omitempty"`
		URL                  string `json:"url,omitempty"`
		VerifiedAnnotatorIDs []int  `json:"verified_annotator_ids,omitempty"`
		Annotatable          *struct {
			ApiPath   string `json:"api_path,omitempty"`
			Context   string `json:"context,omitempty"`
			ID        int    `json:"id,omitempty"`
			ImageURL  string `json:"image_url,omitempty"`
			LinkTitle string `json:"link_title,omitempty"`
			Title     string `json:"title,omitempty"`
			Type      string `json:"type,omitempty"`
			URL       string `json:"url,omitempty"`
		} `json:"annotatable,omitempty"`
		Annotations []Annotation `json:"annotations,omitempty"`
	} `json:"description_annotation,omitempty"`
	User *User `json:"user,omitempty"`
}

type ArtistParams

type ArtistParams struct {
	TextFormat string `url:"text_format,omitempty"`
}

type ArtistsService

type ArtistsService service

func (*ArtistsService) Get

func (s *ArtistsService) Get(ID string) (*Artist, error)

type Author

type Author struct {
	Attribution int    `json:"attribution,omitempty"`
	PinnedRole  string `json:"pinned_role,omitempty"`
	User        *User  `json:"user,omitempty"`
}

type Client

type Client struct {
	Account     *AccountService
	Annotations *AnnotationsService
	Artists     *ArtistsService
	Referents   *ReferentsService
	Search      *SearchService
	Songs       *SongsService
	WebPages    *WebPagesService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(accessToken string) *Client

type Hit

type Hit struct {
	HighLights interface{} `json:"highlights,omitempty"`
	Index      string      `json:"string,omitempty"`
	Type       string      `json:"type,omitempty"`
	Result     *struct {
		AnnotationCount          int    `json:"annotation_count,omitempty"`
		ApiPath                  string `json:"api_path,omitempty"`
		FullTitle                string `json:"full_title,omitempty"`
		HeaderImageThumbnailURL  string `json:"header_image_thumbnail_url,omitempty"`
		ID                       int    `json:"id,omitempty"`
		LyricsOwnerID            int    `json:"lyrics_owner_id,omitempty"`
		LyricsState              string `json:"lyrics_state,omitempty"`
		Path                     string `json:"path,omitempty"`
		PyongsCount              int    `json:"pyongs_count,omitempty"`
		SongArtImageThumbnailURL string `json:"song_art_image_thumbnail_url,omitempty"`
		SongArtImageURL          string `json:"song_art_image_url,omitempty"`
		Stats                    *struct {
			UnreviewedAnnotations int  `json:"unreviewed_annotations,omitempty"`
			Concurrents           int  `json:"concurrents,omitempty"`
			Hot                   bool `json:"hot,omitempty"`
			PageViews             int  `json:"page_views,omitempty"`
		} `json:"stats,omitempty"`
		Title             string  `json:"title,omitempty"`
		TitleWithFeatured string  `json:"title_with_featured,omitempty"`
		URL               string  `json:"url,omitempty"`
		PrimaryArtist     *Artist `json:"primary_artist,omitempty"`
	} `json:"result,omitempty"`
}

type Media

type Media struct {
	Provider string `json:"provider,omitempty"`
	Start    int    `json:"start,omitempty"`
	Type     string `json:"type,omitempty"`
	URL      string `json:"url,omitempty"`
}

type Referent

type Referent struct {
	Type           string `json:"_type,omitempty"`
	AnnotatorID    int    `json:"annotator_id,omitempty"`
	AnnotatorLogin string `json:"annotator_login,omitempty"`
	ApiPath        string `json:"api_path,omitempty"`
	Classification string `json:"classification,omitempty"`
	Featured       bool   `json:"featured,omitempty"`
	Fragment       string `json:"fragment,omitempty"`
	ID             int    `json:"id,omitempty"`
	IsDescription  bool   `json:"is_description,omitempty"`
	Path           string `json:"path,omitempty"`
	Range          *struct {
		Start       string `json:"start,omitempty"`
		StartOffset string `json:"startOffset,omitempty"`
		End         string `json:"end,omitempty"`
		EndOffset   string `json:"endOffset,omitempty"`
		Before      string `json:"before,omitempty"`
		After       string `json:"after,omitempty"`
		Content     string `json:"content,omitempty"`
	} `json:"range,omitempty"`
	SongID               int    `json:"song_id,omitempty"`
	URL                  string `json:"url,omitempty"`
	VerifiedAnnotatorIDs []int  `json:"verified_annotator_ids,omitempty"`
	Annotatable          *struct {
		ApiPath   string `json:"api_path,omitempty"`
		Context   string `json:"context,omitempty"`
		ID        int    `json:"id,omitempty"`
		ImageURL  string `json:"image_url,omitempty"`
		LinkTitle string `json:"link_title,omitempty"`
		Title     string `json:"title,omitempty"`
		Type      string `json:"type,omitempty"`
		URL       string `json:"url,omitempty"`
	} `json:"annotatable,omitempty"`
	Annotations []Annotation `json:"annotations,omitempty"`
}

type ReferentsParams

type ReferentsParams struct {
	WebPageID   int    `url:"web_page_id,omitempty"`
	CreatedByID int    `url:"create_by_id,omitempty"`
	SongID      int    `url:"song_id,omitempty"`
	TextFormat  string `url:"text_format,omitempty"`
}

type ReferentsService

type ReferentsService service

func (*ReferentsService) GetBySongID

func (s *ReferentsService) GetBySongID(ID int) ([]Referent, error)

func (*ReferentsService) GetByUserID

func (s *ReferentsService) GetByUserID(ID int) ([]Referent, error)

func (*ReferentsService) GetByWebPageID

func (s *ReferentsService) GetByWebPageID(ID int) ([]Referent, error)

type SearchParams

type SearchParams struct {
	Q string `url:"q,omitempty"`
}

type SearchService

type SearchService service

func (*SearchService) Get

func (s *SearchService) Get(q string) ([]Hit, error)

type Song

type Song struct {
	AnnotationCount          int         `json:"annotation_count,omitempty"`
	ApiPath                  string      `json:"api_path,omitempty"`
	AppleMusicID             string      `json:"apple_music_id,omitempty"`
	AppleMusicPlayerURL      string      `json:"apple_music_player_url,omitempty"`
	Description              interface{} `json:"description,omitempty"`
	EmbedContent             string      `json:"embed_content,omitempty"`
	FeaturedVideo            bool        `json:"featured_video,omitempty"`
	FullTitle                string      `json:"full_title,omitempty"`
	HeaderImageThumbnailURL  string      `json:"header_image_thumbnail_url,omitempty"`
	HeaderImageURL           string      `json:"header_image_url,omitempty"`
	ID                       int         `json:"id,omitempty"`
	LyricsOwnerID            int         `json:"lyrics_owner_id,omitempty"`
	LyricsState              string      `json:"lyrics_state,omitempty"`
	Path                     string      `json:"path,omitempty"`
	PyongsCount              int         `json:"pyongs_count,omitempty"`
	SongArtImageThumbnailURL string      `json:"song_art_image_thumbnail_url,omitempty"`
	SongArtImageURL          string      `json:"song_art_image_url,omitempty"`
	Stats                    *struct {
		UnreviewedAnnotations int  `json:"unreviewed_annotations,omitempty"`
		Concurrents           int  `json:"concurrents,omitempty"`
		Hot                   bool `json:"hot,omitempty"`
		PageViews             int  `json:"page_views,omitempty"`
	} `json:"stats,omitempty"`
	Title               string `json:"title,omitempty"`
	TitleFeatured       string `json:"title_features,omitempty"`
	URL                 string `json:"url,omitempty"`
	CurrentUserMetadata *struct {
		Permissions         []string `json:"permissions,omitempty"`
		ExcludedPermissions []string `json:"excluded_permissions,omitempty"`
		Interactions        *struct {
			Following bool `json:"following,omitempty"`
		} `json:"interactions,omitempty"`
	} `json:"current_user_metadata,omitempty"`
	Album                 *Album        `json:"album,omitempty"`
	CustomPerformances    []interface{} `json:"cutom_performances,omitempty"`
	DescriptionAnnotation *struct {
		Type           string `json:"_type,omitempty"`
		AnnotatorID    int    `json:"annotator_id,omitempty"`
		AnnotatorLogin string `json:"annotator_login,omitempty"`
		ApiPath        string `json:"api_path,omitempty"`
		Classification string `json:"classification,omitempty"`
		Fragment       string `json:"fragment,omitempty"`
		ID             int    `json:"id,omitempty"`
		IsDescription  bool   `json:"is_description,omitempty"`
		Path           string `json:"path,omitempty"`
		Range          *struct {
			Content string `json:"content,omitempty"`
		} `json:"range,omitempty"`
		SongID               int    `json:"song_id,omitempty"`
		URL                  string `json:"url,omitempty"`
		VerifiedAnnotatorIDs []int  `json:"verified_annotator_ids,omitempty"`
		Annotatable          *struct {
			ApiPath   string `json:"api_path,omitempty"`
			Context   string `json:"context,omitempty"`
			ID        int    `json:"id,omitempty"`
			ImageURL  string `json:"image_url,omitempty"`
			LinkTitle string `json:"link_title,omitempty"`
			Title     string `json:"title,omitempty"`
			Type      string `json:"type,omitempty"`
			URL       string `json:"url,omitempty"`
		} `json:"annotatable,omitempty"`
		Annotations []Annotation `json:"annotations,omitempty"`
	} `json:"description_annotation,omitempty"`
	FeaturedArtists        []interface{}      `json:"featured_artists,omitempty"`
	LyricsMarkedCompleteBy interface{}        `json:"lyrics_marked_complete_by,omitempty"`
	Media                  []Media            `json:"media,omitempty"`
	PrimaryArtist          *Artist            `json:"primary_artist,omitempty"`
	ProducerArtists        []Artist           `json:"producer_artists,omitempty"`
	SongRelationships      []SongRelationship `json:"song_relationships,omitempty"`
	VerifiedAnnotationsBy  []interface{}      `json:"verified_annotations_by,omitempty"`
	VerifiedContributors   []interface{}      `json:"verified_contributors,omitempty"`
	VerifiedLyricsBy       []interface{}      `json:"verified_lyrics_by,omitempty"`
	WriterArtists          []Artist           `json:"writer_artists,omitempty"`
}

type SongParams

type SongParams struct {
	TextFormat string `url:"text_format,omitempty"`
}

type SongRelationship

type SongRelationship struct {
	Type  string `json:"type,omitempty"`
	Songs []Song `json:"songs,omitempty"`
}

type SongsService

type SongsService service

func (*SongsService) Get

func (s *SongsService) Get(ID string) (*Song, error)

type User

type User struct {
	ApiPath string `json:"api_path,omitempty"`
	Avatar  *struct {
		Tiny *struct {
			URL         string `json:"url,omitempty"`
			BoundingBox *struct {
				Width  int `json:"width,omitempty"`
				Height int `json:"height,omitempty"`
			} `json:"bounding_box,omitempty"`
		} `json:"tiny,omitempty"`
		Thumb *struct {
			URL         string `json:"url,omitempty"`
			BoundingBox *struct {
				Width  int `json:"width,omitempty"`
				Height int `json:"height,omitempty"`
			} `json:"bounding_box,omitempty"`
		} `json:"thumb,omitempty"`
		Small *struct {
			URL         string `json:"url,omitempty"`
			BoundingBox *struct {
				Width  int `json:"width,omitempty"`
				Height int `json:"height,omitempty"`
			} `json:"bounding_box,omitempty"`
		} `json:"small,omitempty"`
		Medium *struct {
			URL         string `json:"url,omitempty"`
			BoundingBox *struct {
				Width  int `json:"width,omitempty"`
				Height int `json:"height,omitempty"`
			} `json:"bounding_box,omitempty"`
		} `json:"medium,omitempty"`
	} `json:"avatar,omitempty"`
	HeaderImageURL              string `json:"header_image_url,omitempty"`
	HumanReadableRoleForDisplay string `json:"human_readable_role_for_display,omitempty"`
	ID                          int    `json:"id,omitempty"`
	IQ                          int    `json:"iq,omitempty"`
	Login                       string `json:"login,omitempty"`
	Name                        string `json:"string,omitempty"`
	RoleForDisplay              string `json:"role_for_display,omitempty"`
	URL                         string `json:"url,omitempty"`
	CurrentUserMetadata         *struct {
		Permissions         []string `json:"permissions,omitempty"`
		ExcludedPermissions []string `json:"excluded_permissions,omitempty"`
		Interactions        *struct {
			Following bool `json:"following,omitempty"`
		} `json:"interactions,omitempty"`
	} `json:"current_user_metadata,omitempty"`
}

type WebPage

type WebPage struct {
}

type WebPagesService

type WebPagesService service

Directories

Path Synopsis
example
annotations command
artists command
referents command
search command
songs command

Jump to

Keyboard shortcuts

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