Giter Club home page Giter Club logo

lotr-sdk's Introduction

Lord of the Rings SDK

This is a Go SDK for The One API, a Lord of the Rings API. It provides an lightweight Go wrapper around the /movie , /quote and /character end points. The One API can be found here: https://the-one-api.dev/.

Installation

go get github.com/adam-macioszek/lotr-sdk

Requirements

go 1.20 valid API key for The One API

Usage

The SDK currently sources your API key from your local enviornment, on a mac or linux machine this should do the trick:

export $LOTR_API_KEY=<your-api-key>

To use the SDK

"github.com/adam-macioszek/lotr-sdk/pkg/movie"
"github.com/adam-macioszek/lotr-sdk/pkg/quote"

//Get All movies and print ID and Name for each movie
movies, err := movie.GetMovies()
	if err != nil {
		log.Println(err)
	}
	for _, movie := range movies {
		log.Println(movie.ID, movie.Name)
	}

//Get a quote by id and print the quote dialog
quoteId := "5cd96e05de30eff6ebccebb1"
testQuote, err := quote.GetQuoteByID(quoteId)
if err != nil {
    log.Println(err)
}
log.Println(testQuote.Dialog)

Testing

  • There is some basic testing done in the tests folder. This is very basic and simply meant to validate the general functionality of the sdk. I could definitly be add some table test to have better coverage over the functions.One particular are of improvement is the various parts of request process, i.e getting various status codes. To run the tests navigate the to the /tests/folder and run
go test -v

lotr-sdk's People

Contributors

adam-macioszek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.