Skip to content

Commit

Permalink
create event from githhub webhook event
Browse files Browse the repository at this point in the history
  • Loading branch information
XilaiZhang committed Mar 28, 2022
1 parent e79e5e7 commit 55b7aef
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
21 changes: 21 additions & 0 deletions lib/src/server/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,24 @@ class PullRequestEvent extends HookEvent {
_$PullRequestEventFromJson(input);
Map<String, dynamic> toJson() => _$PullRequestEventToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
class CreateEvent extends HookEvent {
CreateEvent({
this.ref,
this.refType,
this.pusherType,
this.repository,
this.sender,
});

factory CreateEvent.fromJson(Map<String, dynamic> input) => _$CreateEventFromJson(input);
String? ref;
String? refType;
String? pusherType;
Repository? repository;
User? sender;

Map<String, dynamic> toJson() => _$CreateEventToJson(this);
}

21 changes: 21 additions & 0 deletions lib/src/server/hooks.g.dart

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

8 changes: 3 additions & 5 deletions test/src/mocks.mocks.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Mocks generated by Mockito 5.0.15 from annotations
// Mocks generated by Mockito 5.1.0 from annotations
// in github/test/src/mocks.dart.
// Do not manually edit this file.

Expand All @@ -8,15 +8,15 @@ import 'package:github/src/common.dart' as _i3;
import 'package:http/http.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;

// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
// ignore_for_file: avoid_setters_without_getters
// ignore_for_file: camel_case_types
// ignore_for_file: comment_references
// ignore_for_file: implementation_imports
// ignore_for_file: invalid_use_of_visible_for_testing_member
// ignore_for_file: prefer_const_constructors
// ignore_for_file: unnecessary_overrides
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types

class _FakeClient_0 extends _i1.Fake implements _i2.Client {}

Expand Down Expand Up @@ -259,6 +259,4 @@ class MockGitHub extends _i1.Mock implements _i3.GitHub {
@override
void dispose() => super.noSuchMethod(Invocation.method(#dispose, []),
returnValueForMissingStub: null);
@override
String toString() => super.toString();
}

0 comments on commit 55b7aef

Please sign in to comment.