Created
November 11, 2022 12:10
-
-
Save cdhunt/e9db9851efbb744ea8b7ed8902846eab to your computer and use it in GitHub Desktop.
Generated Types from Dagger GraphQL Schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <auto-generated> This file has been auto generated. </auto-generated> | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Globalization; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.Serialization; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
#if !GRAPHQL_GENERATOR_DISABLE_NEWTONSOFT_JSON | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
#endif | |
namespace Dagger | |
{ | |
#region base classes | |
public struct GraphQlFieldMetadata | |
{ | |
public string Name { get; set; } | |
public string DefaultAlias { get; set; } | |
public bool IsComplex { get; set; } | |
public Type QueryBuilderType { get; set; } | |
} | |
public enum Formatting | |
{ | |
None, | |
Indented | |
} | |
public class GraphQlObjectTypeAttribute : global::System.Attribute | |
{ | |
public string TypeName { get; } | |
public GraphQlObjectTypeAttribute(string typeName) => TypeName = typeName; | |
} | |
#if !GRAPHQL_GENERATOR_DISABLE_NEWTONSOFT_JSON | |
public class QueryBuilderParameterConverter<T> : global::Newtonsoft.Json.JsonConverter | |
{ | |
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | |
{ | |
switch (reader.TokenType) | |
{ | |
case JsonToken.Null: | |
return null; | |
default: | |
return (QueryBuilderParameter<T>)(T)serializer.Deserialize(reader, typeof(T)); | |
} | |
} | |
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | |
{ | |
if (value == null) | |
writer.WriteNull(); | |
else | |
serializer.Serialize(writer, ((QueryBuilderParameter<T>)value).Value, typeof(T)); | |
} | |
public override bool CanConvert(Type objectType) => objectType.IsSubclassOf(typeof(QueryBuilderParameter)); | |
} | |
public class GraphQlInterfaceJsonConverter : global::Newtonsoft.Json.JsonConverter | |
{ | |
private const string FieldNameType = "__typename"; | |
private static readonly Dictionary<string, Type> InterfaceTypeMapping = | |
typeof(GraphQlInterfaceJsonConverter).Assembly.GetTypes() | |
.Select(t => new { Type = t, Attribute = t.GetCustomAttribute<GraphQlObjectTypeAttribute>() }) | |
.Where(x => x.Attribute != null && x.Type.Namespace == typeof(GraphQlInterfaceJsonConverter).Namespace) | |
.ToDictionary(x => x.Attribute.TypeName, x => x.Type); | |
public override bool CanConvert(Type objectType) => objectType.IsInterface || objectType.IsArray; | |
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | |
{ | |
while (reader.TokenType == JsonToken.Comment) | |
reader.Read(); | |
switch (reader.TokenType) | |
{ | |
case JsonToken.Null: | |
return null; | |
case JsonToken.StartObject: | |
var jObject = JObject.Load(reader); | |
if (!jObject.TryGetValue(FieldNameType, out var token) || token.Type != JTokenType.String) | |
throw CreateJsonReaderException(reader, $"\"{GetType().FullName}\" requires JSON object to contain \"{FieldNameType}\" field with type name"); | |
var typeName = token.Value<string>(); | |
if (!InterfaceTypeMapping.TryGetValue(typeName, out var type)) | |
throw CreateJsonReaderException(reader, $"type \"{typeName}\" not found"); | |
using (reader = CloneReader(jObject, reader)) | |
return serializer.Deserialize(reader, type); | |
case JsonToken.StartArray: | |
var elementType = GetElementType(objectType); | |
if (elementType == null) | |
throw CreateJsonReaderException(reader, $"array element type could not be resolved for type \"{objectType.FullName}\""); | |
return ReadArray(reader, objectType, elementType, serializer); | |
default: | |
throw CreateJsonReaderException(reader, $"unrecognized token: {reader.TokenType}"); | |
} | |
} | |
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => serializer.Serialize(writer, value); | |
private static JsonReader CloneReader(JToken jToken, JsonReader reader) | |
{ | |
var jObjectReader = jToken.CreateReader(); | |
jObjectReader.Culture = reader.Culture; | |
jObjectReader.CloseInput = reader.CloseInput; | |
jObjectReader.SupportMultipleContent = reader.SupportMultipleContent; | |
jObjectReader.DateTimeZoneHandling = reader.DateTimeZoneHandling; | |
jObjectReader.FloatParseHandling = reader.FloatParseHandling; | |
jObjectReader.DateFormatString = reader.DateFormatString; | |
jObjectReader.DateParseHandling = reader.DateParseHandling; | |
return jObjectReader; | |
} | |
private static JsonReaderException CreateJsonReaderException(JsonReader reader, string message) | |
{ | |
if (reader is IJsonLineInfo lineInfo && lineInfo.HasLineInfo()) | |
return new JsonReaderException(message, reader.Path, lineInfo.LineNumber, lineInfo.LinePosition, null); | |
return new JsonReaderException(message); | |
} | |
private static Type GetElementType(Type arrayOrGenericContainer) => | |
arrayOrGenericContainer.IsArray ? arrayOrGenericContainer.GetElementType() : arrayOrGenericContainer.GenericTypeArguments.FirstOrDefault(); | |
private IList ReadArray(JsonReader reader, Type targetType, Type elementType, JsonSerializer serializer) | |
{ | |
var list = CreateCompatibleList(targetType, elementType); | |
while (reader.Read() && reader.TokenType != JsonToken.EndArray) | |
list.Add(ReadJson(reader, elementType, null, serializer)); | |
if (!targetType.IsArray) | |
return list; | |
var array = Array.CreateInstance(elementType, list.Count); | |
list.CopyTo(array, 0); | |
return array; | |
} | |
private static IList CreateCompatibleList(Type targetContainerType, Type elementType) => | |
(IList)Activator.CreateInstance(targetContainerType.IsArray || targetContainerType.IsAbstract ? typeof(List<>).MakeGenericType(elementType) : targetContainerType); | |
} | |
#endif | |
internal static class GraphQlQueryHelper | |
{ | |
private static readonly Regex RegexWhiteSpace = new Regex(@"\s", RegexOptions.Compiled); | |
private static readonly Regex RegexGraphQlIdentifier = new Regex(@"^[_A-Za-z][_0-9A-Za-z]*$", RegexOptions.Compiled); | |
public static string GetIndentation(int level, byte indentationSize) | |
{ | |
return new String(' ', level * indentationSize); | |
} | |
public static string BuildArgumentValue(object value, string formatMask, Formatting formatting, int level, byte indentationSize) | |
{ | |
if (value is null) | |
return "null"; | |
#if !GRAPHQL_GENERATOR_DISABLE_NEWTONSOFT_JSON | |
if (value is JValue jValue) | |
{ | |
switch (jValue.Type) | |
{ | |
case JTokenType.Null: return "null"; | |
case JTokenType.Integer: | |
case JTokenType.Float: | |
case JTokenType.Boolean: | |
return BuildArgumentValue(jValue.Value, null, formatting, level, indentationSize); | |
case JTokenType.String: | |
return "\"" + ((string)jValue.Value).Replace("\"", "\\\"") + "\""; | |
default: | |
return "\"" + jValue.Value + "\""; | |
} | |
} | |
if (value is JProperty jProperty) | |
{ | |
if (RegexWhiteSpace.IsMatch(jProperty.Name)) | |
throw new ArgumentException($"JSON object keys used as GraphQL arguments must not contain whitespace; key: {jProperty.Name}"); | |
return $"{jProperty.Name}:{(formatting == Formatting.Indented ? " " : null)}{BuildArgumentValue(jProperty.Value, null, formatting, level, indentationSize)}"; | |
} | |
if (value is JObject jObject) | |
return BuildEnumerableArgument(jObject, null, formatting, level + 1, indentationSize, '{', '}'); | |
#endif | |
var enumerable = value as IEnumerable; | |
if (!String.IsNullOrEmpty(formatMask) && enumerable == null) | |
return | |
value is IFormattable formattable | |
? "\"" + formattable.ToString(formatMask, CultureInfo.InvariantCulture) + "\"" | |
: throw new ArgumentException($"Value must implement {nameof(IFormattable)} interface to use a format mask. ", nameof(value)); | |
if (value is Enum @enum) | |
return ConvertEnumToString(@enum); | |
if (value is bool @bool) | |
return @bool ? "true" : "false"; | |
if (value is DateTime dateTime) | |
return "\"" + dateTime.ToString("O") + "\""; | |
if (value is DateTimeOffset dateTimeOffset) | |
return "\"" + dateTimeOffset.ToString("O") + "\""; | |
if (value is IGraphQlInputObject inputObject) | |
return BuildInputObject(inputObject, formatting, level + 2, indentationSize); | |
if (value is Guid) | |
return "\"" + value + "\""; | |
if (value is String @string) | |
return "\"" + @string.Replace("\"", "\\\"") + "\""; | |
if (enumerable != null) | |
return BuildEnumerableArgument(enumerable, formatMask, formatting, level, indentationSize, '[', ']'); | |
if (value is short || value is ushort || value is byte || value is int || value is uint || value is long || value is ulong || value is float || value is double || value is decimal) | |
return Convert.ToString(value, CultureInfo.InvariantCulture); | |
var argumentValue = Convert.ToString(value, CultureInfo.InvariantCulture); | |
return "\"" + argumentValue + "\""; | |
} | |
private static string BuildEnumerableArgument(IEnumerable enumerable, string formatMask, Formatting formatting, int level, byte indentationSize, char openingSymbol, char closingSymbol) | |
{ | |
var builder = new StringBuilder(); | |
builder.Append(openingSymbol); | |
var delimiter = String.Empty; | |
foreach (var item in enumerable) | |
{ | |
builder.Append(delimiter); | |
if (formatting == Formatting.Indented) | |
{ | |
builder.AppendLine(); | |
builder.Append(GetIndentation(level + 1, indentationSize)); | |
} | |
builder.Append(BuildArgumentValue(item, formatMask, formatting, level, indentationSize)); | |
delimiter = ","; | |
} | |
builder.Append(closingSymbol); | |
return builder.ToString(); | |
} | |
public static string BuildInputObject(IGraphQlInputObject inputObject, Formatting formatting, int level, byte indentationSize) | |
{ | |
var builder = new StringBuilder(); | |
builder.Append("{"); | |
var isIndentedFormatting = formatting == Formatting.Indented; | |
string valueSeparator; | |
if (isIndentedFormatting) | |
{ | |
builder.AppendLine(); | |
valueSeparator = ": "; | |
} | |
else | |
valueSeparator = ":"; | |
var separator = String.Empty; | |
foreach (var propertyValue in inputObject.GetPropertyValues()) | |
{ | |
var queryBuilderParameter = propertyValue.Value as QueryBuilderParameter; | |
var value = | |
queryBuilderParameter?.Name != null | |
? "$" + queryBuilderParameter.Name | |
: BuildArgumentValue(queryBuilderParameter == null ? propertyValue.Value : queryBuilderParameter.Value, propertyValue.FormatMask, formatting, level, indentationSize); | |
builder.Append(isIndentedFormatting ? GetIndentation(level, indentationSize) : separator); | |
builder.Append(propertyValue.Name); | |
builder.Append(valueSeparator); | |
builder.Append(value); | |
separator = ","; | |
if (isIndentedFormatting) | |
builder.AppendLine(); | |
} | |
if (isIndentedFormatting) | |
builder.Append(GetIndentation(level - 1, indentationSize)); | |
builder.Append("}"); | |
return builder.ToString(); | |
} | |
public static string BuildDirective(GraphQlDirective directive, Formatting formatting, int level, byte indentationSize) | |
{ | |
if (directive == null) | |
return String.Empty; | |
var isIndentedFormatting = formatting == Formatting.Indented; | |
var indentationSpace = isIndentedFormatting ? " " : String.Empty; | |
var builder = new StringBuilder(); | |
builder.Append(indentationSpace); | |
builder.Append("@"); | |
builder.Append(directive.Name); | |
builder.Append("("); | |
string separator = null; | |
foreach (var kvp in directive.Arguments) | |
{ | |
var argumentName = kvp.Key; | |
var argument = kvp.Value; | |
builder.Append(separator); | |
builder.Append(argumentName); | |
builder.Append(":"); | |
builder.Append(indentationSpace); | |
if (argument.Name == null) | |
builder.Append(BuildArgumentValue(argument.Value, null, formatting, level, indentationSize)); | |
else | |
{ | |
builder.Append("$"); | |
builder.Append(argument.Name); | |
} | |
separator = isIndentedFormatting ? ", " : ","; | |
} | |
builder.Append(")"); | |
return builder.ToString(); | |
} | |
public static void ValidateGraphQlIdentifier(string name, string identifier) | |
{ | |
if (identifier != null && !RegexGraphQlIdentifier.IsMatch(identifier)) | |
throw new ArgumentException("value must match " + RegexGraphQlIdentifier, name); | |
} | |
private static string ConvertEnumToString(Enum @enum) | |
{ | |
var enumMember = @enum.GetType().GetField(@enum.ToString()); | |
if (enumMember == null) | |
throw new InvalidOperationException("enum member resolution failed"); | |
var enumMemberAttribute = (EnumMemberAttribute)enumMember.GetCustomAttribute(typeof(EnumMemberAttribute)); | |
return enumMemberAttribute == null | |
? @enum.ToString() | |
: enumMemberAttribute.Value; | |
} | |
} | |
internal struct InputPropertyInfo | |
{ | |
public string Name { get; set; } | |
public object Value { get; set; } | |
public string FormatMask { get; set; } | |
} | |
internal interface IGraphQlInputObject | |
{ | |
IEnumerable<InputPropertyInfo> GetPropertyValues(); | |
} | |
public interface IGraphQlQueryBuilder | |
{ | |
void Clear(); | |
void IncludeAllFields(); | |
string Build(Formatting formatting = Formatting.None, byte indentationSize = 2); | |
} | |
public struct QueryBuilderArgumentInfo | |
{ | |
public string ArgumentName { get; set; } | |
public QueryBuilderParameter ArgumentValue { get; set; } | |
public string FormatMask { get; set; } | |
} | |
public abstract class QueryBuilderParameter | |
{ | |
private string _name; | |
internal string GraphQlTypeName { get; } | |
internal object Value { get; set; } | |
public string Name | |
{ | |
get => _name; | |
set | |
{ | |
GraphQlQueryHelper.ValidateGraphQlIdentifier(nameof(Name), value); | |
_name = value; | |
} | |
} | |
protected QueryBuilderParameter(string name, string graphQlTypeName, object value) | |
{ | |
Name = name?.Trim(); | |
GraphQlTypeName = graphQlTypeName?.Replace(" ", null).Replace("\t", null).Replace("\n", null).Replace("\r", null); | |
Value = value; | |
} | |
protected QueryBuilderParameter(object value) => Value = value; | |
} | |
public class QueryBuilderParameter<T> : QueryBuilderParameter | |
{ | |
public new T Value | |
{ | |
get => base.Value == null ? default : (T)base.Value; | |
set => base.Value = value; | |
} | |
protected QueryBuilderParameter(string name, string graphQlTypeName, T value) : base(name, graphQlTypeName, value) | |
{ | |
EnsureGraphQlTypeName(graphQlTypeName); | |
} | |
protected QueryBuilderParameter(string name, string graphQlTypeName) : base(name, graphQlTypeName, null) | |
{ | |
EnsureGraphQlTypeName(graphQlTypeName); | |
} | |
private QueryBuilderParameter(T value) : base(value) | |
{ | |
} | |
public void ResetValue() => base.Value = null; | |
public static implicit operator QueryBuilderParameter<T>(T value) => new QueryBuilderParameter<T>(value); | |
public static implicit operator T(QueryBuilderParameter<T> parameter) => parameter.Value; | |
private static void EnsureGraphQlTypeName(string graphQlTypeName) | |
{ | |
if (String.IsNullOrWhiteSpace(graphQlTypeName)) | |
throw new ArgumentException("value required", nameof(graphQlTypeName)); | |
} | |
} | |
public class GraphQlQueryParameter<T> : QueryBuilderParameter<T> | |
{ | |
private string _formatMask; | |
public string FormatMask | |
{ | |
get => _formatMask; | |
set => _formatMask = | |
typeof(IFormattable).IsAssignableFrom(typeof(T)) | |
? value | |
: throw new InvalidOperationException($"Value must be of {nameof(IFormattable)} type. "); | |
} | |
public GraphQlQueryParameter(string name, string graphQlTypeName = null) | |
: base(name, graphQlTypeName ?? GetGraphQlTypeName(typeof(T))) | |
{ | |
} | |
public GraphQlQueryParameter(string name, string graphQlTypeName, T defaultValue) | |
: base(name, graphQlTypeName, defaultValue) | |
{ | |
} | |
public GraphQlQueryParameter(string name, T defaultValue, bool isNullable = true) | |
: base(name, GetGraphQlTypeName(typeof(T), isNullable), defaultValue) | |
{ | |
} | |
private static string GetGraphQlTypeName(Type valueType, bool isNullable) | |
{ | |
var graphQlTypeName = GetGraphQlTypeName(valueType); | |
if (!isNullable) | |
graphQlTypeName += "!"; | |
return graphQlTypeName; | |
} | |
private static string GetGraphQlTypeName(Type valueType) | |
{ | |
var nullableUnderlyingType = Nullable.GetUnderlyingType(valueType); | |
valueType = nullableUnderlyingType ?? valueType; | |
if (valueType.IsArray) | |
{ | |
var arrayItemType = GetGraphQlTypeName(valueType.GetElementType()); | |
return arrayItemType == null ? null : "[" + arrayItemType + "]"; | |
} | |
if (typeof(IEnumerable).IsAssignableFrom(valueType)) | |
{ | |
var genericArguments = valueType.GetGenericArguments(); | |
if (genericArguments.Length == 1) | |
{ | |
var listItemType = GetGraphQlTypeName(valueType.GetGenericArguments()[0]); | |
return listItemType == null ? null : "[" + listItemType + "]"; | |
} | |
} | |
if (GraphQlTypes.ReverseMapping.TryGetValue(valueType, out var graphQlTypeName)) | |
return graphQlTypeName; | |
if (valueType == typeof(string)) | |
return "String"; | |
var nullableSuffix = nullableUnderlyingType == null ? null : "?"; | |
graphQlTypeName = GetValueTypeGraphQlTypeName(valueType); | |
return graphQlTypeName == null ? null : graphQlTypeName + nullableSuffix; | |
} | |
private static string GetValueTypeGraphQlTypeName(Type valueType) | |
{ | |
if (valueType == typeof(bool)) | |
return "Boolean"; | |
if (valueType == typeof(float) || valueType == typeof(double) || valueType == typeof(decimal)) | |
return "Float"; | |
if (valueType == typeof(Guid)) | |
return "ID"; | |
if (valueType == typeof(sbyte) || valueType == typeof(byte) || valueType == typeof(short) || valueType == typeof(ushort) || valueType == typeof(int) || valueType == typeof(uint) || | |
valueType == typeof(long) || valueType == typeof(ulong)) | |
return "Int"; | |
return null; | |
} | |
} | |
public abstract class GraphQlDirective | |
{ | |
private readonly Dictionary<string, QueryBuilderParameter> _arguments = new Dictionary<string, QueryBuilderParameter>(); | |
internal IEnumerable<KeyValuePair<string, QueryBuilderParameter>> Arguments => _arguments; | |
public string Name { get; } | |
protected GraphQlDirective(string name) | |
{ | |
GraphQlQueryHelper.ValidateGraphQlIdentifier(nameof(name), name); | |
Name = name; | |
} | |
protected void AddArgument(string name, QueryBuilderParameter value) | |
{ | |
if (value != null) | |
_arguments[name] = value; | |
} | |
} | |
public abstract class GraphQlQueryBuilder : IGraphQlQueryBuilder | |
{ | |
private readonly Dictionary<string, GraphQlFieldCriteria> _fieldCriteria = new Dictionary<string, GraphQlFieldCriteria>(); | |
private readonly string _operationType; | |
private readonly string _operationName; | |
private Dictionary<string, GraphQlFragmentCriteria> _fragments; | |
private List<QueryBuilderArgumentInfo> _queryParameters; | |
protected abstract string TypeName { get; } | |
public abstract IReadOnlyList<GraphQlFieldMetadata> AllFields { get; } | |
protected GraphQlQueryBuilder(string operationType, string operationName) | |
{ | |
GraphQlQueryHelper.ValidateGraphQlIdentifier(nameof(operationName), operationName); | |
_operationType = operationType; | |
_operationName = operationName; | |
} | |
public virtual void Clear() | |
{ | |
_fieldCriteria.Clear(); | |
_fragments?.Clear(); | |
_queryParameters?.Clear(); | |
} | |
void IGraphQlQueryBuilder.IncludeAllFields() | |
{ | |
IncludeAllFields(); | |
} | |
public string Build(Formatting formatting = Formatting.None, byte indentationSize = 2) | |
{ | |
return Build(formatting, 1, indentationSize); | |
} | |
protected void IncludeAllFields() | |
{ | |
IncludeFields(AllFields); | |
} | |
protected virtual string Build(Formatting formatting, int level, byte indentationSize) | |
{ | |
var isIndentedFormatting = formatting == Formatting.Indented; | |
var separator = String.Empty; | |
var indentationSpace = isIndentedFormatting ? " " : String.Empty; | |
var builder = new StringBuilder(); | |
if (!String.IsNullOrEmpty(_operationType)) | |
{ | |
builder.Append(_operationType); | |
if (!String.IsNullOrEmpty(_operationName)) | |
{ | |
builder.Append(" "); | |
builder.Append(_operationName); | |
} | |
if (_queryParameters?.Count > 0) | |
{ | |
builder.Append(indentationSpace); | |
builder.Append("("); | |
foreach (var queryParameterInfo in _queryParameters) | |
{ | |
if (isIndentedFormatting) | |
{ | |
builder.AppendLine(separator); | |
builder.Append(GraphQlQueryHelper.GetIndentation(level, indentationSize)); | |
} | |
else | |
builder.Append(separator); | |
builder.Append("$"); | |
builder.Append(queryParameterInfo.ArgumentValue.Name); | |
builder.Append(":"); | |
builder.Append(indentationSpace); | |
builder.Append(queryParameterInfo.ArgumentValue.GraphQlTypeName); | |
if (!queryParameterInfo.ArgumentValue.GraphQlTypeName.EndsWith("!") && queryParameterInfo.ArgumentValue.Value is not null) | |
{ | |
builder.Append(indentationSpace); | |
builder.Append("="); | |
builder.Append(indentationSpace); | |
builder.Append(GraphQlQueryHelper.BuildArgumentValue(queryParameterInfo.ArgumentValue.Value, queryParameterInfo.FormatMask, formatting, 0, indentationSize)); | |
} | |
separator = ","; | |
} | |
builder.Append(")"); | |
} | |
} | |
builder.Append(indentationSpace); | |
builder.Append("{"); | |
if (isIndentedFormatting) | |
builder.AppendLine(); | |
separator = String.Empty; | |
foreach (var criteria in _fieldCriteria.Values.Concat(_fragments?.Values ?? Enumerable.Empty<GraphQlFragmentCriteria>())) | |
{ | |
var fieldCriteria = criteria.Build(formatting, level, indentationSize); | |
if (isIndentedFormatting) | |
builder.AppendLine(fieldCriteria); | |
else if (!String.IsNullOrEmpty(fieldCriteria)) | |
{ | |
builder.Append(separator); | |
builder.Append(fieldCriteria); | |
} | |
separator = ","; | |
} | |
if (isIndentedFormatting) | |
builder.Append(GraphQlQueryHelper.GetIndentation(level - 1, indentationSize)); | |
builder.Append("}"); | |
return builder.ToString(); | |
} | |
protected void IncludeScalarField(string fieldName, string alias, IList<QueryBuilderArgumentInfo> args, GraphQlDirective[] directives) | |
{ | |
_fieldCriteria[alias ?? fieldName] = new GraphQlScalarFieldCriteria(fieldName, alias, args, directives); | |
} | |
protected void IncludeObjectField(string fieldName, string alias, GraphQlQueryBuilder objectFieldQueryBuilder, IList<QueryBuilderArgumentInfo> args, GraphQlDirective[] directives) | |
{ | |
_fieldCriteria[alias ?? fieldName] = new GraphQlObjectFieldCriteria(fieldName, alias, objectFieldQueryBuilder, args, directives); | |
} | |
protected void IncludeFragment(GraphQlQueryBuilder objectFieldQueryBuilder, GraphQlDirective[] directives) | |
{ | |
_fragments = _fragments ?? new Dictionary<string, GraphQlFragmentCriteria>(); | |
_fragments[objectFieldQueryBuilder.TypeName] = new GraphQlFragmentCriteria(objectFieldQueryBuilder, directives); | |
} | |
protected void ExcludeField(string fieldName) | |
{ | |
if (fieldName == null) | |
throw new ArgumentNullException(nameof(fieldName)); | |
_fieldCriteria.Remove(fieldName); | |
} | |
protected void IncludeFields(IEnumerable<GraphQlFieldMetadata> fields) | |
{ | |
IncludeFields(fields, null); | |
} | |
private void IncludeFields(IEnumerable<GraphQlFieldMetadata> fields, List<Type> parentTypes) | |
{ | |
foreach (var field in fields) | |
{ | |
if (field.QueryBuilderType == null) | |
IncludeScalarField(field.Name, field.DefaultAlias, null, null); | |
else | |
{ | |
var builderType = GetType(); | |
if (parentTypes != null && parentTypes.Any(t => t.IsAssignableFrom(field.QueryBuilderType))) | |
continue; | |
parentTypes?.Add(builderType); | |
var queryBuilder = InitializeChildBuilder(builderType, field.QueryBuilderType, parentTypes); | |
var includeFragmentMethods = field.QueryBuilderType.GetMethods().Where(IsIncludeFragmentMethod); | |
foreach (var includeFragmentMethod in includeFragmentMethods) | |
includeFragmentMethod.Invoke(queryBuilder, new object[] { InitializeChildBuilder(builderType, includeFragmentMethod.GetParameters()[0].ParameterType, parentTypes) }); | |
IncludeObjectField(field.Name, field.DefaultAlias, queryBuilder, null, null); | |
} | |
} | |
} | |
private static GraphQlQueryBuilder InitializeChildBuilder(Type parentQueryBuilderType, Type queryBuilderType, List<Type> parentTypes) | |
{ | |
var queryBuilder = (GraphQlQueryBuilder)Activator.CreateInstance(queryBuilderType); | |
queryBuilder.IncludeFields(queryBuilder.AllFields, parentTypes ?? new List<Type> { parentQueryBuilderType }); | |
return queryBuilder; | |
} | |
private static bool IsIncludeFragmentMethod(MethodInfo methodInfo) | |
{ | |
if (!methodInfo.Name.StartsWith("With") || !methodInfo.Name.EndsWith("Fragment")) | |
return false; | |
var parameters = methodInfo.GetParameters(); | |
return parameters.Length == 1 && parameters[0].ParameterType.IsSubclassOf(typeof(GraphQlQueryBuilder)); | |
} | |
protected void AddParameter<T>(GraphQlQueryParameter<T> parameter) | |
{ | |
if (_queryParameters == null) | |
_queryParameters = new List<QueryBuilderArgumentInfo>(); | |
_queryParameters.Add(new QueryBuilderArgumentInfo { ArgumentValue = parameter, FormatMask = parameter.FormatMask }); | |
} | |
private abstract class GraphQlFieldCriteria | |
{ | |
private readonly IList<QueryBuilderArgumentInfo> _args; | |
private readonly GraphQlDirective[] _directives; | |
protected readonly string FieldName; | |
protected readonly string Alias; | |
protected static string GetIndentation(Formatting formatting, int level, byte indentationSize) => | |
formatting == Formatting.Indented ? GraphQlQueryHelper.GetIndentation(level, indentationSize) : null; | |
protected GraphQlFieldCriteria(string fieldName, string alias, IList<QueryBuilderArgumentInfo> args, GraphQlDirective[] directives) | |
{ | |
GraphQlQueryHelper.ValidateGraphQlIdentifier(nameof(alias), alias); | |
FieldName = fieldName; | |
Alias = alias; | |
_args = args; | |
_directives = directives; | |
} | |
public abstract string Build(Formatting formatting, int level, byte indentationSize); | |
protected string BuildArgumentClause(Formatting formatting, int level, byte indentationSize) | |
{ | |
var separator = formatting == Formatting.Indented ? " " : null; | |
var argumentCount = _args?.Count ?? 0; | |
if (argumentCount == 0) | |
return String.Empty; | |
var arguments = | |
_args.Select( | |
a => $"{a.ArgumentName}:{separator}{(a.ArgumentValue.Name == null ? GraphQlQueryHelper.BuildArgumentValue(a.ArgumentValue.Value, a.FormatMask, formatting, level, indentationSize) : "$" + a.ArgumentValue.Name)}"); | |
return $"({String.Join($",{separator}", arguments)})"; | |
} | |
protected string BuildDirectiveClause(Formatting formatting, int level, byte indentationSize) => | |
_directives == null ? null : String.Concat(_directives.Select(d => d == null ? null : GraphQlQueryHelper.BuildDirective(d, formatting, level, indentationSize))); | |
protected static string BuildAliasPrefix(string alias, Formatting formatting) | |
{ | |
var separator = formatting == Formatting.Indented ? " " : String.Empty; | |
return String.IsNullOrWhiteSpace(alias) ? null : alias + ':' + separator; | |
} | |
} | |
private class GraphQlScalarFieldCriteria : GraphQlFieldCriteria | |
{ | |
public GraphQlScalarFieldCriteria(string fieldName, string alias, IList<QueryBuilderArgumentInfo> args, GraphQlDirective[] directives) | |
: base(fieldName, alias, args, directives) | |
{ | |
} | |
public override string Build(Formatting formatting, int level, byte indentationSize) => | |
GetIndentation(formatting, level, indentationSize) + | |
BuildAliasPrefix(Alias, formatting) + | |
FieldName + | |
BuildArgumentClause(formatting, level, indentationSize) + | |
BuildDirectiveClause(formatting, level, indentationSize); | |
} | |
private class GraphQlObjectFieldCriteria : GraphQlFieldCriteria | |
{ | |
private readonly GraphQlQueryBuilder _objectQueryBuilder; | |
public GraphQlObjectFieldCriteria(string fieldName, string alias, GraphQlQueryBuilder objectQueryBuilder, IList<QueryBuilderArgumentInfo> args, GraphQlDirective[] directives) | |
: base(fieldName, alias, args, directives) | |
{ | |
_objectQueryBuilder = objectQueryBuilder; | |
} | |
public override string Build(Formatting formatting, int level, byte indentationSize) => | |
_objectQueryBuilder._fieldCriteria.Count > 0 || _objectQueryBuilder._fragments?.Count > 0 | |
? GetIndentation(formatting, level, indentationSize) + BuildAliasPrefix(Alias, formatting) + FieldName + | |
BuildArgumentClause(formatting, level, indentationSize) + BuildDirectiveClause(formatting, level, indentationSize) + _objectQueryBuilder.Build(formatting, level + 1, indentationSize) | |
: null; | |
} | |
private class GraphQlFragmentCriteria : GraphQlFieldCriteria | |
{ | |
private readonly GraphQlQueryBuilder _objectQueryBuilder; | |
public GraphQlFragmentCriteria(GraphQlQueryBuilder objectQueryBuilder, GraphQlDirective[] directives) : base(objectQueryBuilder.TypeName, null, null, directives) | |
{ | |
_objectQueryBuilder = objectQueryBuilder; | |
} | |
public override string Build(Formatting formatting, int level, byte indentationSize) => | |
_objectQueryBuilder._fieldCriteria.Count == 0 | |
? null | |
: GetIndentation(formatting, level, indentationSize) + "..." + (formatting == Formatting.Indented ? " " : null) + "on " + | |
FieldName + BuildArgumentClause(formatting, level, indentationSize) + BuildDirectiveClause(formatting, level, indentationSize) + _objectQueryBuilder.Build(formatting, level + 1, indentationSize); | |
} | |
} | |
public abstract class GraphQlQueryBuilder<TQueryBuilder> : GraphQlQueryBuilder where TQueryBuilder : GraphQlQueryBuilder<TQueryBuilder> | |
{ | |
protected GraphQlQueryBuilder(string operationType = null, string operationName = null) : base(operationType, operationName) | |
{ | |
} | |
public TQueryBuilder WithAllFields() | |
{ | |
IncludeAllFields(); | |
return (TQueryBuilder)this; | |
} | |
public TQueryBuilder WithAllScalarFields() | |
{ | |
IncludeFields(AllFields.Where(f => !f.IsComplex)); | |
return (TQueryBuilder)this; | |
} | |
public TQueryBuilder ExceptField(string fieldName) | |
{ | |
ExcludeField(fieldName); | |
return (TQueryBuilder)this; | |
} | |
public TQueryBuilder WithTypeName(string alias = null, params GraphQlDirective[] directives) | |
{ | |
IncludeScalarField("__typename", alias, null, directives); | |
return (TQueryBuilder)this; | |
} | |
protected TQueryBuilder WithScalarField(string fieldName, string alias, GraphQlDirective[] directives, IList<QueryBuilderArgumentInfo> args = null) | |
{ | |
IncludeScalarField(fieldName, alias, args, directives); | |
return (TQueryBuilder)this; | |
} | |
protected TQueryBuilder WithObjectField(string fieldName, string alias, GraphQlQueryBuilder queryBuilder, GraphQlDirective[] directives, IList<QueryBuilderArgumentInfo> args = null) | |
{ | |
IncludeObjectField(fieldName, alias, queryBuilder, args, directives); | |
return (TQueryBuilder)this; | |
} | |
protected TQueryBuilder WithFragment(GraphQlQueryBuilder queryBuilder, GraphQlDirective[] directives) | |
{ | |
IncludeFragment(queryBuilder, directives); | |
return (TQueryBuilder)this; | |
} | |
protected TQueryBuilder WithParameterInternal<T>(GraphQlQueryParameter<T> parameter) | |
{ | |
AddParameter(parameter); | |
return (TQueryBuilder)this; | |
} | |
} | |
public abstract class GraphQlResponse<TDataContract> | |
{ | |
public TDataContract Data { get; set; } | |
public ICollection<GraphQlQueryError> Errors { get; set; } | |
} | |
public class GraphQlQueryError | |
{ | |
public string Message { get; set; } | |
public ICollection<GraphQlErrorLocation> Locations { get; set; } | |
} | |
public class GraphQlErrorLocation | |
{ | |
public int Line { get; set; } | |
public int Column { get; set; } | |
} | |
#endregion | |
#region GraphQL type helpers | |
public static class GraphQlTypes | |
{ | |
public const string Boolean = "Boolean"; | |
public const string CacheId = "CacheID"; | |
public const string ContainerId = "ContainerID"; | |
public const string DateTime = "DateTime"; | |
public const string DirectoryId = "DirectoryID"; | |
public const string FileId = "FileID"; | |
public const string Float = "Float"; | |
public const string Id = "ID"; | |
public const string Int = "Int"; | |
public const string Platform = "Platform"; | |
public const string SecretId = "SecretID"; | |
public const string String = "String"; | |
public const string CacheVolume = "CacheVolume"; | |
public const string Container = "Container"; | |
public const string Directory = "Directory"; | |
public const string EnvVariable = "EnvVariable"; | |
public const string File = "File"; | |
public const string GitRef = "GitRef"; | |
public const string GitRepository = "GitRepository"; | |
public const string Host = "Host"; | |
public const string HostVariable = "HostVariable"; | |
public const string Project = "Project"; | |
public const string Query = "Query"; | |
public const string Secret = "Secret"; | |
public static readonly IReadOnlyDictionary<Type, string> ReverseMapping = | |
new Dictionary<Type, string> | |
{ | |
{ typeof(string), "String" }, | |
{ typeof(int), "Int" }, | |
{ typeof(bool), "Boolean" } | |
}; | |
} | |
#endregion | |
#region directives | |
public class SkipDirective : GraphQlDirective | |
{ | |
public SkipDirective(QueryBuilderParameter<bool> @if) : base("skip") | |
{ | |
AddArgument("if", @if); | |
} | |
} | |
public class IncludeDirective : GraphQlDirective | |
{ | |
public IncludeDirective(QueryBuilderParameter<bool> @if) : base("include") | |
{ | |
AddArgument("if", @if); | |
} | |
} | |
#endregion | |
#region builder classes | |
public class ProjectQueryBuilder : GraphQlQueryBuilder<ProjectQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "extensions", IsComplex = true, QueryBuilderType = typeof(ProjectQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "generatedCode", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "install" }, | |
new GraphQlFieldMetadata { Name = "name" }, | |
new GraphQlFieldMetadata { Name = "schema" }, | |
new GraphQlFieldMetadata { Name = "sdk" } | |
}; | |
protected override string TypeName { get { return "Project"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public ProjectQueryBuilder WithExtensions(ProjectQueryBuilder projectQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("extensions", alias, projectQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public ProjectQueryBuilder ExceptExtensions() | |
{ | |
return ExceptField("extensions"); | |
} | |
public ProjectQueryBuilder WithGeneratedCode(DirectoryQueryBuilder directoryQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("generatedCode", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public ProjectQueryBuilder ExceptGeneratedCode() | |
{ | |
return ExceptField("generatedCode"); | |
} | |
public ProjectQueryBuilder WithInstall(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("install", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ProjectQueryBuilder ExceptInstall() | |
{ | |
return ExceptField("install"); | |
} | |
public ProjectQueryBuilder WithName(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("name", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ProjectQueryBuilder ExceptName() | |
{ | |
return ExceptField("name"); | |
} | |
public ProjectQueryBuilder WithSchema(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("schema", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ProjectQueryBuilder ExceptSchema() | |
{ | |
return ExceptField("schema"); | |
} | |
public ProjectQueryBuilder WithSdk(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("sdk", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ProjectQueryBuilder ExceptSdk() | |
{ | |
return ExceptField("sdk"); | |
} | |
} | |
public class DirectoryQueryBuilder : GraphQlQueryBuilder<DirectoryQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "diff", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "directory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "entries", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "export" }, | |
new GraphQlFieldMetadata { Name = "file", IsComplex = true, QueryBuilderType = typeof(FileQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "id", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "loadProject", IsComplex = true, QueryBuilderType = typeof(ProjectQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withDirectory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withFile", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withNewDirectory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withNewFile", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withoutDirectory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withoutFile", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) } | |
}; | |
protected override string TypeName { get { return "Directory"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public DirectoryQueryBuilder WithDiff(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<object> other, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "other", ArgumentValue = other} ); | |
return WithObjectField("diff", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptDiff() | |
{ | |
return ExceptField("diff"); | |
} | |
public DirectoryQueryBuilder WithDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("directory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptDirectory() | |
{ | |
return ExceptField("directory"); | |
} | |
public DirectoryQueryBuilder WithEntries(QueryBuilderParameter<string> path = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
if (path != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithScalarField("entries", alias, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptEntries() | |
{ | |
return ExceptField("entries"); | |
} | |
public DirectoryQueryBuilder WithExport(QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithScalarField("export", alias, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptExport() | |
{ | |
return ExceptField("export"); | |
} | |
public DirectoryQueryBuilder WithFile(FileQueryBuilder fileQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("file", alias, fileQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptFile() | |
{ | |
return ExceptField("file"); | |
} | |
public DirectoryQueryBuilder WithId(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("id", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public DirectoryQueryBuilder ExceptId() | |
{ | |
return ExceptField("id"); | |
} | |
public DirectoryQueryBuilder WithLoadProject(ProjectQueryBuilder projectQueryBuilder, QueryBuilderParameter<string> configPath, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "configPath", ArgumentValue = configPath} ); | |
return WithObjectField("loadProject", alias, projectQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptLoadProject() | |
{ | |
return ExceptField("loadProject"); | |
} | |
public DirectoryQueryBuilder WithWithDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<object> directory, QueryBuilderParameter<IEnumerable<string>> exclude = null, QueryBuilderParameter<IEnumerable<string>> include = null, string alias = null, SkipDirective skip = null, IncludeDirective includeDirective = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "directory", ArgumentValue = directory} ); | |
if (exclude != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "exclude", ArgumentValue = exclude} ); | |
if (include != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "include", ArgumentValue = include} ); | |
return WithObjectField("withDirectory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, includeDirective }, args); | |
} | |
public DirectoryQueryBuilder ExceptWithDirectory() | |
{ | |
return ExceptField("withDirectory"); | |
} | |
public DirectoryQueryBuilder WithWithFile(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<object> source, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "source", ArgumentValue = source} ); | |
return WithObjectField("withFile", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptWithFile() | |
{ | |
return ExceptField("withFile"); | |
} | |
public DirectoryQueryBuilder WithWithNewDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("withNewDirectory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptWithNewDirectory() | |
{ | |
return ExceptField("withNewDirectory"); | |
} | |
public DirectoryQueryBuilder WithWithNewFile(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<string> contents = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
if (contents != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "contents", ArgumentValue = contents} ); | |
return WithObjectField("withNewFile", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptWithNewFile() | |
{ | |
return ExceptField("withNewFile"); | |
} | |
public DirectoryQueryBuilder WithWithoutDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("withoutDirectory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptWithoutDirectory() | |
{ | |
return ExceptField("withoutDirectory"); | |
} | |
public DirectoryQueryBuilder WithWithoutFile(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("withoutFile", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public DirectoryQueryBuilder ExceptWithoutFile() | |
{ | |
return ExceptField("withoutFile"); | |
} | |
} | |
public class HostQueryBuilder : GraphQlQueryBuilder<HostQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "directory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "envVariable", IsComplex = true, QueryBuilderType = typeof(HostVariableQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "workdir", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) } | |
}; | |
protected override string TypeName { get { return "Host"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public HostQueryBuilder WithDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<IEnumerable<string>> exclude = null, QueryBuilderParameter<IEnumerable<string>> include = null, string alias = null, SkipDirective skip = null, IncludeDirective includeDirective = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
if (exclude != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "exclude", ArgumentValue = exclude} ); | |
if (include != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "include", ArgumentValue = include} ); | |
return WithObjectField("directory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, includeDirective }, args); | |
} | |
public HostQueryBuilder ExceptDirectory() | |
{ | |
return ExceptField("directory"); | |
} | |
public HostQueryBuilder WithEnvVariable(HostVariableQueryBuilder hostVariableQueryBuilder, QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithObjectField("envVariable", alias, hostVariableQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public HostQueryBuilder ExceptEnvVariable() | |
{ | |
return ExceptField("envVariable"); | |
} | |
public HostQueryBuilder WithWorkdir(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<IEnumerable<string>> exclude = null, QueryBuilderParameter<IEnumerable<string>> include = null, string alias = null, SkipDirective skip = null, IncludeDirective includeDirective = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
if (exclude != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "exclude", ArgumentValue = exclude} ); | |
if (include != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "include", ArgumentValue = include} ); | |
return WithObjectField("workdir", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, includeDirective }, args); | |
} | |
public HostQueryBuilder ExceptWorkdir() | |
{ | |
return ExceptField("workdir"); | |
} | |
} | |
public class HostVariableQueryBuilder : GraphQlQueryBuilder<HostVariableQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "secret", IsComplex = true, QueryBuilderType = typeof(SecretQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "value" } | |
}; | |
protected override string TypeName { get { return "HostVariable"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public HostVariableQueryBuilder WithSecret(SecretQueryBuilder secretQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("secret", alias, secretQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public HostVariableQueryBuilder ExceptSecret() | |
{ | |
return ExceptField("secret"); | |
} | |
public HostVariableQueryBuilder WithValue(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("value", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public HostVariableQueryBuilder ExceptValue() | |
{ | |
return ExceptField("value"); | |
} | |
} | |
public class ContainerQueryBuilder : GraphQlQueryBuilder<ContainerQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "build", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "defaultArgs", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "directory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "entrypoint", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "envVariable" }, | |
new GraphQlFieldMetadata { Name = "envVariables", IsComplex = true, QueryBuilderType = typeof(EnvVariableQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "exec", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "exitCode" }, | |
new GraphQlFieldMetadata { Name = "export" }, | |
new GraphQlFieldMetadata { Name = "file", IsComplex = true, QueryBuilderType = typeof(FileQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "from", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "fs", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "id", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "mounts", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "platform", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "publish" }, | |
new GraphQlFieldMetadata { Name = "stderr", IsComplex = true, QueryBuilderType = typeof(FileQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "stdout", IsComplex = true, QueryBuilderType = typeof(FileQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "user" }, | |
new GraphQlFieldMetadata { Name = "withDefaultArgs", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withEntrypoint", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withEnvVariable", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withFS", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withMountedCache", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withMountedDirectory", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withMountedFile", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withMountedSecret", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withMountedTemp", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withSecretVariable", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withUser", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withWorkdir", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withoutEnvVariable", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "withoutMount", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "workdir" } | |
}; | |
protected override string TypeName { get { return "Container"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public ContainerQueryBuilder WithBuild(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<object> context, QueryBuilderParameter<string> dockerfile = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "context", ArgumentValue = context} ); | |
if (dockerfile != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "dockerfile", ArgumentValue = dockerfile} ); | |
return WithObjectField("build", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptBuild() | |
{ | |
return ExceptField("build"); | |
} | |
public ContainerQueryBuilder WithDefaultArgs(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("defaultArgs", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptDefaultArgs() | |
{ | |
return ExceptField("defaultArgs"); | |
} | |
public ContainerQueryBuilder WithDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("directory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptDirectory() | |
{ | |
return ExceptField("directory"); | |
} | |
public ContainerQueryBuilder WithEntrypoint(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("entrypoint", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptEntrypoint() | |
{ | |
return ExceptField("entrypoint"); | |
} | |
public ContainerQueryBuilder WithEnvVariable(QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithScalarField("envVariable", alias, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptEnvVariable() | |
{ | |
return ExceptField("envVariable"); | |
} | |
public ContainerQueryBuilder WithEnvVariables(EnvVariableQueryBuilder envVariableQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("envVariables", alias, envVariableQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptEnvVariables() | |
{ | |
return ExceptField("envVariables"); | |
} | |
public ContainerQueryBuilder WithExec(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<IEnumerable<string>> args = null, QueryBuilderParameter<string> stdin = null, QueryBuilderParameter<string> redirectStdout = null, QueryBuilderParameter<string> redirectStderr = null, QueryBuilderParameter<bool?> experimentalPrivilegedNesting = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var inputArgs = new List<QueryBuilderArgumentInfo>(); | |
if (args != null) | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "args", ArgumentValue = args} ); | |
if (stdin != null) | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "stdin", ArgumentValue = stdin} ); | |
if (redirectStdout != null) | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "redirectStdout", ArgumentValue = redirectStdout} ); | |
if (redirectStderr != null) | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "redirectStderr", ArgumentValue = redirectStderr} ); | |
if (experimentalPrivilegedNesting != null) | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "experimentalPrivilegedNesting", ArgumentValue = experimentalPrivilegedNesting} ); | |
return WithObjectField("exec", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, inputArgs); | |
} | |
public ContainerQueryBuilder ExceptExec() | |
{ | |
return ExceptField("exec"); | |
} | |
public ContainerQueryBuilder WithExitCode(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("exitCode", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptExitCode() | |
{ | |
return ExceptField("exitCode"); | |
} | |
public ContainerQueryBuilder WithExport(QueryBuilderParameter<string> path, QueryBuilderParameter<IEnumerable<object>> platformVariants = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
if (platformVariants != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "platformVariants", ArgumentValue = platformVariants} ); | |
return WithScalarField("export", alias, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptExport() | |
{ | |
return ExceptField("export"); | |
} | |
public ContainerQueryBuilder WithFile(FileQueryBuilder fileQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("file", alias, fileQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptFile() | |
{ | |
return ExceptField("file"); | |
} | |
public ContainerQueryBuilder WithFrom(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> address, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "address", ArgumentValue = address} ); | |
return WithObjectField("from", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptFrom() | |
{ | |
return ExceptField("from"); | |
} | |
public ContainerQueryBuilder WithFs(DirectoryQueryBuilder directoryQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("fs", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptFs() | |
{ | |
return ExceptField("fs"); | |
} | |
public ContainerQueryBuilder WithId(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("id", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptId() | |
{ | |
return ExceptField("id"); | |
} | |
public ContainerQueryBuilder WithMounts(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("mounts", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptMounts() | |
{ | |
return ExceptField("mounts"); | |
} | |
public ContainerQueryBuilder WithPlatform(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("platform", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptPlatform() | |
{ | |
return ExceptField("platform"); | |
} | |
public ContainerQueryBuilder WithPublish(QueryBuilderParameter<string> address, QueryBuilderParameter<IEnumerable<object>> platformVariants = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "address", ArgumentValue = address} ); | |
if (platformVariants != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "platformVariants", ArgumentValue = platformVariants} ); | |
return WithScalarField("publish", alias, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptPublish() | |
{ | |
return ExceptField("publish"); | |
} | |
public ContainerQueryBuilder WithStderr(FileQueryBuilder fileQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("stderr", alias, fileQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptStderr() | |
{ | |
return ExceptField("stderr"); | |
} | |
public ContainerQueryBuilder WithStdout(FileQueryBuilder fileQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("stdout", alias, fileQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptStdout() | |
{ | |
return ExceptField("stdout"); | |
} | |
public ContainerQueryBuilder WithUser(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("user", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptUser() | |
{ | |
return ExceptField("user"); | |
} | |
public ContainerQueryBuilder WithWithDefaultArgs(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<IEnumerable<string>> args = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var inputArgs = new List<QueryBuilderArgumentInfo>(); | |
if (args != null) | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "args", ArgumentValue = args} ); | |
return WithObjectField("withDefaultArgs", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, inputArgs); | |
} | |
public ContainerQueryBuilder ExceptWithDefaultArgs() | |
{ | |
return ExceptField("withDefaultArgs"); | |
} | |
public ContainerQueryBuilder WithWithEntrypoint(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<IEnumerable<string>> args, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var inputArgs = new List<QueryBuilderArgumentInfo>(); | |
inputArgs.Add(new QueryBuilderArgumentInfo { ArgumentName = "args", ArgumentValue = args} ); | |
return WithObjectField("withEntrypoint", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, inputArgs); | |
} | |
public ContainerQueryBuilder ExceptWithEntrypoint() | |
{ | |
return ExceptField("withEntrypoint"); | |
} | |
public ContainerQueryBuilder WithWithEnvVariable(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> name, QueryBuilderParameter<string> value, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "value", ArgumentValue = value} ); | |
return WithObjectField("withEnvVariable", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithEnvVariable() | |
{ | |
return ExceptField("withEnvVariable"); | |
} | |
public ContainerQueryBuilder WithWithFs(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<object> id, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "id", ArgumentValue = id} ); | |
return WithObjectField("withFS", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithFs() | |
{ | |
return ExceptField("withFS"); | |
} | |
public ContainerQueryBuilder WithWithMountedCache(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<object> cache, QueryBuilderParameter<object> source = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "cache", ArgumentValue = cache} ); | |
if (source != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "source", ArgumentValue = source} ); | |
return WithObjectField("withMountedCache", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithMountedCache() | |
{ | |
return ExceptField("withMountedCache"); | |
} | |
public ContainerQueryBuilder WithWithMountedDirectory(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<object> source, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "source", ArgumentValue = source} ); | |
return WithObjectField("withMountedDirectory", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithMountedDirectory() | |
{ | |
return ExceptField("withMountedDirectory"); | |
} | |
public ContainerQueryBuilder WithWithMountedFile(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<object> source, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "source", ArgumentValue = source} ); | |
return WithObjectField("withMountedFile", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithMountedFile() | |
{ | |
return ExceptField("withMountedFile"); | |
} | |
public ContainerQueryBuilder WithWithMountedSecret(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, QueryBuilderParameter<object> source, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "source", ArgumentValue = source} ); | |
return WithObjectField("withMountedSecret", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithMountedSecret() | |
{ | |
return ExceptField("withMountedSecret"); | |
} | |
public ContainerQueryBuilder WithWithMountedTemp(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("withMountedTemp", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithMountedTemp() | |
{ | |
return ExceptField("withMountedTemp"); | |
} | |
public ContainerQueryBuilder WithWithSecretVariable(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> name, QueryBuilderParameter<object> secret, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "secret", ArgumentValue = secret} ); | |
return WithObjectField("withSecretVariable", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithSecretVariable() | |
{ | |
return ExceptField("withSecretVariable"); | |
} | |
public ContainerQueryBuilder WithWithUser(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithObjectField("withUser", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithUser() | |
{ | |
return ExceptField("withUser"); | |
} | |
public ContainerQueryBuilder WithWithWorkdir(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("withWorkdir", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithWorkdir() | |
{ | |
return ExceptField("withWorkdir"); | |
} | |
public ContainerQueryBuilder WithWithoutEnvVariable(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithObjectField("withoutEnvVariable", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithoutEnvVariable() | |
{ | |
return ExceptField("withoutEnvVariable"); | |
} | |
public ContainerQueryBuilder WithWithoutMount(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithObjectField("withoutMount", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public ContainerQueryBuilder ExceptWithoutMount() | |
{ | |
return ExceptField("withoutMount"); | |
} | |
public ContainerQueryBuilder WithWorkdir(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("workdir", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public ContainerQueryBuilder ExceptWorkdir() | |
{ | |
return ExceptField("workdir"); | |
} | |
} | |
public class SecretQueryBuilder : GraphQlQueryBuilder<SecretQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "id", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "plaintext" } | |
}; | |
protected override string TypeName { get { return "Secret"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public SecretQueryBuilder WithId(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("id", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public SecretQueryBuilder ExceptId() | |
{ | |
return ExceptField("id"); | |
} | |
public SecretQueryBuilder WithPlaintext(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("plaintext", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public SecretQueryBuilder ExceptPlaintext() | |
{ | |
return ExceptField("plaintext"); | |
} | |
} | |
public class EnvVariableQueryBuilder : GraphQlQueryBuilder<EnvVariableQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "name" }, | |
new GraphQlFieldMetadata { Name = "value" } | |
}; | |
protected override string TypeName { get { return "EnvVariable"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public EnvVariableQueryBuilder WithName(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("name", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public EnvVariableQueryBuilder ExceptName() | |
{ | |
return ExceptField("name"); | |
} | |
public EnvVariableQueryBuilder WithValue(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("value", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public EnvVariableQueryBuilder ExceptValue() | |
{ | |
return ExceptField("value"); | |
} | |
} | |
public class QueryQueryBuilder : GraphQlQueryBuilder<QueryQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "cacheVolume", IsComplex = true, QueryBuilderType = typeof(CacheVolumeQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "container", IsComplex = true, QueryBuilderType = typeof(ContainerQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "defaultPlatform", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "directory", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "file", IsComplex = true, QueryBuilderType = typeof(FileQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "git", IsComplex = true, QueryBuilderType = typeof(GitRepositoryQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "host", IsComplex = true, QueryBuilderType = typeof(HostQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "http", IsComplex = true, QueryBuilderType = typeof(FileQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "project", IsComplex = true, QueryBuilderType = typeof(ProjectQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "secret", IsComplex = true, QueryBuilderType = typeof(SecretQueryBuilder) } | |
}; | |
protected override string TypeName { get { return "Query"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public QueryQueryBuilder(string operationName = null) : base("query", operationName) | |
{ | |
} | |
public QueryQueryBuilder WithParameter<T>(GraphQlQueryParameter<T> parameter) | |
{ | |
return WithParameterInternal(parameter); | |
} | |
public QueryQueryBuilder WithCacheVolume(CacheVolumeQueryBuilder cacheVolumeQueryBuilder, QueryBuilderParameter<string> key, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "key", ArgumentValue = key} ); | |
return WithObjectField("cacheVolume", alias, cacheVolumeQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptCacheVolume() | |
{ | |
return ExceptField("cacheVolume"); | |
} | |
public QueryQueryBuilder WithContainer(ContainerQueryBuilder containerQueryBuilder, QueryBuilderParameter<object> id = null, QueryBuilderParameter<object> platform = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
if (id != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "id", ArgumentValue = id} ); | |
if (platform != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "platform", ArgumentValue = platform} ); | |
return WithObjectField("container", alias, containerQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptContainer() | |
{ | |
return ExceptField("container"); | |
} | |
public QueryQueryBuilder WithDefaultPlatform(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("defaultPlatform", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public QueryQueryBuilder ExceptDefaultPlatform() | |
{ | |
return ExceptField("defaultPlatform"); | |
} | |
public QueryQueryBuilder WithDirectory(DirectoryQueryBuilder directoryQueryBuilder, QueryBuilderParameter<object> id = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
if (id != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "id", ArgumentValue = id} ); | |
return WithObjectField("directory", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptDirectory() | |
{ | |
return ExceptField("directory"); | |
} | |
public QueryQueryBuilder WithFile(FileQueryBuilder fileQueryBuilder, QueryBuilderParameter<object> id, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "id", ArgumentValue = id} ); | |
return WithObjectField("file", alias, fileQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptFile() | |
{ | |
return ExceptField("file"); | |
} | |
public QueryQueryBuilder WithGit(GitRepositoryQueryBuilder gitRepositoryQueryBuilder, QueryBuilderParameter<string> url, QueryBuilderParameter<bool?> keepGitDir = null, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "url", ArgumentValue = url} ); | |
if (keepGitDir != null) | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "keepGitDir", ArgumentValue = keepGitDir} ); | |
return WithObjectField("git", alias, gitRepositoryQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptGit() | |
{ | |
return ExceptField("git"); | |
} | |
public QueryQueryBuilder WithHost(HostQueryBuilder hostQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("host", alias, hostQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public QueryQueryBuilder ExceptHost() | |
{ | |
return ExceptField("host"); | |
} | |
public QueryQueryBuilder WithHttp(FileQueryBuilder fileQueryBuilder, QueryBuilderParameter<string> url, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "url", ArgumentValue = url} ); | |
return WithObjectField("http", alias, fileQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptHttp() | |
{ | |
return ExceptField("http"); | |
} | |
public QueryQueryBuilder WithProject(ProjectQueryBuilder projectQueryBuilder, QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithObjectField("project", alias, projectQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptProject() | |
{ | |
return ExceptField("project"); | |
} | |
public QueryQueryBuilder WithSecret(SecretQueryBuilder secretQueryBuilder, QueryBuilderParameter<object> id, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "id", ArgumentValue = id} ); | |
return WithObjectField("secret", alias, secretQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public QueryQueryBuilder ExceptSecret() | |
{ | |
return ExceptField("secret"); | |
} | |
} | |
public class FileQueryBuilder : GraphQlQueryBuilder<FileQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "contents" }, | |
new GraphQlFieldMetadata { Name = "export" }, | |
new GraphQlFieldMetadata { Name = "id", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "secret", IsComplex = true, QueryBuilderType = typeof(SecretQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "size" } | |
}; | |
protected override string TypeName { get { return "File"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public FileQueryBuilder WithContents(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("contents", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public FileQueryBuilder ExceptContents() | |
{ | |
return ExceptField("contents"); | |
} | |
public FileQueryBuilder WithExport(QueryBuilderParameter<string> path, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "path", ArgumentValue = path} ); | |
return WithScalarField("export", alias, new GraphQlDirective[] { skip, include }, args); | |
} | |
public FileQueryBuilder ExceptExport() | |
{ | |
return ExceptField("export"); | |
} | |
public FileQueryBuilder WithId(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("id", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public FileQueryBuilder ExceptId() | |
{ | |
return ExceptField("id"); | |
} | |
public FileQueryBuilder WithSecret(SecretQueryBuilder secretQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("secret", alias, secretQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public FileQueryBuilder ExceptSecret() | |
{ | |
return ExceptField("secret"); | |
} | |
public FileQueryBuilder WithSize(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("size", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public FileQueryBuilder ExceptSize() | |
{ | |
return ExceptField("size"); | |
} | |
} | |
public class GitRepositoryQueryBuilder : GraphQlQueryBuilder<GitRepositoryQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "branch", IsComplex = true, QueryBuilderType = typeof(GitRefQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "branches", IsComplex = true }, | |
new GraphQlFieldMetadata { Name = "commit", IsComplex = true, QueryBuilderType = typeof(GitRefQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "tag", IsComplex = true, QueryBuilderType = typeof(GitRefQueryBuilder) }, | |
new GraphQlFieldMetadata { Name = "tags", IsComplex = true } | |
}; | |
protected override string TypeName { get { return "GitRepository"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public GitRepositoryQueryBuilder WithBranch(GitRefQueryBuilder gitRefQueryBuilder, QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithObjectField("branch", alias, gitRefQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public GitRepositoryQueryBuilder ExceptBranch() | |
{ | |
return ExceptField("branch"); | |
} | |
public GitRepositoryQueryBuilder WithBranches(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("branches", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public GitRepositoryQueryBuilder ExceptBranches() | |
{ | |
return ExceptField("branches"); | |
} | |
public GitRepositoryQueryBuilder WithCommit(GitRefQueryBuilder gitRefQueryBuilder, QueryBuilderParameter<string> id, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "id", ArgumentValue = id} ); | |
return WithObjectField("commit", alias, gitRefQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public GitRepositoryQueryBuilder ExceptCommit() | |
{ | |
return ExceptField("commit"); | |
} | |
public GitRepositoryQueryBuilder WithTag(GitRefQueryBuilder gitRefQueryBuilder, QueryBuilderParameter<string> name, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
var args = new List<QueryBuilderArgumentInfo>(); | |
args.Add(new QueryBuilderArgumentInfo { ArgumentName = "name", ArgumentValue = name} ); | |
return WithObjectField("tag", alias, gitRefQueryBuilder, new GraphQlDirective[] { skip, include }, args); | |
} | |
public GitRepositoryQueryBuilder ExceptTag() | |
{ | |
return ExceptField("tag"); | |
} | |
public GitRepositoryQueryBuilder WithTags(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("tags", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public GitRepositoryQueryBuilder ExceptTags() | |
{ | |
return ExceptField("tags"); | |
} | |
} | |
public class GitRefQueryBuilder : GraphQlQueryBuilder<GitRefQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "digest" }, | |
new GraphQlFieldMetadata { Name = "tree", IsComplex = true, QueryBuilderType = typeof(DirectoryQueryBuilder) } | |
}; | |
protected override string TypeName { get { return "GitRef"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public GitRefQueryBuilder WithDigest(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("digest", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public GitRefQueryBuilder ExceptDigest() | |
{ | |
return ExceptField("digest"); | |
} | |
public GitRefQueryBuilder WithTree(DirectoryQueryBuilder directoryQueryBuilder, string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithObjectField("tree", alias, directoryQueryBuilder, new GraphQlDirective[] { skip, include }); | |
} | |
public GitRefQueryBuilder ExceptTree() | |
{ | |
return ExceptField("tree"); | |
} | |
} | |
public class CacheVolumeQueryBuilder : GraphQlQueryBuilder<CacheVolumeQueryBuilder> | |
{ | |
private static readonly GraphQlFieldMetadata[] AllFieldMetadata = | |
new [] | |
{ | |
new GraphQlFieldMetadata { Name = "id", IsComplex = true } | |
}; | |
protected override string TypeName { get { return "CacheVolume"; } } | |
public override IReadOnlyList<GraphQlFieldMetadata> AllFields { get { return AllFieldMetadata; } } | |
public CacheVolumeQueryBuilder WithId(string alias = null, SkipDirective skip = null, IncludeDirective include = null) | |
{ | |
return WithScalarField("id", alias, new GraphQlDirective[] { skip, include }); | |
} | |
public CacheVolumeQueryBuilder ExceptId() | |
{ | |
return ExceptField("id"); | |
} | |
} | |
#endregion | |
#region data classes | |
public class Project | |
{ | |
public ICollection<Project> Extensions { get; set; } | |
public DirectoryData GeneratedCode { get; set; } | |
public bool? Install { get; set; } | |
public string Name { get; set; } | |
public string Schema { get; set; } | |
public string Sdk { get; set; } | |
} | |
public class DirectoryData | |
{ | |
public DirectoryData Diff { get; set; } | |
public DirectoryData Directory { get; set; } | |
public ICollection<string> Entries { get; set; } | |
public bool? Export { get; set; } | |
public File File { get; set; } | |
public object Id { get; set; } | |
public Project LoadProject { get; set; } | |
public DirectoryData WithDirectory { get; set; } | |
public DirectoryData WithFile { get; set; } | |
public DirectoryData WithNewDirectory { get; set; } | |
public DirectoryData WithNewFile { get; set; } | |
public DirectoryData WithoutDirectory { get; set; } | |
public DirectoryData WithoutFile { get; set; } | |
} | |
public class Host | |
{ | |
public DirectoryData Directory { get; set; } | |
public HostVariable EnvVariable { get; set; } | |
public DirectoryData Workdir { get; set; } | |
} | |
public class HostVariable | |
{ | |
public Secret Secret { get; set; } | |
public string Value { get; set; } | |
} | |
public class Container | |
{ | |
public Container Build { get; set; } | |
public ICollection<string> DefaultArgs { get; set; } | |
public DirectoryData Directory { get; set; } | |
public ICollection<string> Entrypoint { get; set; } | |
public string EnvVariable { get; set; } | |
public ICollection<EnvVariable> EnvVariables { get; set; } | |
public Container Exec { get; set; } | |
public int? ExitCode { get; set; } | |
public bool? Export { get; set; } | |
public File File { get; set; } | |
public Container From { get; set; } | |
public DirectoryData Fs { get; set; } | |
public object Id { get; set; } | |
public ICollection<string> Mounts { get; set; } | |
public object Platform { get; set; } | |
public string Publish { get; set; } | |
public File Stderr { get; set; } | |
public File Stdout { get; set; } | |
public string User { get; set; } | |
public Container WithDefaultArgs { get; set; } | |
public Container WithEntrypoint { get; set; } | |
public Container WithEnvVariable { get; set; } | |
public Container WithFs { get; set; } | |
public Container WithMountedCache { get; set; } | |
public Container WithMountedDirectory { get; set; } | |
public Container WithMountedFile { get; set; } | |
public Container WithMountedSecret { get; set; } | |
public Container WithMountedTemp { get; set; } | |
public Container WithSecretVariable { get; set; } | |
public Container WithUser { get; set; } | |
public Container WithWorkdir { get; set; } | |
public Container WithoutEnvVariable { get; set; } | |
public Container WithoutMount { get; set; } | |
public string Workdir { get; set; } | |
} | |
public class Secret | |
{ | |
public object Id { get; set; } | |
public string Plaintext { get; set; } | |
} | |
public class EnvVariable | |
{ | |
public string Name { get; set; } | |
public string Value { get; set; } | |
} | |
public class Query | |
{ | |
public CacheVolume CacheVolume { get; set; } | |
public Container Container { get; set; } | |
public object DefaultPlatform { get; set; } | |
public DirectoryData Directory { get; set; } | |
public File File { get; set; } | |
public GitRepository Git { get; set; } | |
public Host Host { get; set; } | |
public File Http { get; set; } | |
public Project Project { get; set; } | |
public Secret Secret { get; set; } | |
} | |
public class File | |
{ | |
public string Contents { get; set; } | |
public bool? Export { get; set; } | |
public object Id { get; set; } | |
public Secret Secret { get; set; } | |
public int? Size { get; set; } | |
} | |
public class GitRepository | |
{ | |
public GitRef Branch { get; set; } | |
public ICollection<string> Branches { get; set; } | |
public GitRef Commit { get; set; } | |
public GitRef Tag { get; set; } | |
public ICollection<string> Tags { get; set; } | |
} | |
public class GitRef | |
{ | |
public string Digest { get; set; } | |
public DirectoryData Tree { get; set; } | |
} | |
public class CacheVolume | |
{ | |
public object Id { get; set; } | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment