Skip to content

Commit

Permalink
docs: prepare metadata to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
rIIh committed Dec 25, 2020
1 parent 1479827 commit 3d21d28
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 11 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
## [0.0.1] - TODO: Add release date.

* TODO: Describe initial release.
22 changes: 21 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
TODO: Add your license here.
MIT License

Copyright (c) 2020 Vadim Melnikov [melv.space](http://melv.space "melv.space")

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# Oxford Dictionary API Wrapper in Dart

Package is under development and don't have all API functionality.
Feel free to contribute!
*The package is under development and doesn't have all API
functionality.* **Feel free to contribute!**

> The Oxford Dictionaries API offers an easy way to access powerful
> lexical data (words, definitions, translations, audio pronunciations,
> synonyms, antonyms, parts of speech, and more) to use in your apps and
> websites.

## Getting Started

```
```bash
git clone [email protected]:rIIh/oxford-dictionary.git && cd oxford-dictionary
```

```
```bash
flutter pub get
```

```bash
flutter pub run build_runner build
```

## How to use

```dart
```
flutter pub run build_runner build
```

47 changes: 47 additions & 0 deletions example/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'dart:io';

import 'package:http/http.dart' as http;
import 'package:oxford_dictionary/oxford_dict.dart';

void main() {
find('programming').then((word) {});
}

Future<Word> find(String wordString, [http.Client client]) async {
final dictionary = OxfordDictionary(
'en',
Platform.environment['APP_ID'],
Platform.environment['APP_KEY'],
client: client,
);

// get word definition entry
final word = await dictionary.entries.search(wordString);

print(word);

// get phrases
final phrases = word.phrases.values?.map((phrases) => phrases)?.expand((phrases) => phrases)?.toList();

// get pronunciations
final pronunciations = word.variants.values
?.map((e) => e.map((e) => e.pronunciations))
?.expand((pronunciations) => pronunciations)
?.toList();

// get senses
final senses = word.variants.values
?.map((variants) => variants?.map((variant) => variant.senses))
?.expand((senses) => senses)
?.toList();

// get definitions
final definitions = senses?.map((e) => e.map((e) => e.definitions))?.expand((definitions) => definitions)?.toList();

// get sub senses
final subSenses = senses?.map((e) => e.map((e) => e.subSenses))?.expand((subSenses) => subSenses)?.toList();

print([phrases, pronunciations, senses, definitions, subSenses].join('\n'));

return word;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: oxford_dictionary
description: A new Flutter package project.
version: 0.0.1
version: 1.0.0
homepage: https://github.com/rIIh

environment:
Expand Down
41 changes: 41 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
branches: [
"master",
],
plugins: [
[
"@semantic-release/commit-analyzer",
{
releaseRules: [
{ scope: "develop", release: false },
{ scope: "config", release: "patch" },
{ scope: "no-release", release: false },
],
parserOpts: {
mergePattern: "^Merge branch '(.*)' into '(.*)'$",
mergeCorrespondence: ["source", "id"],
},
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
},
],
"semantic-release-dart",
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
},
],
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", 'pubspec.yaml']
}
],
"@semantic-release/github",
],
};

0 comments on commit 3d21d28

Please sign in to comment.