An open API service indexing awesome lists of open source software.

https://github.com/testorg0373/t-omdb

Unofficial Dart library for interacting with OMDb API
https://github.com/testorg0373/t-omdb

Last synced: 6 months ago
JSON representation

Unofficial Dart library for interacting with OMDb API

Awesome Lists containing this project

README

          

# Unofficial Dart library for interacting with OMDb API
For questions or help ask here. File issues here and see pub.dev page here.

## Todo list
- Posters API
- Tests

## Getting started

### Add dependency
```
$ dart pub add t_omdb
```
or add it manually to your `pubspec.yaml` file:
```yaml
dependencies:
t_omdb: ^replace-with-latest-version
```
### Example usage:
```dart
import 'package:t_omdb/t_omdb.dart';

void main() async {
final omdb = OmdbApi('your-api-key');

// Search for "guardians of the galaxy" by it's imdb id
final String? byId = await omdb.searchById('tt3896198');

// Search specifically for "guardians of the galaxy" by title (returns the first result)
final String? byTitle = await omdb.searchByTitle('guardians of the galaxy');

// Search for "guardians of the galaxy" by query (returns multiple results that match the query)
final String? byQuery = await omdb.searchByQuery('guardians of the galaxy', type: OmdbType.movie, year: '2017', responseType: OmdbResponseType.json);

print(byId);
print(byTitle);
print(byQuery);
}
```
## Parameters

### By ID or Title
*Please note either i or t is required*

| Parameter | Required | Valid options | Description |
| --------- | -------- |------------------------| ----------- |
| i | Optional*| | A valid IMDb ID (e.g. tt1285016) |
| t | Optional*| | Movie title to search for. |
| type | No | movie, series, episode | Type of result to return. |
| y | No | | Year of release. |
| plot | No | short, full | Return short or full plot. |
| r | No | json, xml | The data type to return. |

### By Search

| Parameter | Required | Valid options | Default Value | Description |
| --------- |----------|----------------------| ------------- | ----------- |
| s | Yes | | | Movie title to search for. |
| type | No | movie, series, episode | | Type of result to return. |
| y | No | | | Year of release. |
| r | No | json, xml | json | The data type to return. |
| page | No | 1 - 100 | 1 | Page number to return. |