-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba98b5e
commit 0ec7eda
Showing
12 changed files
with
926 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'src/media.dart'; | ||
export 'src/response.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,46 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:built_collection/built_collection.dart'; | ||
import 'package:built_value/built_value.dart'; | ||
import 'package:built_value/serializer.dart'; | ||
|
||
import 'serializers.dart'; | ||
|
||
part 'media.g.dart'; | ||
|
||
abstract class Media implements Built<Media, MediaBuilder> { | ||
String get id; | ||
|
||
String get caption; | ||
|
||
String get url; | ||
|
||
MediaType get type; | ||
|
||
Media._(); | ||
|
||
factory Media([void Function(MediaBuilder) updates]) = _$Media; | ||
|
||
static Media fromJson(String jsonString) { | ||
return serializers.fromJson(Media.serializer, jsonString)!; | ||
} | ||
|
||
String toJson() { | ||
return serializers.toJson(Media.serializer, this); | ||
} | ||
|
||
static Serializer<Media> get serializer => _$mediaSerializer; | ||
} | ||
|
||
class MediaType extends EnumClass { | ||
static const MediaType image = _$image; | ||
static const MediaType video = _$video; | ||
|
||
const MediaType._(super.name); | ||
|
||
static BuiltSet<MediaType> get values => _$values; | ||
|
||
static MediaType valueOf(String name) => _$valueOf(name); | ||
|
||
static Serializer<MediaType> get serializer => _$mediaTypeSerializer; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:built_collection/built_collection.dart'; | ||
import 'package:built_value/built_value.dart'; | ||
import 'package:built_value/serializer.dart'; | ||
|
||
import 'media.dart'; | ||
import 'serializers.dart'; | ||
|
||
part 'response.g.dart'; | ||
|
||
abstract class Response implements Built<Response, ResponseBuilder> { | ||
BuiltList<Media> get medias; | ||
|
||
Response._(); | ||
|
||
factory Response([void Function(ResponseBuilder) updates]) = _$Response; | ||
|
||
static Response fromJson(String jsonString) { | ||
return serializers.fromJson(Response.serializer, jsonString)!; | ||
} | ||
|
||
String toJson() { | ||
return serializers.toJson(Response.serializer, this); | ||
} | ||
|
||
static Serializer<Response> get serializer => _$responseSerializer; | ||
} |
Oops, something went wrong.