Skip to content

Commit c9dddb6

Browse files
committed
renamed alias to name
1 parent 15173ed commit c9dddb6

8 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/Linq2GraphQL.Client.Subscriptions/GraphSubscription.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Linq2GraphQL.Client.Subscriptions;
44

55
public class GraphSubscription<T> : GraphBase<T, GraphSubscription<T>>
66
{
7-
public GraphSubscription(GraphClient client, string alias, OperationType operationType, List<ArgumentValue> arguments) : base(client, alias, operationType, arguments)
7+
public GraphSubscription(GraphClient client, string name, OperationType operationType, List<ArgumentValue> arguments) : base(client, name, operationType, arguments)
88
{
99
}
1010

src/Linq2GraphQL.Client.Subscriptions/GraphSubscriptionExecute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public async Task<IObservable<TResult>> StartAsync()
2323
#pragma warning disable CS4014
2424
Task.Run(sseClient.Start);
2525
#pragma warning restore CS4014
26-
return sseClient.Subscription.Select(e => ConvertResult(queryExecutor.ProcessResponse(e, QueryNode.Alias, payload.Query)));
26+
return sseClient.Subscription.Select(e => ConvertResult(queryExecutor.ProcessResponse(e, QueryNode.Name, payload.Query)));
2727
}
2828

2929
var wsClient = new WSClient(client.SubscriptionUrl, client.SubscriptionProtocol, payload);
3030
await wsClient.Start();
31-
return wsClient.Subscription.Select(e => ConvertResult(queryExecutor.ProcessResponse(e, QueryNode.Alias, payload.Query)));
31+
return wsClient.Subscription.Select(e => ConvertResult(queryExecutor.ProcessResponse(e, QueryNode.Name, payload.Query)));
3232
}
3333
}

src/Linq2GraphQL.Client/GraphBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ public abstract class GraphBase<T, TGraph>
77
protected readonly GraphClient client;
88
protected readonly OperationType operationType;
99

10-
public GraphBase(GraphClient client, string alias, OperationType operationType, List<ArgumentValue> arguments)
10+
public GraphBase(GraphClient client, string name, OperationType operationType, List<ArgumentValue> arguments)
1111
{
1212
this.client = client;
1313
this.operationType = operationType;
14-
QueryNode = new QueryNode(typeof(T), alias, arguments);
14+
QueryNode = new QueryNode(typeof(T), name, arguments);
1515
}
1616

1717
public QueryNode QueryNode { get; }

src/Linq2GraphQL.Client/GraphCursorQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Linq2GraphQL.Client;
55

66
public class GraphCursorQuery<T> : GraphBase<T, GraphCursorQuery<T>> where T : ICursorPaging
77
{
8-
public GraphCursorQuery(GraphClient client, string alias, OperationType operationType, List<ArgumentValue> arguments) : base(client, alias, operationType, arguments)
8+
public GraphCursorQuery(GraphClient client, string name, OperationType operationType, List<ArgumentValue> arguments) : base(client, name, operationType, arguments)
99
{
1010
}
1111

src/Linq2GraphQL.Client/GraphQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Linq2GraphQL.Client;
44

55
public class GraphQuery<T> : GraphBase<T, GraphQuery<T>>
66
{
7-
public GraphQuery(GraphClient client, string alias, OperationType operationType, List<ArgumentValue> arguments) : base(client, alias, operationType, arguments)
7+
public GraphQuery(GraphClient client, string name, OperationType operationType, List<ArgumentValue> arguments) : base(client, name, operationType, arguments)
88
{
99
}
1010

src/Linq2GraphQL.Client/GraphQueryExecute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public GraphQueryExecute(GraphClient client, OperationType operationType, QueryN
2424

2525
public async Task<T> ExecuteBaseAsync()
2626
{
27-
BaseResult = await queryExecutor.ExecuteRequestAsync(QueryNode.Alias, await GetRequestAsync());
27+
BaseResult = await queryExecutor.ExecuteRequestAsync(QueryNode.Name, await GetRequestAsync());
2828
return BaseResult;
2929
}
3030

src/Linq2GraphQL.Client/QueryExecutor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal QueryExecutor(GraphClient client)
1414
this.client = client;
1515
}
1616

17-
internal async Task<T> ExecuteRequestAsync(string alias, GraphQLRequest graphRequest)
17+
internal async Task<T> ExecuteRequestAsync(string name, GraphQLRequest graphRequest)
1818
{
1919
var json = JsonSerializer.Serialize(graphRequest, client.SerializerOptions);
2020

@@ -28,10 +28,10 @@ internal async Task<T> ExecuteRequestAsync(string alias, GraphQLRequest graphReq
2828
}
2929

3030
var con = await response.Content.ReadAsStringAsync();
31-
return ProcessResponse(con, alias, graphRequest.Query);
31+
return ProcessResponse(con, name, graphRequest.Query);
3232
}
3333

34-
public T ProcessResponse(string con, string alias, string query)
34+
public T ProcessResponse(string con, string name, string query)
3535
{
3636
var document = JsonDocument.Parse(con);
3737
var hasError = document.RootElement.TryGetProperty(errorPathPropertyName, out var errorElement);
@@ -43,7 +43,7 @@ public T ProcessResponse(string con, string alias, string query)
4343
}
4444

4545
var hasData = document.RootElement.TryGetProperty(dataPathPropertyName, out var dataElement);
46-
var hasResult = dataElement.TryGetProperty(alias, out var resultElement);
46+
var hasResult = dataElement.TryGetProperty(name, out var resultElement);
4747

4848
if (resultElement.ValueKind == JsonValueKind.Null)
4949
{

src/Linq2GraphQL.Client/QueryNode.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public class QueryNode
1010
private readonly bool mustHaveChildren;
1111
private readonly Type underlyingMemberType;
1212

13-
public QueryNode(MemberInfo member, string alias = null, List<ArgumentValue> arguments = null, bool interfaceProperty = false)
13+
public QueryNode(MemberInfo member, string name = null, List<ArgumentValue> arguments = null, bool interfaceProperty = false)
1414
{
15-
Alias = alias ?? member.GetCustomAttribute<JsonPropertyNameAttribute>()?.Name ?? member.Name.ToCamelCase();
15+
Name = name ?? member.GetCustomAttribute<JsonPropertyNameAttribute>()?.Name ?? member.Name.ToCamelCase();
1616
Member = member;
1717
Arguments = arguments ?? new List<ArgumentValue>();
1818
underlyingMemberType = member.GetUnderlyingType();
@@ -22,7 +22,7 @@ public QueryNode(MemberInfo member, string alias = null, List<ArgumentValue> arg
2222
}
2323

2424
public bool InterfaceProperty { get; internal set; }
25-
public string Alias { get; internal set; }
25+
public string Name { get; internal set; }
2626
public MemberInfo Member { get; internal set; }
2727
public List<QueryNode> ChildNodes { get; internal set; } = new();
2828
public List<ArgumentValue> Arguments { get; internal set; } = new();
@@ -57,17 +57,17 @@ public void SetAddPrimitiveChildren()
5757
}
5858
}
5959

60-
public void AddChildNode(MemberInfo member, string alias = null)
60+
public void AddChildNode(MemberInfo member, string name = null)
6161
{
62-
AddChildNode(new QueryNode(member, alias));
62+
AddChildNode(new QueryNode(member, name));
6363
}
6464

6565
public int Level => Parent?.Level + 1 ?? 1;
6666
public int Leaf { get; internal set; } = 1;
6767

6868
public void AddChildNode(QueryNode childNode)
6969
{
70-
var currentNode = ChildNodes.FirstOrDefault(e => e.Alias == childNode.Alias);
70+
var currentNode = ChildNodes.FirstOrDefault(e => e.Name == childNode.Name);
7171
if (currentNode == null)
7272
{
7373
childNode.Parent = this;
@@ -122,11 +122,11 @@ public void AddPrimitiveChildren(bool recursive, GraphQLSchema schema)
122122

123123
if (schema != null)
124124
{
125-
var alias = propertyInfo.GetCustomAttribute<JsonPropertyNameAttribute>()?.Name ??
125+
var name = propertyInfo.GetCustomAttribute<JsonPropertyNameAttribute>()?.Name ??
126126
Member.Name.ToCamelCase();
127-
if (schema.TypePropertyExists(typeOrListType.Name, alias))
127+
if (schema.TypePropertyExists(typeOrListType.Name, name))
128128
{
129-
AddChildNode(propertyInfo, alias);
129+
AddChildNode(propertyInfo, name);
130130
}
131131
else
132132
{
@@ -200,12 +200,12 @@ internal string GetQueryString(string indent = "")
200200

201201
if (InterfaceProperty)
202202
{
203-
query = "... on " + Alias + GetArgumentString() + Environment.NewLine;
203+
query = "... on " + Name + GetArgumentString() + Environment.NewLine;
204204

205205
}
206206
else
207207
{
208-
query = Alias + GetArgumentString() + Environment.NewLine;
208+
query = Name + GetArgumentString() + Environment.NewLine;
209209

210210
}
211211

0 commit comments

Comments
 (0)