Skip to content

Commit 1249a52

Browse files
Revert "Add the 'PushEvent' webhook and associated PushCommit object" (#387)
* Revert "Add the 'PushEvent' webhook and associated PushCommit object (#386)" This reverts commit a3b0006. * update changelog --------- Co-authored-by: Rob Becker <[email protected]>
1 parent 8ffe0d0 commit 1249a52

File tree

8 files changed

+16
-271
lines changed

8 files changed

+16
-271
lines changed

CHANGELOG.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## 9.18.0
22

3-
* Adds the initial `PushEvent` object in https://github.com/SpinlockLabs/github.dart/pull/386
4-
* Update the `Repository` values `created_at` and `pushed_at` to handle integer times
3+
- Bad Release. Was: Add the 'PushEvent' webhook and associated PushCommit <https://github.com/SpinlockLabs/github.dart/pull/386>
54

65
## 9.17.0
76

@@ -312,7 +311,7 @@ Map<String, GistFile>? files;
312311
- Clean up lints https://github.com/SpinlockLabs/github.dart/pull/202
313312

314313
## 6.0.5
315-
- Fix null errors issue https://github.com/SpinlockLabs/github.dart/issues/199
314+
- Fix null errors issue https://github.com/SpinlockLabs/github.dart/issues/199
316315

317316
## 6.0.4
318317
- This fixes #196 (https://github.com/SpinlockLabs/github.dart/issues/196)
@@ -362,10 +361,10 @@ Map<String, GistFile>? files;
362361

363362
Deprecations:
364363

365-
- The `draft` and `prerelease` properties in the CreateRelease and Release
364+
- The `draft` and `prerelease` properties in the CreateRelease and Release
366365
- classes have been renamed to `isDraft` and `isPrerelease` for clarity.
367-
- Release.targetCommitsh has been renamed to Release.targetCommitish.
368-
- The `release` parameter in RepositoriesService.createRelease
366+
- Release.targetCommitsh has been renamed to Release.targetCommitish.
367+
- The `release` parameter in RepositoriesService.createRelease
369368
has been renamed to `createRelease`.
370369
- `RepositoriesService.getRelease` has been renamed to `RepositoriesService.getReleaseById`
371370

@@ -374,7 +373,7 @@ has been renamed to `createRelease`.
374373
- Add access to labels on Pull Requests https://github.com/SpinlockLabs/github.dart/pull/163
375374
- Adding draft property to PR model https://github.com/SpinlockLabs/github.dart/pull/162
376375
- updateFile request must be a PUT https://github.com/SpinlockLabs/github.dart/pull/160
377-
376+
378377
## v5.1.0
379378

380379
- `Repository`: added `updatedAt` and `license` fields.
@@ -391,7 +390,7 @@ has been renamed to `createRelease`.
391390

392391
## v5.0.0
393392

394-
- **BREAKING** `RepositoriesService.listCollaborators` now returns
393+
- **BREAKING** `RepositoriesService.listCollaborators` now returns
395394
`Stream<Collaborator>` instead of `Stream<User>`.
396395
- `Collaborator` is a new type that includes collaborator-specific
397396
information.
@@ -408,7 +407,7 @@ has been renamed to `createRelease`.
408407
- Removed unsupported `limit` parameter.
409408
- Removed flaky retry logic. Instead, `NotReady` is thrown, which can be used
410409
to decide to retry at the call site.
411-
- Made associated classes `ContributorStatistics` and
410+
- Made associated classes `ContributorStatistics` and
412411
`ContributorWeekStatistics` immutable. Since these classes are only meant as
413412
return values, we're not treating this as a breaking change.
414413
- Added `Stream<CodeSearchResults> github.search.code(...)` search API
@@ -438,7 +437,7 @@ has been renamed to `createRelease`.
438437

439438
## v2.3.2
440439

441-
- Automatically attempt to find GitHub user information in the process environment when running on the standalone VM.
440+
- Automatically attempt to find GitHub user information in the process environment when running on the standalone VM.
442441
- Add `ref` parameter to `getReadme` method for the repository service.
443442

444443
## v2.3.1
@@ -452,7 +451,7 @@ has been renamed to `createRelease`.
452451
- Moved `CHANGELOG` content back to repo.
453452
- Added `rateLimitLimit`, `rateLimitRemaining` and `rateLimitReset` to `GitHub`.
454453
- Added `id` to `Issue`
455-
- Added `direction`, `sort` and `since` optional arguments to
454+
- Added `direction`, `sort` and `since` optional arguments to
456455
`IssueService.listByRepo`.
457456

458457
## v2.1.0

lib/src/common/model/git.dart

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,6 @@ class CreateGitCommit {
9898
Map<String, dynamic> toJson() => _$CreateGitCommitToJson(this);
9999
}
100100

101-
/// Model class for a pushed commit.
102-
@JsonSerializable()
103-
class PushGitCommit {
104-
PushGitCommit(this.id, this.message, this.timestamp, this.url);
105-
106-
/// The commit hash.
107-
String? id;
108-
109-
/// The commit message.
110-
String? message;
111-
112-
/// The timestamp of the commit.
113-
DateTime? timestamp;
114-
115-
/// The direct url to the commit.
116-
String? url;
117-
118-
factory PushGitCommit.fromJson(Map<String, dynamic> input) =>
119-
_$PushGitCommitFromJson(input);
120-
Map<String, dynamic> toJson() => _$PushGitCommitToJson(this);
121-
}
122-
123101
/// Model class for an author or committer of a commit. The [GitCommitUser] may
124102
/// not correspond to a GitHub [User].
125103
@JsonSerializable(includeIfNull: false)

lib/src/common/model/git.g.dart

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/common/model/repos.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,9 @@ class Repository {
225225
int networkCount;
226226

227227
/// The time the repository was created at
228-
@JsonKey(fromJson: Repository.dynamicToDateTime)
229228
DateTime? createdAt;
230229

231230
/// The last time the repository was pushed at
232-
@JsonKey(fromJson: Repository.dynamicToDateTime)
233231
DateTime? pushedAt;
234232

235233
DateTime? updatedAt;
@@ -461,18 +459,6 @@ class Repository {
461459

462460
@override
463461
String toString() => 'Repository: $owner/$name';
464-
465-
/// In some cases, github webhooks send time values as an integer. This method
466-
/// is added to handle those cases, but otherwise parse like normal.
467-
static DateTime? dynamicToDateTime(dynamic time) {
468-
if (time == null) {
469-
return null;
470-
}
471-
if (time.runtimeType == int) {
472-
return DateTime.fromMillisecondsSinceEpoch(time * 1000);
473-
}
474-
return DateTime.parse(time as String);
475-
}
476462
}
477463

478464
/// Model class for repository permissions.

lib/src/common/model/repos.g.dart

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/server/hooks.dart

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -235,40 +235,3 @@ class CreateEvent extends HookEvent {
235235

236236
Map<String, dynamic> toJson() => _$CreateEventToJson(this);
237237
}
238-
239-
@JsonSerializable(fieldRename: FieldRename.snake)
240-
class PushEvent extends HookEvent {
241-
PushEvent({
242-
this.ref,
243-
this.before,
244-
this.after,
245-
this.repository,
246-
this.headCommit,
247-
this.commits,
248-
this.sender,
249-
});
250-
251-
factory PushEvent.fromJson(Map<String, dynamic> input) =>
252-
_$PushEventFromJson(input);
253-
String? ref;
254-
String? before;
255-
String? after;
256-
@JsonKey(toJson: handleIntegerTimes)
257-
Repository? repository;
258-
PushGitCommit? headCommit;
259-
List<PushGitCommit>? commits;
260-
User? sender;
261-
262-
Map<String, dynamic> toJson() => _$PushEventToJson(this);
263-
264-
static Map<String, dynamic>? handleIntegerTimes(Repository? repository) {
265-
var repositoryMap = repository?.toJson();
266-
for (final parameter in ['created_at', 'pushed_at']) {
267-
if (repositoryMap?[parameter] != null) {
268-
final createdAt = DateTime.parse(repositoryMap?[parameter]);
269-
repositoryMap?[parameter] = createdAt.millisecondsSinceEpoch ~/ 1000;
270-
}
271-
}
272-
return repositoryMap;
273-
}
274-
}

lib/src/server/hooks.g.dart

Lines changed: 0 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)