-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
54: feat: Added Spaces Search endpoint (#23) r=myConsciousness a=myConsciousness # 1. Description <!-- Provide a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change. If this is a breaking change, specify explicitly which APIs have been changed. --> ## 1.1. Checklist <!-- Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. --> - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`. - [x] I have updated/added relevant examples in `examples`. ## 1.2. Breaking Change <!-- Does your PR require users to manually update their apps to accommodate your change? If the PR is a breaking change this should be indicated with suffix "!" (for example, `feat!:`, `fix!:`). See [Conventional Commit] for details. --> - [ ] Yes, this is a breaking change. - [x] No, this is _not_ a breaking change. ## 1.3. Related Issues <!-- Provide a list of issues related to this PR from the [issue database]. Indicate which of these issues are resolved or fixed by this PR, i.e. Fixes #xxxx* !--> <!-- Links --> [issue database]: https://github.com/twitter-dart/twitter-api-v2/issues [contributor guide]: https://github.com/twitter-dart/twitter-api-v2/blob/main/CONTRIBUTING.md [style guide]: https://github.com/twitter-dart/twitter-api-v2/blob/main/STYLEGUIDE.md [conventional commit]: https://conventionalcommits.org Co-authored-by: myConsciousness <kato.shinya.dev@gmail.com>
- Loading branch information
Showing
14 changed files
with
520 additions
and
2 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
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,23 @@ | ||
// 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:freezed_annotation/freezed_annotation.dart'; | ||
|
||
// Project imports: | ||
import 'package:twitter_api_v2/src/service/spaces/space_state.dart'; | ||
|
||
part 'space_data.freezed.dart'; | ||
part 'space_data.g.dart'; | ||
|
||
@freezed | ||
class SpaceData with _$SpaceData { | ||
const factory SpaceData({ | ||
required String id, | ||
SpaceState? state, | ||
}) = _SpaceData; | ||
|
||
factory SpaceData.fromJson(Map<String, Object?> json) => | ||
_$SpaceDataFromJson(json); | ||
} |
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,161 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target | ||
|
||
part of 'space_data.dart'; | ||
|
||
// ************************************************************************** | ||
// FreezedGenerator | ||
// ************************************************************************** | ||
|
||
T _$identity<T>(T value) => value; | ||
|
||
final _privateConstructorUsedError = UnsupportedError( | ||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); | ||
|
||
SpaceData _$SpaceDataFromJson(Map<String, dynamic> json) { | ||
return _SpaceData.fromJson(json); | ||
} | ||
|
||
/// @nodoc | ||
mixin _$SpaceData { | ||
String get id => throw _privateConstructorUsedError; | ||
SpaceState? get state => throw _privateConstructorUsedError; | ||
|
||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; | ||
@JsonKey(ignore: true) | ||
$SpaceDataCopyWith<SpaceData> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} | ||
|
||
/// @nodoc | ||
abstract class $SpaceDataCopyWith<$Res> { | ||
factory $SpaceDataCopyWith(SpaceData value, $Res Function(SpaceData) then) = | ||
_$SpaceDataCopyWithImpl<$Res>; | ||
$Res call({String id, SpaceState? state}); | ||
} | ||
|
||
/// @nodoc | ||
class _$SpaceDataCopyWithImpl<$Res> implements $SpaceDataCopyWith<$Res> { | ||
_$SpaceDataCopyWithImpl(this._value, this._then); | ||
|
||
final SpaceData _value; | ||
// ignore: unused_field | ||
final $Res Function(SpaceData) _then; | ||
|
||
@override | ||
$Res call({ | ||
Object? id = freezed, | ||
Object? state = freezed, | ||
}) { | ||
return _then(_value.copyWith( | ||
id: id == freezed | ||
? _value.id | ||
: id // ignore: cast_nullable_to_non_nullable | ||
as String, | ||
state: state == freezed | ||
? _value.state | ||
: state // ignore: cast_nullable_to_non_nullable | ||
as SpaceState?, | ||
)); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
abstract class _$SpaceDataCopyWith<$Res> implements $SpaceDataCopyWith<$Res> { | ||
factory _$SpaceDataCopyWith( | ||
_SpaceData value, $Res Function(_SpaceData) then) = | ||
__$SpaceDataCopyWithImpl<$Res>; | ||
@override | ||
$Res call({String id, SpaceState? state}); | ||
} | ||
|
||
/// @nodoc | ||
class __$SpaceDataCopyWithImpl<$Res> extends _$SpaceDataCopyWithImpl<$Res> | ||
implements _$SpaceDataCopyWith<$Res> { | ||
__$SpaceDataCopyWithImpl(_SpaceData _value, $Res Function(_SpaceData) _then) | ||
: super(_value, (v) => _then(v as _SpaceData)); | ||
|
||
@override | ||
_SpaceData get _value => super._value as _SpaceData; | ||
|
||
@override | ||
$Res call({ | ||
Object? id = freezed, | ||
Object? state = freezed, | ||
}) { | ||
return _then(_SpaceData( | ||
id: id == freezed | ||
? _value.id | ||
: id // ignore: cast_nullable_to_non_nullable | ||
as String, | ||
state: state == freezed | ||
? _value.state | ||
: state // ignore: cast_nullable_to_non_nullable | ||
as SpaceState?, | ||
)); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
@JsonSerializable() | ||
class _$_SpaceData implements _SpaceData { | ||
const _$_SpaceData({required this.id, this.state}); | ||
|
||
factory _$_SpaceData.fromJson(Map<String, dynamic> json) => | ||
_$$_SpaceDataFromJson(json); | ||
|
||
@override | ||
final String id; | ||
@override | ||
final SpaceState? state; | ||
|
||
@override | ||
String toString() { | ||
return 'SpaceData(id: $id, state: $state)'; | ||
} | ||
|
||
@override | ||
bool operator ==(dynamic other) { | ||
return identical(this, other) || | ||
(other.runtimeType == runtimeType && | ||
other is _SpaceData && | ||
const DeepCollectionEquality().equals(other.id, id) && | ||
const DeepCollectionEquality().equals(other.state, state)); | ||
} | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
int get hashCode => Object.hash( | ||
runtimeType, | ||
const DeepCollectionEquality().hash(id), | ||
const DeepCollectionEquality().hash(state)); | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
_$SpaceDataCopyWith<_SpaceData> get copyWith => | ||
__$SpaceDataCopyWithImpl<_SpaceData>(this, _$identity); | ||
|
||
@override | ||
Map<String, dynamic> toJson() { | ||
return _$$_SpaceDataToJson(this); | ||
} | ||
} | ||
|
||
abstract class _SpaceData implements SpaceData { | ||
const factory _SpaceData( | ||
{required final String id, final SpaceState? state}) = _$_SpaceData; | ||
|
||
factory _SpaceData.fromJson(Map<String, dynamic> json) = | ||
_$_SpaceData.fromJson; | ||
|
||
@override | ||
String get id => throw _privateConstructorUsedError; | ||
@override | ||
SpaceState? get state => throw _privateConstructorUsedError; | ||
@override | ||
@JsonKey(ignore: true) | ||
_$SpaceDataCopyWith<_SpaceData> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} |
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,19 @@ | ||
// 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:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'space_meta.freezed.dart'; | ||
part 'space_meta.g.dart'; | ||
|
||
@freezed | ||
class SpaceMeta with _$SpaceMeta { | ||
const factory SpaceMeta({ | ||
@JsonKey(name: 'result_count') required int? resultCount, | ||
}) = _SpaceMeta; | ||
|
||
factory SpaceMeta.fromJson(Map<String, Object?> json) => | ||
_$SpaceMetaFromJson(json); | ||
} |
Oops, something went wrong.