-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dynamite): document generated libraries and add support for all …
…info fields Signed-off-by: Nikolas Rimikis <[email protected]>
- Loading branch information
Showing
9 changed files
with
353 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
packages/dynamite/dynamite/lib/src/models/openapi/contact.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:built_value/built_value.dart'; | ||
import 'package:built_value/serializer.dart'; | ||
|
||
part 'contact.g.dart'; | ||
|
||
abstract class Contact implements Built<Contact, ContactBuilder> { | ||
factory Contact([final void Function(ContactBuilder) updates]) = _$Contact; | ||
|
||
const Contact._(); | ||
|
||
static Serializer<Contact> get serializer => _$contactSerializer; | ||
|
||
String? get name; | ||
String? get url; | ||
String? get email; | ||
|
||
String? formattedDescription() { | ||
final name = this.name; | ||
final url = this.url; | ||
final email = this.email; | ||
|
||
if (name == null || (url ?? email) == null) { | ||
return null; | ||
} | ||
|
||
final buffer = StringBuffer('You can contact the $name team under:'); | ||
if (email != null) { | ||
buffer | ||
..write('\n') | ||
..write(' Email: `$email`'); | ||
} | ||
if (url != null) { | ||
buffer | ||
..write('\n') | ||
..write(' Website: `$url`'); | ||
} | ||
|
||
return buffer.toString(); | ||
} | ||
} |
163 changes: 163 additions & 0 deletions
163
packages/dynamite/dynamite/lib/src/models/openapi/contact.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.