Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Merge #5
Browse files Browse the repository at this point in the history
5: fix: fixed for the issue (#4) 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-oembed-api/issues
[contributor guide]: https://github.com/twitter-dart/twitter-oembed-api/blob/main/CONTRIBUTING.md
[style guide]: https://github.com/twitter-dart/twitter-oembed-api/blob/main/STYLEGUIDE.md
[conventional commit]: https://conventionalcommits.org


Co-authored-by: myConsciousness <kato.shinya.dev@gmail.com>
  • Loading branch information
bors[bot] and myConsciousness authored Aug 12, 2022
2 parents a0cf47e + f8306e0 commit 523b4a4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Note

## v0.1.0

Fixed a bug. Added `screenName` parameter to `publishEmbeddedTweet`. ([#4](https://github.com/twitter-dart/twitter-oembed-api/issues/4))

## v0.0.1

- First Release.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Future<void> main() async {
try {
// You can get the embedded tweet by specifying the tweet ID.
final embeddedTweet = await twitterApi.publishEmbeddedTweet(
screenName: 'Interior',
tweetId: '507185938620219395',
maxWidth: 550,
align: ContentAlign.center,
Expand Down
1 change: 1 addition & 0 deletions example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Future<void> main() async {
try {
// You can get the embedded tweet by specifying the tweet ID.
final embeddedTweet = await twitterApi.publishEmbeddedTweet(
screenName: 'Interior',
tweetId: '507185938620219395',
maxWidth: 550,
align: ContentAlign.center,
Expand Down
7 changes: 6 additions & 1 deletion lib/src/twitter_oembed_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ abstract class TwitterOEmbedApi {
///
/// ## Parameters
///
/// - [screenName]: The screen name of the user who has the tweet to be
/// embedded.
///
/// - [tweetId]: The Tweet ID to be embedded.
///
/// - [maxWidth]: The maximum width of a rendered Tweet in whole pixels.
Expand Down Expand Up @@ -76,6 +79,7 @@ abstract class TwitterOEmbedApi {
///
/// - https://developer.twitter.com/en/docs/twitter-for-websites/oembed-api#item1
Future<EmbeddedTweet> publishEmbeddedTweet({
required String screenName,
required String tweetId,
int? maxWidth,
bool? hideMedia,
Expand Down Expand Up @@ -158,6 +162,7 @@ abstract class TwitterOEmbedApi {
class _TwitterOEmbedApi extends BaseService implements TwitterOEmbedApi {
@override
Future<EmbeddedTweet> publishEmbeddedTweet({
required String screenName,
required String tweetId,
int? maxWidth,
bool? hideMedia,
Expand All @@ -173,7 +178,7 @@ class _TwitterOEmbedApi extends BaseService implements TwitterOEmbedApi {
}) async {
final response = await super.get(
queryParameters: {
'url': 'https://twitter.com/Interior/status/$tweetId',
'url': 'https://twitter.com/$screenName/status/$tweetId',
'maxwidth': maxWidth,
'hide_media': hideMedia,
'hide_thread': hideThread,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: twitter_oembed_api
description: This library provides the easiest way to use the Twitter oEmbed API in Dart and Flutter apps.
version: 0.0.1
version: 0.1.0
repository: https://github.com/twitter-dart/twitter-oembed-api
issue_tracker: https://github.com/twitter-dart/twitter-oembed-api/issues

Expand Down
6 changes: 5 additions & 1 deletion test/src/twitter_oembed_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ void main() {
final twitterApi = TwitterOEmbedApi();

final embeddedTweet = await twitterApi.publishEmbeddedTweet(
screenName: 'Interior',
tweetId: '507185938620219395',
);

Expand All @@ -29,7 +30,10 @@ void main() {
final twitterApi = TwitterOEmbedApi();

expect(
() async => await twitterApi.publishEmbeddedTweet(tweetId: ''),
() async => await twitterApi.publishEmbeddedTweet(
screenName: '',
tweetId: '',
),
throwsA(isA<TwitterOEmbedException>()),
);
});
Expand Down

0 comments on commit 523b4a4

Please sign in to comment.