Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: fixed for the issue (#207) #225

Merged
merged 2 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## v2.5.0

- Added `spaceFields` argument. ([#184](https://github.com/twitter-dart/twitter-api-v2/issues/184))
- GET /2/spaces/search
- GET /2/spaces
- GET /2/spaces/:id
- GET /2/spaces/by/creator_ids
- Added `pollFields` argument. ([#181](https://github.com/twitter-dart/twitter-api-v2/issues/181))
- GET /2/users/:id/bookmarks
- GET /2/tweets/search/stream
Expand Down Expand Up @@ -38,6 +43,7 @@
- GET /2/spaces/:id/tweets
- `PlaceData` class is migrated to `Geo` class, and updated `PlaceData` parameters.
- `PlaceCoordinates` class is migrated to `GeoCoordinates` class, and updated `PlaceCoordinates` paramters.
- Changed the type of `lang` field from `String?` to `TweetLanguage?`. ([#207](https://github.com/twitter-dart/twitter-api-v2/issues/207))

## v2.4.2

Expand Down
3 changes: 2 additions & 1 deletion lib/src/service/spaces/space_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

// Project imports:
import 'space_language.dart';
import 'space_state.dart';

part 'space_data.freezed.dart';
Expand All @@ -18,7 +19,7 @@ class SpaceData with _$SpaceData {
String? title,
SpaceState? state,
String? creatorId,
String? lang,
SpaceLanguage? lang,
List<String>? hostIds,
List<String>? topicIds,
List<String>? speakerIds,
Expand Down
16 changes: 8 additions & 8 deletions lib/src/service/spaces/space_data.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mixin _$SpaceData {
String? get title => throw _privateConstructorUsedError;
SpaceState? get state => throw _privateConstructorUsedError;
String? get creatorId => throw _privateConstructorUsedError;
String? get lang => throw _privateConstructorUsedError;
SpaceLanguage? get lang => throw _privateConstructorUsedError;
List<String>? get hostIds => throw _privateConstructorUsedError;
List<String>? get topicIds => throw _privateConstructorUsedError;
List<String>? get speakerIds => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -53,7 +53,7 @@ abstract class $SpaceDataCopyWith<$Res> {
String? title,
SpaceState? state,
String? creatorId,
String? lang,
SpaceLanguage? lang,
List<String>? hostIds,
List<String>? topicIds,
List<String>? speakerIds,
Expand Down Expand Up @@ -116,7 +116,7 @@ class _$SpaceDataCopyWithImpl<$Res> implements $SpaceDataCopyWith<$Res> {
lang: lang == freezed
? _value.lang
: lang // ignore: cast_nullable_to_non_nullable
as String?,
as SpaceLanguage?,
hostIds: hostIds == freezed
? _value.hostIds
: hostIds // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -180,7 +180,7 @@ abstract class _$$_SpaceDataCopyWith<$Res> implements $SpaceDataCopyWith<$Res> {
String? title,
SpaceState? state,
String? creatorId,
String? lang,
SpaceLanguage? lang,
List<String>? hostIds,
List<String>? topicIds,
List<String>? speakerIds,
Expand Down Expand Up @@ -245,7 +245,7 @@ class __$$_SpaceDataCopyWithImpl<$Res> extends _$SpaceDataCopyWithImpl<$Res>
lang: lang == freezed
? _value.lang
: lang // ignore: cast_nullable_to_non_nullable
as String?,
as SpaceLanguage?,
hostIds: hostIds == freezed
? _value._hostIds
: hostIds // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -336,7 +336,7 @@ class _$_SpaceData implements _SpaceData {
@override
final String? creatorId;
@override
final String? lang;
final SpaceLanguage? lang;
final List<String>? _hostIds;
@override
List<String>? get hostIds {
Expand Down Expand Up @@ -464,7 +464,7 @@ abstract class _SpaceData implements SpaceData {
final String? title,
final SpaceState? state,
final String? creatorId,
final String? lang,
final SpaceLanguage? lang,
final List<String>? hostIds,
final List<String>? topicIds,
final List<String>? speakerIds,
Expand All @@ -490,7 +490,7 @@ abstract class _SpaceData implements SpaceData {
@override
String? get creatorId => throw _privateConstructorUsedError;
@override
String? get lang => throw _privateConstructorUsedError;
SpaceLanguage? get lang => throw _privateConstructorUsedError;
@override
List<String>? get hostIds => throw _privateConstructorUsedError;
@override
Expand Down
33 changes: 31 additions & 2 deletions lib/src/service/spaces/space_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions lib/src/service/spaces/space_language.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2022 Kato Shinya. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided the conditions.

// Package imports:
import 'package:json_annotation/json_annotation.dart';

enum SpaceLanguage {
@JsonValue('ar')
arabic('ar'),

@JsonValue('hy')
armenian('hy'),

@JsonValue('zh')
chinese('zh'),

@JsonValue('da')
danish('da'),

@JsonValue('en')
english('en'),

@JsonValue('fi')
finnish('fi'),

@JsonValue('fr')
french('fr'),

@JsonValue('de')
german('de'),

@JsonValue('hi')
hindi('hi'),

@JsonValue('iw')
hebrew('iw'),

@JsonValue('in')
indonesian('in'),

@JsonValue('it')
italian('it'),

@JsonValue('ja')
japanese('ja'),

@JsonValue('kk')
kazakh('kk'),

@JsonValue('ko')
korean('ko'),

@JsonValue('no')
norwegian('no'),

@JsonValue('pl')
polish('pl'),

@JsonValue('pt')
portuguese('pt'),

@JsonValue('ro')
romanian('ro'),

@JsonValue('ru')
russian('ru'),

@JsonValue('es')
spanish('es'),

@JsonValue('sv')
swedish('sv'),

@JsonValue('tr')
turkish('tr'),

@JsonValue('uk')
ukranian('uk'),

@JsonValue('other')
undetermined('other');

/// The language code
final String code;

const SpaceLanguage(this.code);
}
3 changes: 2 additions & 1 deletion lib/src/service/tweets/tweet_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'reply_setting.dart';
import 'tweet_attachments.dart';
import 'tweet_context_annotation_group.dart';
import 'tweet_entities.dart';
import 'tweet_language.dart';
import 'tweet_withheld.dart';

part 'tweet_data.freezed.dart';
Expand All @@ -34,7 +35,7 @@ class TweetData with _$TweetData {
TweetAttachments? attachments,
PublicTweetMetrics? publicMetrics,
Geo? geo,
String? lang,
TweetLanguage? lang,
@JsonKey(name: 'possibly_sensitive') bool? isPossiblySensitive,
@JsonKey(name: 'reply_settings') ReplySetting? replySetting,
String? source,
Expand Down
16 changes: 8 additions & 8 deletions lib/src/service/tweets/tweet_data.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mixin _$TweetData {
TweetAttachments? get attachments => throw _privateConstructorUsedError;
PublicTweetMetrics? get publicMetrics => throw _privateConstructorUsedError;
Geo? get geo => throw _privateConstructorUsedError;
String? get lang => throw _privateConstructorUsedError;
TweetLanguage? get lang => throw _privateConstructorUsedError;
@JsonKey(name: 'possibly_sensitive')
bool? get isPossiblySensitive => throw _privateConstructorUsedError;
@JsonKey(name: 'reply_settings')
Expand Down Expand Up @@ -64,7 +64,7 @@ abstract class $TweetDataCopyWith<$Res> {
TweetAttachments? attachments,
PublicTweetMetrics? publicMetrics,
Geo? geo,
String? lang,
TweetLanguage? lang,
@JsonKey(name: 'possibly_sensitive') bool? isPossiblySensitive,
@JsonKey(name: 'reply_settings') ReplySetting? replySetting,
String? source,
Expand Down Expand Up @@ -154,7 +154,7 @@ class _$TweetDataCopyWithImpl<$Res> implements $TweetDataCopyWith<$Res> {
lang: lang == freezed
? _value.lang
: lang // ignore: cast_nullable_to_non_nullable
as String?,
as TweetLanguage?,
isPossiblySensitive: isPossiblySensitive == freezed
? _value.isPossiblySensitive
: isPossiblySensitive // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -252,7 +252,7 @@ abstract class _$$_TweetDataCopyWith<$Res> implements $TweetDataCopyWith<$Res> {
TweetAttachments? attachments,
PublicTweetMetrics? publicMetrics,
Geo? geo,
String? lang,
TweetLanguage? lang,
@JsonKey(name: 'possibly_sensitive') bool? isPossiblySensitive,
@JsonKey(name: 'reply_settings') ReplySetting? replySetting,
String? source,
Expand Down Expand Up @@ -349,7 +349,7 @@ class __$$_TweetDataCopyWithImpl<$Res> extends _$TweetDataCopyWithImpl<$Res>
lang: lang == freezed
? _value.lang
: lang // ignore: cast_nullable_to_non_nullable
as String?,
as TweetLanguage?,
isPossiblySensitive: isPossiblySensitive == freezed
? _value.isPossiblySensitive
: isPossiblySensitive // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -438,7 +438,7 @@ class _$_TweetData implements _TweetData {
@override
final Geo? geo;
@override
final String? lang;
final TweetLanguage? lang;
@override
@JsonKey(name: 'possibly_sensitive')
final bool? isPossiblySensitive;
Expand Down Expand Up @@ -535,7 +535,7 @@ abstract class _TweetData implements TweetData {
final TweetAttachments? attachments,
final PublicTweetMetrics? publicMetrics,
final Geo? geo,
final String? lang,
final TweetLanguage? lang,
@JsonKey(name: 'possibly_sensitive') final bool? isPossiblySensitive,
@JsonKey(name: 'reply_settings') final ReplySetting? replySetting,
final String? source,
Expand Down Expand Up @@ -570,7 +570,7 @@ abstract class _TweetData implements TweetData {
@override
Geo? get geo => throw _privateConstructorUsedError;
@override
String? get lang => throw _privateConstructorUsedError;
TweetLanguage? get lang => throw _privateConstructorUsedError;
@override
@JsonKey(name: 'possibly_sensitive')
bool? get isPossiblySensitive => throw _privateConstructorUsedError;
Expand Down
Loading