Update README

This commit is contained in:
Agniva De Sarker 2016-06-15 12:37:45 +05:30 committed by GitHub
parent 44efcabb06
commit 783cdb77f5

View file

@ -17,17 +17,42 @@ I *strongly* encourage you to check it out and contribute to keep it growing.
*** ***
Project Usage Project Usage
------------- -------------
The API usage is very simple. Just import the go-imdb package The API usage is very simple.
import ( ```go
imdb "github.com/eefret/go-imdb" package main
)
And use any of the methods import (
"fmt"
"github.com/efret/gomdb"
)
func main() {
query := &gomdb.QueryData{Title: "Macbeth", SearchType: gomdb.MovieSearch}
res, err := gomdb.Search(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res.Search)
query = &gomdb.QueryData{Title: "Macbeth", Year: "2015"}
res2, err := gomdb.MovieByTitle(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res2)
res3, err := gomdb.MovieByImdbID("tt2884018")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res3)
}
```
res, err := imdb.Search("The fifth element", "")
res2, err := imdb.MovieByTitle("True Grit", "1969")
res3, err := imdb.MovieByImdbID("tt2015381")
See the project documentation to see the Response Objects and stuff See the project documentation to see the Response Objects and stuff