graphql-codegen-plugin-typescript-swr 0.8.5 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +5 -0
  2. package/build/main/visitor.js +2 -2
  3. package/build/module/visitor.js +2 -2
  4. package/package.json +8 -5
  5. package/.editorconfig +0 -13
  6. package/.eslintrc.js +0 -63
  7. package/.github/CONTRIBUTING.md +0 -3
  8. package/.github/ISSUE_TEMPLATE.md +0 -9
  9. package/.github/PULL_REQUEST_TEMPLATE.md +0 -7
  10. package/.github/workflows/main.yml +0 -28
  11. package/.gitignore +0 -8
  12. package/.prettierignore +0 -3
  13. package/.prettierrc.json +0 -4
  14. package/.vscode/extensions.json +0 -8
  15. package/.vscode/launch.json +0 -29
  16. package/.vscode/settings.json +0 -41
  17. package/build/tsconfig.main.tsbuildinfo +0 -1
  18. package/build/tsconfig.module.tsbuildinfo +0 -1
  19. package/dev-test/.env +0 -1
  20. package/dev-test/codegen.yml +0 -357
  21. package/dev-test/githunt/__generated__/comment-added.subscription.stencil-component.tsx +0 -47
  22. package/dev-test/githunt/__generated__/comment.query.stencil-component.tsx +0 -68
  23. package/dev-test/githunt/__generated__/comments-page-comment.fragment.stencil-component.tsx +0 -20
  24. package/dev-test/githunt/__generated__/current-user.query.stencil-component.tsx +0 -34
  25. package/dev-test/githunt/__generated__/feed-entry.fragment.stencil-component.tsx +0 -30
  26. package/dev-test/githunt/__generated__/feed.query.stencil-component.tsx +0 -40
  27. package/dev-test/githunt/__generated__/new-entry.mutation.stencil-component.tsx +0 -35
  28. package/dev-test/githunt/__generated__/repo-info.fragment.stencil-component.tsx +0 -26
  29. package/dev-test/githunt/__generated__/submit-comment.mutation.stencil-component.tsx +0 -35
  30. package/dev-test/githunt/__generated__/vote-buttons.fragment.stencil-component.tsx +0 -16
  31. package/dev-test/githunt/__generated__/vote.mutation.stencil-component.tsx +0 -41
  32. package/dev-test/githunt/comment-added.subscription.graphql +0 -11
  33. package/dev-test/githunt/comment.query.graphql +0 -33
  34. package/dev-test/githunt/comments-page-comment.fragment.graphql +0 -9
  35. package/dev-test/githunt/current-user.query.graphql +0 -6
  36. package/dev-test/githunt/feed-entry.fragment.graphql +0 -13
  37. package/dev-test/githunt/feed.query.graphql +0 -8
  38. package/dev-test/githunt/flow.flow.js +0 -367
  39. package/dev-test/githunt/graphql-declared-modules.d.ts +0 -87
  40. package/dev-test/githunt/new-entry.mutation.graphql +0 -5
  41. package/dev-test/githunt/repo-info.fragment.graphql +0 -12
  42. package/dev-test/githunt/schema.js +0 -3
  43. package/dev-test/githunt/schema.json +0 -1750
  44. package/dev-test/githunt/submit-comment.mutation.graphql +0 -5
  45. package/dev-test/githunt/typed-document-nodes.ts +0 -892
  46. package/dev-test/githunt/types.apolloAngular.sdk.ts +0 -570
  47. package/dev-test/githunt/types.apolloAngular.ts +0 -491
  48. package/dev-test/githunt/types.avoidOptionals.ts +0 -266
  49. package/dev-test/githunt/types.d.ts +0 -261
  50. package/dev-test/githunt/types.enumsAsTypes.ts +0 -261
  51. package/dev-test/githunt/types.flatten.preResolveTypes.ts +0 -289
  52. package/dev-test/githunt/types.immutableTypes.ts +0 -267
  53. package/dev-test/githunt/types.preResolveTypes.compatibility.ts +0 -368
  54. package/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +0 -156
  55. package/dev-test/githunt/types.preResolveTypes.ts +0 -293
  56. package/dev-test/githunt/types.reactApollo.customSuffix.tsx +0 -634
  57. package/dev-test/githunt/types.reactApollo.hooks.tsx +0 -621
  58. package/dev-test/githunt/types.reactApollo.preResolveTypes.tsx +0 -648
  59. package/dev-test/githunt/types.reactApollo.tsx +0 -621
  60. package/dev-test/githunt/types.reactApollo.v2.tsx +0 -635
  61. package/dev-test/githunt/types.stencilApollo.tsx +0 -484
  62. package/dev-test/githunt/types.ts +0 -266
  63. package/dev-test/githunt/types.urql.tsx +0 -444
  64. package/dev-test/githunt/types.vueApollo.ts +0 -647
  65. package/dev-test/githunt/vote-buttons.fragment.graphql +0 -6
  66. package/dev-test/githunt/vote.mutation.graphql +0 -9
  67. package/dev-test/setup.js +0 -3
  68. package/dev-test/test-message/documents.ts +0 -46
  69. package/dev-test/test-message/schema.graphql +0 -23
  70. package/dev-test/test-message/types.tsx +0 -237
  71. package/dev-test/test-schema/env.types.ts +0 -35
  72. package/dev-test/test-schema/flow-types.flow.js +0 -139
  73. package/dev-test/test-schema/local/schema-ast.js +0 -2
  74. package/dev-test/test-schema/local/schema-formats.js +0 -20
  75. package/dev-test/test-schema/local/schema-object.js +0 -2
  76. package/dev-test/test-schema/local/schema-text.js +0 -2
  77. package/dev-test/test-schema/local/schema.graphql +0 -8
  78. package/dev-test/test-schema/resolvers-federation.ts +0 -233
  79. package/dev-test/test-schema/resolvers-root.ts +0 -178
  80. package/dev-test/test-schema/resolvers-types.ts +0 -168
  81. package/dev-test/test-schema/schema-ast.js +0 -2
  82. package/dev-test/test-schema/schema-federation.graphql +0 -30
  83. package/dev-test/test-schema/schema-formats.js +0 -38
  84. package/dev-test/test-schema/schema-json.js +0 -2
  85. package/dev-test/test-schema/schema-object.js +0 -2
  86. package/dev-test/test-schema/schema-text.js +0 -2
  87. package/dev-test/test-schema/schema-with-imports.graphql +0 -9
  88. package/dev-test/test-schema/schema-with-root.graphql +0 -22
  89. package/dev-test/test-schema/schema.graphql +0 -19
  90. package/dev-test/test-schema/schema.json +0 -1070
  91. package/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +0 -19
  92. package/dev-test/test-schema/types.preResolveTypes.ts +0 -44
  93. package/dev-test/test-schema/typings.avoidOptionals.ts +0 -27
  94. package/dev-test/test-schema/typings.enum.ts +0 -19
  95. package/dev-test/test-schema/typings.immutableTypes.ts +0 -27
  96. package/dev-test/test-schema/typings.ts +0 -156
  97. package/dev-test/test-schema/typings.wrapped.ts +0 -29
  98. package/dev-test/tsconfig.json +0 -18
  99. package/jest.config.js +0 -30
  100. package/renovate.json +0 -2
  101. package/src/config.ts +0 -29
  102. package/src/index.ts +0 -54
  103. package/src/visitor.ts +0 -259
  104. package/tests/outputs/autogenSWRKey.ts +0 -46
  105. package/tests/outputs/excludeQueries.ts +0 -13
  106. package/tests/outputs/infinite.ts +0 -49
  107. package/tests/outputs/mutations.ts +0 -19
  108. package/tests/outputs/rawRequest.ts +0 -19
  109. package/tests/outputs/straight.ts +0 -19
  110. package/tests/swr.spec.ts +0 -306
  111. package/tests/visitor.spec.ts +0 -19
  112. package/tsconfig.json +0 -32
  113. package/tsconfig.main.json +0 -11
  114. package/tsconfig.module.json +0 -13
  115. package/yarn.lock +0 -5359
@@ -1,570 +0,0 @@
1
- import { gql } from 'apollo-angular';
2
- import { Injectable } from '@angular/core';
3
- import * as Apollo from 'apollo-angular';
4
- import * as ApolloCore from '@apollo/client/core';
5
- export type Maybe<T> = T | null;
6
- export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
7
- /** All built-in and custom scalars, mapped to their actual values */
8
- export type Scalars = {
9
- ID: string;
10
- String: string;
11
- Boolean: boolean;
12
- Int: number;
13
- Float: number;
14
- };
15
-
16
- export type Query = {
17
- __typename?: 'Query';
18
- /** A feed of repository submissions */
19
- feed?: Maybe<Array<Maybe<Entry>>>;
20
- /** A single entry */
21
- entry?: Maybe<Entry>;
22
- /** Return the currently logged in user, or null if nobody is logged in */
23
- currentUser?: Maybe<User>;
24
- };
25
-
26
- export type QueryFeedArgs = {
27
- type: FeedType;
28
- offset?: Maybe<Scalars['Int']>;
29
- limit?: Maybe<Scalars['Int']>;
30
- };
31
-
32
- export type QueryEntryArgs = {
33
- repoFullName: Scalars['String'];
34
- };
35
-
36
- /** A list of options for the sort order of the feed */
37
- export enum FeedType {
38
- /** Sort by a combination of freshness and score, using Reddit's algorithm */
39
- Hot = 'HOT',
40
- /** Newest entries first */
41
- New = 'NEW',
42
- /** Highest score entries first */
43
- Top = 'TOP',
44
- }
45
-
46
- /** Information about a GitHub repository submitted to GitHunt */
47
- export type Entry = {
48
- __typename?: 'Entry';
49
- /** Information about the repository from GitHub */
50
- repository: Repository;
51
- /** The GitHub user who submitted this entry */
52
- postedBy: User;
53
- /** A timestamp of when the entry was submitted */
54
- createdAt: Scalars['Float'];
55
- /** The score of this repository, upvotes - downvotes */
56
- score: Scalars['Int'];
57
- /** The hot score of this repository */
58
- hotScore: Scalars['Float'];
59
- /** Comments posted about this repository */
60
- comments: Array<Maybe<Comment>>;
61
- /** The number of comments posted about this repository */
62
- commentCount: Scalars['Int'];
63
- /** The SQL ID of this entry */
64
- id: Scalars['Int'];
65
- /** XXX to be changed */
66
- vote: Vote;
67
- };
68
-
69
- /** Information about a GitHub repository submitted to GitHunt */
70
- export type EntryCommentsArgs = {
71
- limit?: Maybe<Scalars['Int']>;
72
- offset?: Maybe<Scalars['Int']>;
73
- };
74
-
75
- /**
76
- * A repository object from the GitHub API. This uses the exact field names returned by the
77
- * GitHub API for simplicity, even though the convention for GraphQL is usually to camel case.
78
- */
79
- export type Repository = {
80
- __typename?: 'Repository';
81
- /** Just the name of the repository, e.g. GitHunt-API */
82
- name: Scalars['String'];
83
- /** The full name of the repository with the username, e.g. apollostack/GitHunt-API */
84
- full_name: Scalars['String'];
85
- /** The description of the repository */
86
- description?: Maybe<Scalars['String']>;
87
- /** The link to the repository on GitHub */
88
- html_url: Scalars['String'];
89
- /** The number of people who have starred this repository on GitHub */
90
- stargazers_count: Scalars['Int'];
91
- /** The number of open issues on this repository on GitHub */
92
- open_issues_count?: Maybe<Scalars['Int']>;
93
- /** The owner of this repository on GitHub, e.g. apollostack */
94
- owner?: Maybe<User>;
95
- };
96
-
97
- /** A user object from the GitHub API. This uses the exact field names returned from the GitHub API. */
98
- export type User = {
99
- __typename?: 'User';
100
- /** The name of the user, e.g. apollostack */
101
- login: Scalars['String'];
102
- /** The URL to a directly embeddable image for this user's avatar */
103
- avatar_url: Scalars['String'];
104
- /** The URL of this user's GitHub page */
105
- html_url: Scalars['String'];
106
- };
107
-
108
- /** A comment about an entry, submitted by a user */
109
- export type Comment = {
110
- __typename?: 'Comment';
111
- /** The SQL ID of this entry */
112
- id: Scalars['Int'];
113
- /** The GitHub user who posted the comment */
114
- postedBy: User;
115
- /** A timestamp of when the comment was posted */
116
- createdAt: Scalars['Float'];
117
- /** The text of the comment */
118
- content: Scalars['String'];
119
- /** The repository which this comment is about */
120
- repoName: Scalars['String'];
121
- };
122
-
123
- /** XXX to be removed */
124
- export type Vote = {
125
- __typename?: 'Vote';
126
- vote_value: Scalars['Int'];
127
- };
128
-
129
- export type Mutation = {
130
- __typename?: 'Mutation';
131
- /** Submit a new repository, returns the new submission */
132
- submitRepository?: Maybe<Entry>;
133
- /** Vote on a repository submission, returns the submission that was voted on */
134
- vote?: Maybe<Entry>;
135
- /** Comment on a repository, returns the new comment */
136
- submitComment?: Maybe<Comment>;
137
- };
138
-
139
- export type MutationSubmitRepositoryArgs = {
140
- repoFullName: Scalars['String'];
141
- };
142
-
143
- export type MutationVoteArgs = {
144
- repoFullName: Scalars['String'];
145
- type: VoteType;
146
- };
147
-
148
- export type MutationSubmitCommentArgs = {
149
- repoFullName: Scalars['String'];
150
- commentContent: Scalars['String'];
151
- };
152
-
153
- /** The type of vote to record, when submitting a vote */
154
- export enum VoteType {
155
- Up = 'UP',
156
- Down = 'DOWN',
157
- Cancel = 'CANCEL',
158
- }
159
-
160
- export type Subscription = {
161
- __typename?: 'Subscription';
162
- /** Subscription fires on every comment added */
163
- commentAdded?: Maybe<Comment>;
164
- };
165
-
166
- export type SubscriptionCommentAddedArgs = {
167
- repoFullName: Scalars['String'];
168
- };
169
-
170
- export type OnCommentAddedSubscriptionVariables = Exact<{
171
- repoFullName: Scalars['String'];
172
- }>;
173
-
174
- export type OnCommentAddedSubscription = { __typename?: 'Subscription' } & {
175
- commentAdded?: Maybe<
176
- { __typename?: 'Comment' } & Pick<Comment, 'id' | 'createdAt' | 'content'> & {
177
- postedBy: { __typename?: 'User' } & Pick<User, 'login' | 'html_url'>;
178
- }
179
- >;
180
- };
181
-
182
- export type CommentQueryVariables = Exact<{
183
- repoFullName: Scalars['String'];
184
- limit?: Maybe<Scalars['Int']>;
185
- offset?: Maybe<Scalars['Int']>;
186
- }>;
187
-
188
- export type CommentQuery = { __typename?: 'Query' } & {
189
- currentUser?: Maybe<{ __typename?: 'User' } & Pick<User, 'login' | 'html_url'>>;
190
- entry?: Maybe<
191
- { __typename?: 'Entry' } & Pick<Entry, 'id' | 'createdAt' | 'commentCount'> & {
192
- postedBy: { __typename?: 'User' } & Pick<User, 'login' | 'html_url'>;
193
- comments: Array<Maybe<{ __typename?: 'Comment' } & CommentsPageCommentFragment>>;
194
- repository: { __typename?: 'Repository' } & Pick<
195
- Repository,
196
- 'description' | 'open_issues_count' | 'stargazers_count' | 'full_name' | 'html_url'
197
- >;
198
- }
199
- >;
200
- };
201
-
202
- export type CommentsPageCommentFragment = { __typename?: 'Comment' } & Pick<Comment, 'id' | 'createdAt' | 'content'> & {
203
- postedBy: { __typename?: 'User' } & Pick<User, 'login' | 'html_url'>;
204
- };
205
-
206
- export type CurrentUserForProfileQueryVariables = Exact<{ [key: string]: never }>;
207
-
208
- export type CurrentUserForProfileQuery = { __typename?: 'Query' } & {
209
- currentUser?: Maybe<{ __typename?: 'User' } & Pick<User, 'login' | 'avatar_url'>>;
210
- };
211
-
212
- export type FeedEntryFragment = { __typename?: 'Entry' } & Pick<Entry, 'id' | 'commentCount'> & {
213
- repository: { __typename?: 'Repository' } & Pick<Repository, 'full_name' | 'html_url'> & {
214
- owner?: Maybe<{ __typename?: 'User' } & Pick<User, 'avatar_url'>>;
215
- };
216
- } & VoteButtonsFragment &
217
- RepoInfoFragment;
218
-
219
- export type FeedQueryVariables = Exact<{
220
- type: FeedType;
221
- offset?: Maybe<Scalars['Int']>;
222
- limit?: Maybe<Scalars['Int']>;
223
- }>;
224
-
225
- export type FeedQuery = { __typename?: 'Query' } & {
226
- currentUser?: Maybe<{ __typename?: 'User' } & Pick<User, 'login'>>;
227
- feed?: Maybe<Array<Maybe<{ __typename?: 'Entry' } & FeedEntryFragment>>>;
228
- };
229
-
230
- export type SubmitRepositoryMutationVariables = Exact<{
231
- repoFullName: Scalars['String'];
232
- }>;
233
-
234
- export type SubmitRepositoryMutation = { __typename?: 'Mutation' } & {
235
- submitRepository?: Maybe<{ __typename?: 'Entry' } & Pick<Entry, 'createdAt'>>;
236
- };
237
-
238
- export type RepoInfoFragment = { __typename?: 'Entry' } & Pick<Entry, 'createdAt'> & {
239
- repository: { __typename?: 'Repository' } & Pick<
240
- Repository,
241
- 'description' | 'stargazers_count' | 'open_issues_count'
242
- >;
243
- postedBy: { __typename?: 'User' } & Pick<User, 'html_url' | 'login'>;
244
- };
245
-
246
- export type SubmitCommentMutationVariables = Exact<{
247
- repoFullName: Scalars['String'];
248
- commentContent: Scalars['String'];
249
- }>;
250
-
251
- export type SubmitCommentMutation = { __typename?: 'Mutation' } & {
252
- submitComment?: Maybe<{ __typename?: 'Comment' } & CommentsPageCommentFragment>;
253
- };
254
-
255
- export type VoteButtonsFragment = { __typename?: 'Entry' } & Pick<Entry, 'score'> & {
256
- vote: { __typename?: 'Vote' } & Pick<Vote, 'vote_value'>;
257
- };
258
-
259
- export type VoteMutationVariables = Exact<{
260
- repoFullName: Scalars['String'];
261
- type: VoteType;
262
- }>;
263
-
264
- export type VoteMutation = { __typename?: 'Mutation' } & {
265
- vote?: Maybe<
266
- { __typename?: 'Entry' } & Pick<Entry, 'score' | 'id'> & {
267
- vote: { __typename?: 'Vote' } & Pick<Vote, 'vote_value'>;
268
- }
269
- >;
270
- };
271
-
272
- export const CommentsPageCommentFragmentDoc = gql`
273
- fragment CommentsPageComment on Comment {
274
- id
275
- postedBy {
276
- login
277
- html_url
278
- }
279
- createdAt
280
- content
281
- }
282
- `;
283
- export const VoteButtonsFragmentDoc = gql`
284
- fragment VoteButtons on Entry {
285
- score
286
- vote {
287
- vote_value
288
- }
289
- }
290
- `;
291
- export const RepoInfoFragmentDoc = gql`
292
- fragment RepoInfo on Entry {
293
- createdAt
294
- repository {
295
- description
296
- stargazers_count
297
- open_issues_count
298
- }
299
- postedBy {
300
- html_url
301
- login
302
- }
303
- }
304
- `;
305
- export const FeedEntryFragmentDoc = gql`
306
- fragment FeedEntry on Entry {
307
- id
308
- commentCount
309
- repository {
310
- full_name
311
- html_url
312
- owner {
313
- avatar_url
314
- }
315
- }
316
- ...VoteButtons
317
- ...RepoInfo
318
- }
319
- ${VoteButtonsFragmentDoc}
320
- ${RepoInfoFragmentDoc}
321
- `;
322
- export const OnCommentAddedDocument = gql`
323
- subscription onCommentAdded($repoFullName: String!) {
324
- commentAdded(repoFullName: $repoFullName) {
325
- id
326
- postedBy {
327
- login
328
- html_url
329
- }
330
- createdAt
331
- content
332
- }
333
- }
334
- `;
335
-
336
- @Injectable({
337
- providedIn: 'root',
338
- })
339
- export class OnCommentAddedGQL extends Apollo.Subscription<
340
- OnCommentAddedSubscription,
341
- OnCommentAddedSubscriptionVariables
342
- > {
343
- document = OnCommentAddedDocument;
344
-
345
- constructor(apollo: Apollo.Apollo) {
346
- super(apollo);
347
- }
348
- }
349
- export const CommentDocument = gql`
350
- query Comment($repoFullName: String!, $limit: Int, $offset: Int) {
351
- currentUser {
352
- login
353
- html_url
354
- }
355
- entry(repoFullName: $repoFullName) {
356
- id
357
- postedBy {
358
- login
359
- html_url
360
- }
361
- createdAt
362
- comments(limit: $limit, offset: $offset) {
363
- ...CommentsPageComment
364
- }
365
- commentCount
366
- repository {
367
- full_name
368
- html_url
369
- ... on Repository {
370
- description
371
- open_issues_count
372
- stargazers_count
373
- }
374
- }
375
- }
376
- }
377
- ${CommentsPageCommentFragmentDoc}
378
- `;
379
-
380
- @Injectable({
381
- providedIn: 'root',
382
- })
383
- export class CommentGQL extends Apollo.Query<CommentQuery, CommentQueryVariables> {
384
- document = CommentDocument;
385
-
386
- constructor(apollo: Apollo.Apollo) {
387
- super(apollo);
388
- }
389
- }
390
- export const CurrentUserForProfileDocument = gql`
391
- query CurrentUserForProfile {
392
- currentUser {
393
- login
394
- avatar_url
395
- }
396
- }
397
- `;
398
-
399
- @Injectable({
400
- providedIn: 'root',
401
- })
402
- export class CurrentUserForProfileGQL extends Apollo.Query<
403
- CurrentUserForProfileQuery,
404
- CurrentUserForProfileQueryVariables
405
- > {
406
- document = CurrentUserForProfileDocument;
407
-
408
- constructor(apollo: Apollo.Apollo) {
409
- super(apollo);
410
- }
411
- }
412
- export const FeedDocument = gql`
413
- query Feed($type: FeedType!, $offset: Int, $limit: Int) {
414
- currentUser {
415
- login
416
- }
417
- feed(type: $type, offset: $offset, limit: $limit) {
418
- ...FeedEntry
419
- }
420
- }
421
- ${FeedEntryFragmentDoc}
422
- `;
423
-
424
- @Injectable({
425
- providedIn: 'root',
426
- })
427
- export class FeedGQL extends Apollo.Query<FeedQuery, FeedQueryVariables> {
428
- document = FeedDocument;
429
-
430
- constructor(apollo: Apollo.Apollo) {
431
- super(apollo);
432
- }
433
- }
434
- export const SubmitRepositoryDocument = gql`
435
- mutation submitRepository($repoFullName: String!) {
436
- submitRepository(repoFullName: $repoFullName) {
437
- createdAt
438
- }
439
- }
440
- `;
441
-
442
- @Injectable({
443
- providedIn: 'root',
444
- })
445
- export class SubmitRepositoryGQL extends Apollo.Mutation<SubmitRepositoryMutation, SubmitRepositoryMutationVariables> {
446
- document = SubmitRepositoryDocument;
447
-
448
- constructor(apollo: Apollo.Apollo) {
449
- super(apollo);
450
- }
451
- }
452
- export const SubmitCommentDocument = gql`
453
- mutation submitComment($repoFullName: String!, $commentContent: String!) {
454
- submitComment(repoFullName: $repoFullName, commentContent: $commentContent) {
455
- ...CommentsPageComment
456
- }
457
- }
458
- ${CommentsPageCommentFragmentDoc}
459
- `;
460
-
461
- @Injectable({
462
- providedIn: 'root',
463
- })
464
- export class SubmitCommentGQL extends Apollo.Mutation<SubmitCommentMutation, SubmitCommentMutationVariables> {
465
- document = SubmitCommentDocument;
466
-
467
- constructor(apollo: Apollo.Apollo) {
468
- super(apollo);
469
- }
470
- }
471
- export const VoteDocument = gql`
472
- mutation vote($repoFullName: String!, $type: VoteType!) {
473
- vote(repoFullName: $repoFullName, type: $type) {
474
- score
475
- id
476
- vote {
477
- vote_value
478
- }
479
- }
480
- }
481
- `;
482
-
483
- @Injectable({
484
- providedIn: 'root',
485
- })
486
- export class VoteGQL extends Apollo.Mutation<VoteMutation, VoteMutationVariables> {
487
- document = VoteDocument;
488
-
489
- constructor(apollo: Apollo.Apollo) {
490
- super(apollo);
491
- }
492
- }
493
-
494
- type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
495
-
496
- interface WatchQueryOptionsAlone<V> extends Omit<ApolloCore.WatchQueryOptions<V>, 'query' | 'variables'> {}
497
-
498
- interface QueryOptionsAlone<V> extends Omit<ApolloCore.QueryOptions<V>, 'query' | 'variables'> {}
499
-
500
- interface MutationOptionsAlone<T, V> extends Omit<ApolloCore.MutationOptions<T, V>, 'mutation' | 'variables'> {}
501
-
502
- interface SubscriptionOptionsAlone<V> extends Omit<ApolloCore.SubscriptionOptions<V>, 'query' | 'variables'> {}
503
-
504
- @Injectable({ providedIn: 'root' })
505
- export class ApolloAngularSDK {
506
- constructor(
507
- private onCommentAddedGql: OnCommentAddedGQL,
508
- private commentGql: CommentGQL,
509
- private currentUserForProfileGql: CurrentUserForProfileGQL,
510
- private feedGql: FeedGQL,
511
- private submitRepositoryGql: SubmitRepositoryGQL,
512
- private submitCommentGql: SubmitCommentGQL,
513
- private voteGql: VoteGQL
514
- ) {}
515
-
516
- onCommentAdded(
517
- variables: OnCommentAddedSubscriptionVariables,
518
- options?: SubscriptionOptionsAlone<OnCommentAddedSubscriptionVariables>
519
- ) {
520
- return this.onCommentAddedGql.subscribe(variables, options);
521
- }
522
-
523
- comment(variables: CommentQueryVariables, options?: QueryOptionsAlone<CommentQueryVariables>) {
524
- return this.commentGql.fetch(variables, options);
525
- }
526
-
527
- commentWatch(variables: CommentQueryVariables, options?: WatchQueryOptionsAlone<CommentQueryVariables>) {
528
- return this.commentGql.watch(variables, options);
529
- }
530
-
531
- currentUserForProfile(
532
- variables?: CurrentUserForProfileQueryVariables,
533
- options?: QueryOptionsAlone<CurrentUserForProfileQueryVariables>
534
- ) {
535
- return this.currentUserForProfileGql.fetch(variables, options);
536
- }
537
-
538
- currentUserForProfileWatch(
539
- variables?: CurrentUserForProfileQueryVariables,
540
- options?: WatchQueryOptionsAlone<CurrentUserForProfileQueryVariables>
541
- ) {
542
- return this.currentUserForProfileGql.watch(variables, options);
543
- }
544
-
545
- feed(variables: FeedQueryVariables, options?: QueryOptionsAlone<FeedQueryVariables>) {
546
- return this.feedGql.fetch(variables, options);
547
- }
548
-
549
- feedWatch(variables: FeedQueryVariables, options?: WatchQueryOptionsAlone<FeedQueryVariables>) {
550
- return this.feedGql.watch(variables, options);
551
- }
552
-
553
- submitRepository(
554
- variables: SubmitRepositoryMutationVariables,
555
- options?: MutationOptionsAlone<SubmitRepositoryMutation, SubmitRepositoryMutationVariables>
556
- ) {
557
- return this.submitRepositoryGql.mutate(variables, options);
558
- }
559
-
560
- submitComment(
561
- variables: SubmitCommentMutationVariables,
562
- options?: MutationOptionsAlone<SubmitCommentMutation, SubmitCommentMutationVariables>
563
- ) {
564
- return this.submitCommentGql.mutate(variables, options);
565
- }
566
-
567
- vote(variables: VoteMutationVariables, options?: MutationOptionsAlone<VoteMutation, VoteMutationVariables>) {
568
- return this.voteGql.mutate(variables, options);
569
- }
570
- }