From 20588d01bc0fd3b9a4ada482078b1190695bda72 Mon Sep 17 00:00:00 2001 From: Ricardo Amador <32242716+ricardoamador@users.noreply.github.com> Date: Tue, 9 May 2023 19:53:24 -0700 Subject: [PATCH 1/2] Add node_id to the pull request model (#367) --- lib/src/common/model/pulls.dart | 4 + lib/src/common/model/pulls.g.dart | 2 + test/unit/common/model/pulls_test.dart | 246 +++++++++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 test/unit/common/model/pulls_test.dart diff --git a/lib/src/common/model/pulls.dart b/lib/src/common/model/pulls.dart index b6f20e55..cdbf6ed8 100644 --- a/lib/src/common/model/pulls.dart +++ b/lib/src/common/model/pulls.dart @@ -9,6 +9,7 @@ part 'pulls.g.dart'; class PullRequest { PullRequest({ this.id, + this.nodeId, this.htmlUrl, this.diffUrl, this.patchUrl, @@ -46,6 +47,9 @@ class PullRequest { /// Pull Request ID int? id; + /// Unique node identification string. + String? nodeId; + /// Url to the Pull Request Page String? htmlUrl; diff --git a/lib/src/common/model/pulls.g.dart b/lib/src/common/model/pulls.g.dart index 3608260c..dfe3a3b3 100644 --- a/lib/src/common/model/pulls.g.dart +++ b/lib/src/common/model/pulls.g.dart @@ -8,6 +8,7 @@ part of 'pulls.dart'; PullRequest _$PullRequestFromJson(Map json) => PullRequest( id: json['id'] as int?, + nodeId: json['node_id'] as String?, htmlUrl: json['html_url'] as String?, diffUrl: json['diff_url'] as String?, patchUrl: json['patch_url'] as String?, @@ -69,6 +70,7 @@ PullRequest _$PullRequestFromJson(Map json) => PullRequest( Map _$PullRequestToJson(PullRequest instance) => { 'id': instance.id, + 'node_id': instance.nodeId, 'html_url': instance.htmlUrl, 'diff_url': instance.diffUrl, 'patch_url': instance.patchUrl, diff --git a/test/unit/common/model/pulls_test.dart b/test/unit/common/model/pulls_test.dart new file mode 100644 index 00000000..f4d5fe65 --- /dev/null +++ b/test/unit/common/model/pulls_test.dart @@ -0,0 +1,246 @@ +import 'dart:convert'; + +import 'package:github/src/common/model/pulls.dart'; +import 'package:test/test.dart'; + +const String samplePullRequest = ''' + { + "url": "https://api.github.com/repos/flutter/cocoon/pulls/2703", + "id": 1344460863, + "node_id": "PR_kwDOA8VHis5QItg_", + "html_url": "https://github.com/flutter/cocoon/pull/2703", + "diff_url": "https://github.com/flutter/cocoon/pull/2703.diff", + "patch_url": "https://github.com/flutter/cocoon/pull/2703.patch", + "issue_url": "https://api.github.com/repos/flutter/cocoon/issues/2703", + "number": 2703, + "state": "open", + "locked": false, + "title": "Bump url_launcher from 6.1.10 to 6.1.11 in /dashboard", + "user": { + "login": "dependabot[bot]", + "id": 49699333, + "node_id": "MDM6Qm90NDk2OTkzMzM=", + "avatar_url": "https://avatars.githubusercontent.com/in/29110?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/dependabot%5Bbot%5D", + "html_url": "https://github.com/apps/dependabot", + "type": "Bot", + "site_admin": false + }, + "body": "Bumps [url_launcher](https://github.com/flutter/packages/tree/main/packages/url_launcher) from 6.1.10 to 6.1.11.", + "created_at": "2023-05-09T22:23:34Z", + "updated_at": "2023-05-09T22:23:35Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "252a1a4370e30631b090eeeda182879985cc8f08", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + { + "id": 3960015931, + "node_id": "LA_kwDOA8VHis7sCQw7", + "url": "https://api.github.com/repos/flutter/cocoon/labels/autosubmit", + "name": "autosubmit", + "color": "0E8A16", + "default": false, + "description": "Merge PR when tree becomes green via auto submit App" + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/flutter/cocoon/pulls/2703/commits", + "review_comments_url": "https://api.github.com/repos/flutter/cocoon/pulls/2703/comments", + "review_comment_url": "https://api.github.com/repos/flutter/cocoon/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/flutter/cocoon/issues/2703/comments", + "statuses_url": "https://api.github.com/repos/flutter/cocoon/statuses/57ec5a040c8a631e39b3f3dee82a77fdf79b6e19", + "head": { + "label": "flutter:dependabot/pub/dashboard/url_launcher-6.1.11", + "ref": "dependabot/pub/dashboard/url_launcher-6.1.11", + "sha": "57ec5a040c8a631e39b3f3dee82a77fdf79b6e19", + "user": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 63260554, + "node_id": "MDEwOlJlcG9zaXRvcnk2MzI2MDU1NA==", + "name": "cocoon", + "full_name": "flutter/cocoon", + "private": false, + "owner": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/flutter/cocoon", + "description": "Flutter's build coordinator and aggregator", + "fork": false, + "url": "https://api.github.com/repos/flutter/cocoon", + "forks_url": "https://api.github.com/repos/flutter/cocoon/forks", + "created_at": "2016-07-13T16:04:04Z", + "updated_at": "2023-04-12T16:34:46Z", + "pushed_at": "2023-05-09T22:23:35Z", + "git_url": "git://github.com/flutter/cocoon.git", + "ssh_url": "git@github.com:flutter/cocoon.git", + "clone_url": "https://github.com/flutter/cocoon.git", + "svn_url": "https://github.com/flutter/cocoon", + "homepage": null, + "size": 13247, + "stargazers_count": 171, + "watchers_count": 171, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 91, + "open_issues": 2, + "watchers": 171, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": true, + "squash_merge_commit_message": "PR_BODY", + "squash_merge_commit_title": "PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "flutter:main", + "ref": "main", + "sha": "152dd99368b8417b2ede8ed49d5923e594a3b0f2", + "user": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 63260554, + "node_id": "MDEwOlJlcG9zaXRvcnk2MzI2MDU1NA==", + "name": "cocoon", + "full_name": "flutter/cocoon", + "private": false, + "owner": { + "login": "flutter", + "id": 14101776, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjE0MTAxNzc2", + "avatar_url": "https://avatars.githubusercontent.com/u/14101776?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/flutter", + "html_url": "https://github.com/flutter", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/flutter/cocoon", + "description": "Flutter's build coordinator and aggregator", + "fork": false, + "url": "https://api.github.com/repos/flutter/cocoon", + "forks_url": "https://api.github.com/repos/flutter/cocoon/forks", + "created_at": "2016-07-13T16:04:04Z", + "updated_at": "2023-04-12T16:34:46Z", + "pushed_at": "2023-05-09T22:23:35Z", + "git_url": "git://github.com/flutter/cocoon.git", + "ssh_url": "git@github.com:flutter/cocoon.git", + "clone_url": "https://github.com/flutter/cocoon.git", + "svn_url": "https://github.com/flutter/cocoon", + "homepage": null, + "size": 13247, + "license": { + "key": "bsd-3-clause", + "name": "BSD 3-Clause New or Revised License", + "spdx_id": "BSD-3-Clause", + "url": "https://api.github.com/licenses/bsd-3-clause", + "node_id": "MDc6TGljZW5zZTU=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 91, + "open_issues": 2, + "watchers": 171, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": false, + "allow_rebase_merge": false, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": true, + "squash_merge_commit_message": "PR_BODY", + "squash_merge_commit_title": "PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "author_association": "CONTRIBUTOR", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 119, + "deletions": 202, + "changed_files": 2 + } +'''; + +void main() { + group('Pull Request fromJson', () { + test('Node ID is collected', () { + final pullRequest = PullRequest.fromJson(jsonDecode(samplePullRequest)); + expect(pullRequest, isNotNull); + expect(pullRequest.nodeId, "PR_kwDOA8VHis5QItg_"); + }); + }); +} From 87babe4af82a7cff2564ada331ccdd2256f3a8d6 Mon Sep 17 00:00:00 2001 From: Rob Becker Date: Tue, 9 May 2023 21:17:50 -0600 Subject: [PATCH 2/2] prep 9.13.0 --- CHANGELOG.md | 7 +++++++ pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df8472a1..efd7d81c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 9.13.0 + +* Add node_id to the pull request model by @ricardoamador in https://github.com/SpinlockLabs/github.dart/pull/367 + + +**Full Changelog**: https://github.com/SpinlockLabs/github.dart/compare/9.12.0...9.13.0 + ## 9.12.0 * Add support for issue and PR timeline events via `Issue.listTimeline`. diff --git a/pubspec.yaml b/pubspec.yaml index 5449f961..c3efddc9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: github -version: 9.12.0 +version: 9.13.0 description: A high-level GitHub API Client Library that uses Github's v3 API homepage: https://github.com/SpinlockLabs/github.dart pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy