diff --git a/lib/graphql/gh.dart b/lib/graphql/gh.dart index bf00adf..db28c8b 100644 --- a/lib/graphql/gh.dart +++ b/lib/graphql/gh.dart @@ -7167,3 +7167,795 @@ class GhUnfollowUserQuery GhUnfollowUser parse(Map json) => GhUnfollowUser.fromJson(json); } + +@JsonSerializable(explicitToJson: true) +class GhCreateIssue with EquatableMixin { + GhCreateIssue(); + + factory GhCreateIssue.fromJson(Map json) => + _$GhCreateIssueFromJson(json); + + GhCreateIssueCreateIssuePayload createIssue; + + @override + List get props => [createIssue]; + Map toJson() => _$GhCreateIssueToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueCreateIssuePayload with EquatableMixin { + GhCreateIssueCreateIssuePayload(); + + factory GhCreateIssueCreateIssuePayload.fromJson(Map json) => + _$GhCreateIssueCreateIssuePayloadFromJson(json); + + GhCreateIssueIssue issue; + + @override + List get props => [issue]; + Map toJson() => + _$GhCreateIssueCreateIssuePayloadToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueIssue extends GhCreateIssueProjectCardItem + with EquatableMixin + implements + GhCreateIssueNode, + GhCreateIssueAssignable, + GhCreateIssueClosable, + GhCreateIssueComment, + GhCreateIssueUpdatable, + GhCreateIssueUpdatableComment, + GhCreateIssueLabelable, + GhCreateIssueLockable, + GhCreateIssueReactable, + GhCreateIssueRepositoryNode, + GhCreateIssueSubscribable, + GhCreateIssueUniformResourceLocatable { + GhCreateIssueIssue(); + + factory GhCreateIssueIssue.fromJson(Map json) => + _$GhCreateIssueIssueFromJson(json); + + int number; + + @override + GhCreateIssueRepository repository; + + @override + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [number, repository, resolveType]; + Map toJson() => _$GhCreateIssueIssueToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueRepository extends GhCreateIssuePinnableItem + with EquatableMixin + implements + GhCreateIssueNode, + GhCreateIssueProjectOwner, + GhCreateIssueRegistryPackageOwner, + GhCreateIssueRegistryPackageSearch, + GhCreateIssueSubscribable, + GhCreateIssueStarrable, + GhCreateIssueUniformResourceLocatable, + GhCreateIssueRepositoryInfo { + GhCreateIssueRepository(); + + factory GhCreateIssueRepository.fromJson(Map json) => + _$GhCreateIssueRepositoryFromJson(json); + + @override + GhCreateIssueRepositoryOwner owner; + + @override + String name; + + @override + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [owner, name, resolveType]; + Map toJson() => _$GhCreateIssueRepositoryToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueRepositoryOwner with EquatableMixin { + GhCreateIssueRepositoryOwner(); + + factory GhCreateIssueRepositoryOwner.fromJson(Map json) => + _$GhCreateIssueRepositoryOwnerFromJson(json); + + String login; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [login, resolveType]; + Map toJson() => _$GhCreateIssueRepositoryOwnerToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssuePinnableItem with EquatableMixin { + GhCreateIssuePinnableItem(); + + factory GhCreateIssuePinnableItem.fromJson(Map json) => + _$GhCreateIssuePinnableItemFromJson(json); + + @override + List get props => []; + Map toJson() => _$GhCreateIssuePinnableItemToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueNode with EquatableMixin { + GhCreateIssueNode(); + + factory GhCreateIssueNode.fromJson(Map json) => + _$GhCreateIssueNodeFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueNodeToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueProjectOwner with EquatableMixin { + GhCreateIssueProjectOwner(); + + factory GhCreateIssueProjectOwner.fromJson(Map json) => + _$GhCreateIssueProjectOwnerFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueProjectOwnerToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueRegistryPackageOwner with EquatableMixin { + GhCreateIssueRegistryPackageOwner(); + + factory GhCreateIssueRegistryPackageOwner.fromJson( + Map json) => + _$GhCreateIssueRegistryPackageOwnerFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => + _$GhCreateIssueRegistryPackageOwnerToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueRegistryPackageSearch with EquatableMixin { + GhCreateIssueRegistryPackageSearch(); + + factory GhCreateIssueRegistryPackageSearch.fromJson( + Map json) => + _$GhCreateIssueRegistryPackageSearchFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => + _$GhCreateIssueRegistryPackageSearchToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueSubscribable with EquatableMixin { + GhCreateIssueSubscribable(); + + factory GhCreateIssueSubscribable.fromJson(Map json) => + _$GhCreateIssueSubscribableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueSubscribableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueStarrable with EquatableMixin { + GhCreateIssueStarrable(); + + factory GhCreateIssueStarrable.fromJson(Map json) => + _$GhCreateIssueStarrableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueStarrableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueUniformResourceLocatable with EquatableMixin { + GhCreateIssueUniformResourceLocatable(); + + factory GhCreateIssueUniformResourceLocatable.fromJson( + Map json) => + _$GhCreateIssueUniformResourceLocatableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => + _$GhCreateIssueUniformResourceLocatableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueRepositoryInfo with EquatableMixin { + GhCreateIssueRepositoryInfo(); + + factory GhCreateIssueRepositoryInfo.fromJson(Map json) => + _$GhCreateIssueRepositoryInfoFromJson(json); + + GhCreateIssueRepositoryOwner owner; + + String name; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [owner, name, resolveType]; + Map toJson() => _$GhCreateIssueRepositoryInfoToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueProjectCardItem with EquatableMixin { + GhCreateIssueProjectCardItem(); + + factory GhCreateIssueProjectCardItem.fromJson(Map json) => + _$GhCreateIssueProjectCardItemFromJson(json); + + @override + List get props => []; + Map toJson() => _$GhCreateIssueProjectCardItemToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueAssignable with EquatableMixin { + GhCreateIssueAssignable(); + + factory GhCreateIssueAssignable.fromJson(Map json) => + _$GhCreateIssueAssignableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueAssignableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueClosable with EquatableMixin { + GhCreateIssueClosable(); + + factory GhCreateIssueClosable.fromJson(Map json) => + _$GhCreateIssueClosableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueClosableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueComment with EquatableMixin { + GhCreateIssueComment(); + + factory GhCreateIssueComment.fromJson(Map json) => + _$GhCreateIssueCommentFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueCommentToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueUpdatable with EquatableMixin { + GhCreateIssueUpdatable(); + + factory GhCreateIssueUpdatable.fromJson(Map json) => + _$GhCreateIssueUpdatableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueUpdatableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueUpdatableComment with EquatableMixin { + GhCreateIssueUpdatableComment(); + + factory GhCreateIssueUpdatableComment.fromJson(Map json) => + _$GhCreateIssueUpdatableCommentFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueUpdatableCommentToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueLabelable with EquatableMixin { + GhCreateIssueLabelable(); + + factory GhCreateIssueLabelable.fromJson(Map json) => + _$GhCreateIssueLabelableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueLabelableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueLockable with EquatableMixin { + GhCreateIssueLockable(); + + factory GhCreateIssueLockable.fromJson(Map json) => + _$GhCreateIssueLockableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueLockableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueReactable with EquatableMixin { + GhCreateIssueReactable(); + + factory GhCreateIssueReactable.fromJson(Map json) => + _$GhCreateIssueReactableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhCreateIssueReactableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueRepositoryNode with EquatableMixin { + GhCreateIssueRepositoryNode(); + + factory GhCreateIssueRepositoryNode.fromJson(Map json) => + _$GhCreateIssueRepositoryNodeFromJson(json); + + GhCreateIssueRepository repository; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [repository, resolveType]; + Map toJson() => _$GhCreateIssueRepositoryNodeToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhCreateIssueArguments extends JsonSerializable with EquatableMixin { + GhCreateIssueArguments({this.repoId, this.title, this.body}); + + factory GhCreateIssueArguments.fromJson(Map json) => + _$GhCreateIssueArgumentsFromJson(json); + + final String repoId; + + final String title; + + final String body; + + @override + List get props => [repoId, title, body]; + Map toJson() => _$GhCreateIssueArgumentsToJson(this); +} + +class GhCreateIssueQuery + extends GraphQLQuery { + GhCreateIssueQuery({this.variables}); + + @override + final DocumentNode document = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'GhCreateIssue'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'repoId')), + type: NamedTypeNode(name: NameNode(value: 'ID'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'title')), + type: NamedTypeNode( + name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'body')), + type: NamedTypeNode( + name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'createIssue'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'input'), + value: ObjectValueNode(fields: [ + ObjectFieldNode( + name: NameNode(value: 'repositoryId'), + value: VariableNode(name: NameNode(value: 'repoId'))), + ObjectFieldNode( + name: NameNode(value: 'title'), + value: VariableNode(name: NameNode(value: 'title'))), + ObjectFieldNode( + name: NameNode(value: 'body'), + value: VariableNode(name: NameNode(value: 'body'))) + ])) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'issue'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'number'), + alias: null, + arguments: [], + directives: [], + selectionSet: null), + FieldNode( + name: NameNode(value: 'repository'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'owner'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'login'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])), + FieldNode( + name: NameNode(value: 'name'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) + ])) + ])) + ]); + + @override + final String operationName = 'GhCreateIssue'; + + @override + final GhCreateIssueArguments variables; + + @override + List get props => [document, operationName, variables]; + @override + GhCreateIssue parse(Map json) => + GhCreateIssue.fromJson(json); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoId with EquatableMixin { + GhRepoId(); + + factory GhRepoId.fromJson(Map json) => + _$GhRepoIdFromJson(json); + + GhRepoIdRepository repository; + + @override + List get props => [repository]; + Map toJson() => _$GhRepoIdToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdRepository extends GhRepoIdPinnableItem + with EquatableMixin + implements + GhRepoIdNode, + GhRepoIdProjectOwner, + GhRepoIdRegistryPackageOwner, + GhRepoIdRegistryPackageSearch, + GhRepoIdSubscribable, + GhRepoIdStarrable, + GhRepoIdUniformResourceLocatable, + GhRepoIdRepositoryInfo { + GhRepoIdRepository(); + + factory GhRepoIdRepository.fromJson(Map json) => + _$GhRepoIdRepositoryFromJson(json); + + @override + String id; + + @override + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdRepositoryToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdPinnableItem with EquatableMixin { + GhRepoIdPinnableItem(); + + factory GhRepoIdPinnableItem.fromJson(Map json) => + _$GhRepoIdPinnableItemFromJson(json); + + @override + List get props => []; + Map toJson() => _$GhRepoIdPinnableItemToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdNode with EquatableMixin { + GhRepoIdNode(); + + factory GhRepoIdNode.fromJson(Map json) => + _$GhRepoIdNodeFromJson(json); + + String id; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdNodeToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdProjectOwner with EquatableMixin { + GhRepoIdProjectOwner(); + + factory GhRepoIdProjectOwner.fromJson(Map json) => + _$GhRepoIdProjectOwnerFromJson(json); + + String id; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdProjectOwnerToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdRegistryPackageOwner with EquatableMixin { + GhRepoIdRegistryPackageOwner(); + + factory GhRepoIdRegistryPackageOwner.fromJson(Map json) => + _$GhRepoIdRegistryPackageOwnerFromJson(json); + + String id; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdRegistryPackageOwnerToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdRegistryPackageSearch with EquatableMixin { + GhRepoIdRegistryPackageSearch(); + + factory GhRepoIdRegistryPackageSearch.fromJson(Map json) => + _$GhRepoIdRegistryPackageSearchFromJson(json); + + String id; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdRegistryPackageSearchToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdSubscribable with EquatableMixin { + GhRepoIdSubscribable(); + + factory GhRepoIdSubscribable.fromJson(Map json) => + _$GhRepoIdSubscribableFromJson(json); + + String id; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdSubscribableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdStarrable with EquatableMixin { + GhRepoIdStarrable(); + + factory GhRepoIdStarrable.fromJson(Map json) => + _$GhRepoIdStarrableFromJson(json); + + String id; + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [id, resolveType]; + Map toJson() => _$GhRepoIdStarrableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdUniformResourceLocatable with EquatableMixin { + GhRepoIdUniformResourceLocatable(); + + factory GhRepoIdUniformResourceLocatable.fromJson( + Map json) => + _$GhRepoIdUniformResourceLocatableFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => + _$GhRepoIdUniformResourceLocatableToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdRepositoryInfo with EquatableMixin { + GhRepoIdRepositoryInfo(); + + factory GhRepoIdRepositoryInfo.fromJson(Map json) => + _$GhRepoIdRepositoryInfoFromJson(json); + + @JsonKey(name: '__typename') + String resolveType; + + @override + List get props => [resolveType]; + Map toJson() => _$GhRepoIdRepositoryInfoToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class GhRepoIdArguments extends JsonSerializable with EquatableMixin { + GhRepoIdArguments({this.owner, this.name}); + + factory GhRepoIdArguments.fromJson(Map json) => + _$GhRepoIdArgumentsFromJson(json); + + final String owner; + + final String name; + + @override + List get props => [owner, name]; + Map toJson() => _$GhRepoIdArgumentsToJson(this); +} + +class GhRepoIdQuery extends GraphQLQuery { + GhRepoIdQuery({this.variables}); + + @override + final DocumentNode document = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'GhRepoId'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'owner')), + type: NamedTypeNode( + name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []), + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'name')), + type: NamedTypeNode( + name: NameNode(value: 'String'), isNonNull: true), + defaultValue: DefaultValueNode(value: null), + directives: []) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'repository'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'owner'), + value: VariableNode(name: NameNode(value: 'owner'))), + ArgumentNode( + name: NameNode(value: 'name'), + value: VariableNode(name: NameNode(value: 'name'))) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'id'), + alias: null, + arguments: [], + directives: [], + selectionSet: null) + ])) + ])) + ]); + + @override + final String operationName = 'GhRepoId'; + + @override + final GhRepoIdArguments variables; + + @override + List get props => [document, operationName, variables]; + @override + GhRepoId parse(Map json) => GhRepoId.fromJson(json); +} diff --git a/lib/graphql/gh.g.dart b/lib/graphql/gh.g.dart index afe91b0..4a07ede 100644 --- a/lib/graphql/gh.g.dart +++ b/lib/graphql/gh.g.dart @@ -2855,3 +2855,465 @@ Map _$GhUnfollowUserArgumentsToJson( { 'id': instance.id, }; + +GhCreateIssue _$GhCreateIssueFromJson(Map json) { + return GhCreateIssue() + ..createIssue = json['createIssue'] == null + ? null + : GhCreateIssueCreateIssuePayload.fromJson( + json['createIssue'] as Map); +} + +Map _$GhCreateIssueToJson(GhCreateIssue instance) => + { + 'createIssue': instance.createIssue?.toJson(), + }; + +GhCreateIssueCreateIssuePayload _$GhCreateIssueCreateIssuePayloadFromJson( + Map json) { + return GhCreateIssueCreateIssuePayload() + ..issue = json['issue'] == null + ? null + : GhCreateIssueIssue.fromJson(json['issue'] as Map); +} + +Map _$GhCreateIssueCreateIssuePayloadToJson( + GhCreateIssueCreateIssuePayload instance) => + { + 'issue': instance.issue?.toJson(), + }; + +GhCreateIssueIssue _$GhCreateIssueIssueFromJson(Map json) { + return GhCreateIssueIssue() + ..number = json['number'] as int + ..repository = json['repository'] == null + ? null + : GhCreateIssueRepository.fromJson( + json['repository'] as Map) + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueIssueToJson(GhCreateIssueIssue instance) => + { + 'number': instance.number, + 'repository': instance.repository?.toJson(), + '__typename': instance.resolveType, + }; + +GhCreateIssueRepository _$GhCreateIssueRepositoryFromJson( + Map json) { + return GhCreateIssueRepository() + ..owner = json['owner'] == null + ? null + : GhCreateIssueRepositoryOwner.fromJson( + json['owner'] as Map) + ..name = json['name'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueRepositoryToJson( + GhCreateIssueRepository instance) => + { + 'owner': instance.owner?.toJson(), + 'name': instance.name, + '__typename': instance.resolveType, + }; + +GhCreateIssueRepositoryOwner _$GhCreateIssueRepositoryOwnerFromJson( + Map json) { + return GhCreateIssueRepositoryOwner() + ..login = json['login'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueRepositoryOwnerToJson( + GhCreateIssueRepositoryOwner instance) => + { + 'login': instance.login, + '__typename': instance.resolveType, + }; + +GhCreateIssuePinnableItem _$GhCreateIssuePinnableItemFromJson( + Map json) { + return GhCreateIssuePinnableItem(); +} + +Map _$GhCreateIssuePinnableItemToJson( + GhCreateIssuePinnableItem instance) => + {}; + +GhCreateIssueNode _$GhCreateIssueNodeFromJson(Map json) { + return GhCreateIssueNode()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueNodeToJson(GhCreateIssueNode instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueProjectOwner _$GhCreateIssueProjectOwnerFromJson( + Map json) { + return GhCreateIssueProjectOwner() + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueProjectOwnerToJson( + GhCreateIssueProjectOwner instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueRegistryPackageOwner _$GhCreateIssueRegistryPackageOwnerFromJson( + Map json) { + return GhCreateIssueRegistryPackageOwner() + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueRegistryPackageOwnerToJson( + GhCreateIssueRegistryPackageOwner instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueRegistryPackageSearch _$GhCreateIssueRegistryPackageSearchFromJson( + Map json) { + return GhCreateIssueRegistryPackageSearch() + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueRegistryPackageSearchToJson( + GhCreateIssueRegistryPackageSearch instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueSubscribable _$GhCreateIssueSubscribableFromJson( + Map json) { + return GhCreateIssueSubscribable() + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueSubscribableToJson( + GhCreateIssueSubscribable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueStarrable _$GhCreateIssueStarrableFromJson( + Map json) { + return GhCreateIssueStarrable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueStarrableToJson( + GhCreateIssueStarrable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueUniformResourceLocatable + _$GhCreateIssueUniformResourceLocatableFromJson(Map json) { + return GhCreateIssueUniformResourceLocatable() + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueUniformResourceLocatableToJson( + GhCreateIssueUniformResourceLocatable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueRepositoryInfo _$GhCreateIssueRepositoryInfoFromJson( + Map json) { + return GhCreateIssueRepositoryInfo() + ..owner = json['owner'] == null + ? null + : GhCreateIssueRepositoryOwner.fromJson( + json['owner'] as Map) + ..name = json['name'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueRepositoryInfoToJson( + GhCreateIssueRepositoryInfo instance) => + { + 'owner': instance.owner?.toJson(), + 'name': instance.name, + '__typename': instance.resolveType, + }; + +GhCreateIssueProjectCardItem _$GhCreateIssueProjectCardItemFromJson( + Map json) { + return GhCreateIssueProjectCardItem(); +} + +Map _$GhCreateIssueProjectCardItemToJson( + GhCreateIssueProjectCardItem instance) => + {}; + +GhCreateIssueAssignable _$GhCreateIssueAssignableFromJson( + Map json) { + return GhCreateIssueAssignable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueAssignableToJson( + GhCreateIssueAssignable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueClosable _$GhCreateIssueClosableFromJson( + Map json) { + return GhCreateIssueClosable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueClosableToJson( + GhCreateIssueClosable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueComment _$GhCreateIssueCommentFromJson(Map json) { + return GhCreateIssueComment()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueCommentToJson( + GhCreateIssueComment instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueUpdatable _$GhCreateIssueUpdatableFromJson( + Map json) { + return GhCreateIssueUpdatable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueUpdatableToJson( + GhCreateIssueUpdatable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueUpdatableComment _$GhCreateIssueUpdatableCommentFromJson( + Map json) { + return GhCreateIssueUpdatableComment() + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueUpdatableCommentToJson( + GhCreateIssueUpdatableComment instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueLabelable _$GhCreateIssueLabelableFromJson( + Map json) { + return GhCreateIssueLabelable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueLabelableToJson( + GhCreateIssueLabelable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueLockable _$GhCreateIssueLockableFromJson( + Map json) { + return GhCreateIssueLockable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueLockableToJson( + GhCreateIssueLockable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueReactable _$GhCreateIssueReactableFromJson( + Map json) { + return GhCreateIssueReactable()..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueReactableToJson( + GhCreateIssueReactable instance) => + { + '__typename': instance.resolveType, + }; + +GhCreateIssueRepositoryNode _$GhCreateIssueRepositoryNodeFromJson( + Map json) { + return GhCreateIssueRepositoryNode() + ..repository = json['repository'] == null + ? null + : GhCreateIssueRepository.fromJson( + json['repository'] as Map) + ..resolveType = json['__typename'] as String; +} + +Map _$GhCreateIssueRepositoryNodeToJson( + GhCreateIssueRepositoryNode instance) => + { + 'repository': instance.repository?.toJson(), + '__typename': instance.resolveType, + }; + +GhCreateIssueArguments _$GhCreateIssueArgumentsFromJson( + Map json) { + return GhCreateIssueArguments( + repoId: json['repoId'] as String, + title: json['title'] as String, + body: json['body'] as String, + ); +} + +Map _$GhCreateIssueArgumentsToJson( + GhCreateIssueArguments instance) => + { + 'repoId': instance.repoId, + 'title': instance.title, + 'body': instance.body, + }; + +GhRepoId _$GhRepoIdFromJson(Map json) { + return GhRepoId() + ..repository = json['repository'] == null + ? null + : GhRepoIdRepository.fromJson( + json['repository'] as Map); +} + +Map _$GhRepoIdToJson(GhRepoId instance) => { + 'repository': instance.repository?.toJson(), + }; + +GhRepoIdRepository _$GhRepoIdRepositoryFromJson(Map json) { + return GhRepoIdRepository() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdRepositoryToJson(GhRepoIdRepository instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdPinnableItem _$GhRepoIdPinnableItemFromJson(Map json) { + return GhRepoIdPinnableItem(); +} + +Map _$GhRepoIdPinnableItemToJson( + GhRepoIdPinnableItem instance) => + {}; + +GhRepoIdNode _$GhRepoIdNodeFromJson(Map json) { + return GhRepoIdNode() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdNodeToJson(GhRepoIdNode instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdProjectOwner _$GhRepoIdProjectOwnerFromJson(Map json) { + return GhRepoIdProjectOwner() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdProjectOwnerToJson( + GhRepoIdProjectOwner instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdRegistryPackageOwner _$GhRepoIdRegistryPackageOwnerFromJson( + Map json) { + return GhRepoIdRegistryPackageOwner() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdRegistryPackageOwnerToJson( + GhRepoIdRegistryPackageOwner instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdRegistryPackageSearch _$GhRepoIdRegistryPackageSearchFromJson( + Map json) { + return GhRepoIdRegistryPackageSearch() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdRegistryPackageSearchToJson( + GhRepoIdRegistryPackageSearch instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdSubscribable _$GhRepoIdSubscribableFromJson(Map json) { + return GhRepoIdSubscribable() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdSubscribableToJson( + GhRepoIdSubscribable instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdStarrable _$GhRepoIdStarrableFromJson(Map json) { + return GhRepoIdStarrable() + ..id = json['id'] as String + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdStarrableToJson(GhRepoIdStarrable instance) => + { + 'id': instance.id, + '__typename': instance.resolveType, + }; + +GhRepoIdUniformResourceLocatable _$GhRepoIdUniformResourceLocatableFromJson( + Map json) { + return GhRepoIdUniformResourceLocatable() + ..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdUniformResourceLocatableToJson( + GhRepoIdUniformResourceLocatable instance) => + { + '__typename': instance.resolveType, + }; + +GhRepoIdRepositoryInfo _$GhRepoIdRepositoryInfoFromJson( + Map json) { + return GhRepoIdRepositoryInfo()..resolveType = json['__typename'] as String; +} + +Map _$GhRepoIdRepositoryInfoToJson( + GhRepoIdRepositoryInfo instance) => + { + '__typename': instance.resolveType, + }; + +GhRepoIdArguments _$GhRepoIdArgumentsFromJson(Map json) { + return GhRepoIdArguments( + owner: json['owner'] as String, + name: json['name'] as String, + ); +} + +Map _$GhRepoIdArgumentsToJson(GhRepoIdArguments instance) => + { + 'owner': instance.owner, + 'name': instance.name, + }; diff --git a/lib/graphql/gh_create_issue.graphql b/lib/graphql/gh_create_issue.graphql new file mode 100644 index 0000000..0b0f907 --- /dev/null +++ b/lib/graphql/gh_create_issue.graphql @@ -0,0 +1,13 @@ +mutation GhCreateIssue($repoId: ID!, $title: String!, $body: String!) { + createIssue(input: { repositoryId: $repoId, title: $title, body: $body }) { + issue { + number + repository { + owner { + login + } + name + } + } + } +} diff --git a/lib/graphql/gh_repo_id.graphql b/lib/graphql/gh_repo_id.graphql new file mode 100644 index 0000000..60274c4 --- /dev/null +++ b/lib/graphql/gh_repo_id.graphql @@ -0,0 +1,5 @@ +query GhRepoId($owner: String!, $name: String!) { + repository(owner: $owner, name: $name) { + id + } +} diff --git a/lib/models/auth.dart b/lib/models/auth.dart index 5ff56eb..9e6dd49 100644 --- a/lib/models/auth.dart +++ b/lib/models/auth.dart @@ -272,26 +272,6 @@ class AuthModel with ChangeNotifier { .timeout(_timeoutDuration); } - Future postWithCredentials( - String url, { - String contentType = 'application/json', - Map body = const {}, - }) async { - return http - .post( - _apiPrefix + url, - headers: {..._headers, HttpHeaders.contentTypeHeader: contentType}, - body: json.encode(body), - ) - .timeout(_timeoutDuration); - } - - Future deleteWithCredentials(String url) async { - await http - .delete(_apiPrefix + url, headers: _headers) - .timeout(_timeoutDuration); - } - String _oauthState; void redirectToGithubOauth() { _oauthState = nanoid(); diff --git a/lib/screens/issue_form.dart b/lib/screens/issue_form.dart index 0946815..c87d3ce 100644 --- a/lib/screens/issue_form.dart +++ b/lib/screens/issue_form.dart @@ -1,8 +1,6 @@ -import 'dart:io'; - -import 'package:fimber/fimber.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:git_touch/graphql/gh.dart'; import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/theme.dart'; import 'package:git_touch/scaffolds/common.dart'; @@ -27,11 +25,8 @@ class IssueFormScreen extends StatefulWidget { } class _IssueFormScreenState extends State { - String get owner => widget.owner; - String get name => widget.name; - - String _title = ''; - String _body = ''; + var _title = ''; + var _body = ''; @override Widget build(BuildContext context) { @@ -65,21 +60,24 @@ class _IssueFormScreenState extends State { CupertinoButton.filled( child: Text('Submit'), onPressed: () async { - try { - var res = - await Provider.of(context).postWithCredentials( - '/repos/$owner/$name/issues', - body: {'title': _title, 'body': _body}, - ); - if (res.statusCode != HttpStatus.created) { - throw 'Create fail, response: ${res.body}'; - } - await Provider.of(context) - .showConfirm(context, Text('Issue created')); - Navigator.of(context).pop(); - } catch (err) { - Fimber.e('postWithCredentials failed', ex: err); // TODO: - } + final auth = Provider.of(context); + final theme = Provider.of(context); + final r0 = await auth.gqlClient.execute( + GhRepoIdQuery( + variables: + GhRepoIdArguments(owner: widget.owner, name: widget.name), + ), + ); + final res = await auth.gqlClient.execute(GhCreateIssueQuery( + variables: GhCreateIssueArguments( + repoId: r0.data.repository.id, title: _title, body: _body), + )); + final issue = res.data.createIssue.issue; + await theme.push( + context, + '/${issue.repository.owner.login}/${issue.repository.name}/issues/${issue.number}', + replace: true, + ); }, ), ],