-
-
Notifications
You must be signed in to change notification settings - Fork 722
/
ITypeCompletionContext.cs
95 lines (83 loc) · 2.78 KB
/
ITypeCompletionContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using HotChocolate.Resolvers;
using HotChocolate.Types;
using HotChocolate.Types.Descriptors;
#nullable enable
namespace HotChocolate.Configuration;
/// <summary>
/// Represents the type completion context which gives access to data available while
/// the type is being completed.
/// </summary>
public interface ITypeCompletionContext : ITypeSystemObjectContext
{
/// <summary>
/// Defines if the type that is being completed is the query type.
/// </summary>
bool? IsQueryType { get; }
/// <summary>
/// Defines if the type that is being completed is the mutation type.
/// </summary>
bool? IsMutationType { get; }
/// <summary>
/// Defines if the type that is being completed is the subscription type.
/// </summary>
bool? IsSubscriptionType { get; }
/// <summary>
/// Global middleware components.
/// </summary>
IReadOnlyList<FieldMiddleware> GlobalComponents { get; }
/// <summary>
/// The fallback object to type resolver.
/// </summary>
IsOfTypeFallback? IsOfType { get; }
/// <summary>
/// Tries to resolve a type by its <paramref name="typeRef" />.
/// </summary>
/// <typeparam name="T">
/// The expected type.
/// </typeparam>
/// <param name="typeRef">
/// The type reference representing the type.
/// </param>
/// <param name="type">
/// The resolved types.
/// </param>
/// <returns>
/// <c>true</c> if the type has been resolved; otherwise, <c>false</c>.
/// </returns>
bool TryGetType<T>(TypeReference typeRef, [NotNullWhen(true)] out T? type) where T : IType;
/// <summary>
/// Gets a type by it's type reference.
/// </summary>
/// <param name="typeRef">
/// The type reference representing the type.
/// </param>
/// <typeparam name="T">
/// The expected type.
/// </typeparam>
/// <returns>
/// The resolved types.
/// </returns>
/// <exception cref="SchemaException">
/// The type could not be resolved for the given <paramref name="typeRef" />.
/// </exception>
T GetType<T>(TypeReference typeRef) where T : IType;
/// <summary>
/// Rewrites a type reference to a named type reference.
/// </summary>
/// <param name="typeRef">
/// A reference to a type.
/// </param>
/// <returns>
/// Returns a direct reference to a named type.
/// </returns>
TypeReference GetNamedTypeReference(TypeReference typeRef);
/// <summary>
/// Gets all registered types of <typeparamref name="T"/>.
/// </summary>
IEnumerable<T> GetTypes<T>() where T : IType;
bool TryGetDirectiveType(
TypeReference directiveRef,
[NotNullWhen(true)] out DirectiveType? directiveType);
}