All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.kdsl.connector.graphql.schema.BuildValidationRunsQuery Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
// AUTO-GENERATED FILE. DO NOT MODIFY.
//
// This class was automatically generated by Apollo GraphQL plugin from the GraphQL queries it found.
// It should not be modified by hand.
//
package net.nemerosa.ontrack.kdsl.connector.graphql.schema;

import com.apollographql.apollo.api.Operation;
import com.apollographql.apollo.api.OperationName;
import com.apollographql.apollo.api.Query;
import com.apollographql.apollo.api.Response;
import com.apollographql.apollo.api.ResponseField;
import com.apollographql.apollo.api.ScalarTypeAdapters;
import com.apollographql.apollo.api.internal.InputFieldMarshaller;
import com.apollographql.apollo.api.internal.InputFieldWriter;
import com.apollographql.apollo.api.internal.OperationRequestBodyComposer;
import com.apollographql.apollo.api.internal.QueryDocumentMinifier;
import com.apollographql.apollo.api.internal.ResponseFieldMapper;
import com.apollographql.apollo.api.internal.ResponseFieldMarshaller;
import com.apollographql.apollo.api.internal.ResponseReader;
import com.apollographql.apollo.api.internal.ResponseWriter;
import com.apollographql.apollo.api.internal.SimpleOperationResponseParser;
import com.apollographql.apollo.api.internal.UnmodifiableMapBuilder;
import com.apollographql.apollo.api.internal.Utils;
import java.io.IOException;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.nemerosa.ontrack.kdsl.connector.graphql.schema.fragment.ValidationRunFragment;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;

public final class BuildValidationRunsQuery implements Query {
  public static final String OPERATION_ID = "0bd9d55f08ecb311c253393f2522ad1b4d496ffe4fd6f05f1d3dfdb84a19243a";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query BuildValidationRuns($buildId: Int!, $validationStamp: String!, $count: Int! = 50) {\n"
        + "  builds(id: $buildId) {\n"
        + "    __typename\n"
        + "    validationRuns(count: $count, validationStamp: $validationStamp) {\n"
        + "      __typename\n"
        + "      ...ValidationRunFragment\n"
        + "    }\n"
        + "  }\n"
        + "}\n"
        + "fragment ValidationRunFragment on ValidationRun {\n"
        + "  __typename\n"
        + "  id\n"
        + "  description\n"
        + "  creation {\n"
        + "    __typename\n"
        + "    user\n"
        + "    time\n"
        + "  }\n"
        + "  data {\n"
        + "    __typename\n"
        + "    descriptor {\n"
        + "      __typename\n"
        + "      id\n"
        + "    }\n"
        + "    data\n"
        + "  }\n"
        + "  validationRunStatuses {\n"
        + "    __typename\n"
        + "    statusID {\n"
        + "      __typename\n"
        + "      id\n"
        + "    }\n"
        + "    description\n"
        + "    annotatedDescription\n"
        + "    creation {\n"
        + "      __typename\n"
        + "      user\n"
        + "      time\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

  public static final OperationName OPERATION_NAME = new OperationName() {
    @Override
    public String name() {
      return "BuildValidationRuns";
    }
  };

  private final BuildValidationRunsQuery.Variables variables;

  public BuildValidationRunsQuery(int buildId, @NotNull String validationStamp, int count) {
    Utils.checkNotNull(validationStamp, "validationStamp == null");
    variables = new BuildValidationRunsQuery.Variables(buildId, validationStamp, count);
  }

  @Override
  public String operationId() {
    return OPERATION_ID;
  }

  @Override
  public String queryDocument() {
    return QUERY_DOCUMENT;
  }

  @Override
  public BuildValidationRunsQuery.Data wrapData(BuildValidationRunsQuery.Data data) {
    return data;
  }

  @Override
  public BuildValidationRunsQuery.Variables variables() {
    return variables;
  }

  @Override
  public ResponseFieldMapper responseFieldMapper() {
    return new Data.Mapper();
  }

  public static Builder builder() {
    return new Builder();
  }

  @Override
  public OperationName name() {
    return OPERATION_NAME;
  }

  @Override
  @NotNull
  public Response parse(@NotNull final BufferedSource source,
      @NotNull final ScalarTypeAdapters scalarTypeAdapters) throws IOException {
    return SimpleOperationResponseParser.parse(source, this, scalarTypeAdapters);
  }

  @Override
  @NotNull
  public Response parse(@NotNull final ByteString byteString,
      @NotNull final ScalarTypeAdapters scalarTypeAdapters) throws IOException {
    return parse(new Buffer().write(byteString), scalarTypeAdapters);
  }

  @Override
  @NotNull
  public Response parse(@NotNull final BufferedSource source) throws
      IOException {
    return parse(source, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public Response parse(@NotNull final ByteString byteString) throws
      IOException {
    return parse(byteString, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public ByteString composeRequestBody(@NotNull final ScalarTypeAdapters scalarTypeAdapters) {
    return OperationRequestBodyComposer.compose(this, false, true, scalarTypeAdapters);
  }

  @NotNull
  @Override
  public ByteString composeRequestBody() {
    return OperationRequestBodyComposer.compose(this, false, true, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public ByteString composeRequestBody(final boolean autoPersistQueries,
      final boolean withQueryDocument, @NotNull final ScalarTypeAdapters scalarTypeAdapters) {
    return OperationRequestBodyComposer.compose(this, autoPersistQueries, withQueryDocument, scalarTypeAdapters);
  }

  public static final class Builder {
    private int buildId;

    private @NotNull String validationStamp;

    private int count;

    Builder() {
    }

    public Builder buildId(int buildId) {
      this.buildId = buildId;
      return this;
    }

    public Builder validationStamp(@NotNull String validationStamp) {
      this.validationStamp = validationStamp;
      return this;
    }

    public Builder count(int count) {
      this.count = count;
      return this;
    }

    public BuildValidationRunsQuery build() {
      Utils.checkNotNull(validationStamp, "validationStamp == null");
      return new BuildValidationRunsQuery(buildId, validationStamp, count);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final int buildId;

    private final @NotNull String validationStamp;

    private final int count;

    private final transient Map valueMap = new LinkedHashMap<>();

    Variables(int buildId, @NotNull String validationStamp, int count) {
      this.buildId = buildId;
      this.validationStamp = validationStamp;
      this.count = count;
      this.valueMap.put("buildId", buildId);
      this.valueMap.put("validationStamp", validationStamp);
      this.valueMap.put("count", count);
    }

    public int buildId() {
      return buildId;
    }

    public @NotNull String validationStamp() {
      return validationStamp;
    }

    public int count() {
      return count;
    }

    @Override
    public Map valueMap() {
      return Collections.unmodifiableMap(valueMap);
    }

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          writer.writeInt("buildId", buildId);
          writer.writeString("validationStamp", validationStamp);
          writer.writeInt("count", count);
        }
      };
    }
  }

  /**
   * Data from the response after executing this GraphQL operation
   */
  public static class Data implements Operation.Data {
    static final ResponseField[] $responseFields = {
      ResponseField.forList("builds", "builds", new UnmodifiableMapBuilder(1)
      .put("id", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "buildId")
        .build())
      .build(), false, Collections.emptyList())
    };

    final @NotNull List builds;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@NotNull List builds) {
      this.builds = Utils.checkNotNull(builds, "builds == null");
    }

    public @NotNull List builds() {
      return this.builds;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeList($responseFields[0], builds, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((Build) item).marshaller());
              }
            }
          });
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Data{"
          + "builds=" + builds
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Data) {
        Data that = (Data) o;
        return this.builds.equals(that.builds);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= builds.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Build.Mapper buildFieldMapper = new Build.Mapper();

      @Override
      public Data map(ResponseReader reader) {
        final List builds = reader.readList($responseFields[0], new ResponseReader.ListReader() {
          @Override
          public Build read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Build read(ResponseReader reader) {
                return buildFieldMapper.map(reader);
              }
            });
          }
        });
        return new Data(builds);
      }
    }
  }

  public static class Build {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forList("validationRuns", "validationRuns", new UnmodifiableMapBuilder(2)
      .put("count", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "count")
        .build())
      .put("validationStamp", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "validationStamp")
        .build())
      .build(), false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull List validationRuns;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Build(@NotNull String __typename, @NotNull List validationRuns) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.validationRuns = Utils.checkNotNull(validationRuns, "validationRuns == null");
    }

    public @NotNull String __typename() {
      return this.__typename;
    }

    /**
     * Validations for this build
     */
    public @NotNull List validationRuns() {
      return this.validationRuns;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeList($responseFields[1], validationRuns, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((ValidationRun) item).marshaller());
              }
            }
          });
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Build{"
          + "__typename=" + __typename + ", "
          + "validationRuns=" + validationRuns
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Build) {
        Build that = (Build) o;
        return this.__typename.equals(that.__typename)
         && this.validationRuns.equals(that.validationRuns);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= validationRuns.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final ValidationRun.Mapper validationRunFieldMapper = new ValidationRun.Mapper();

      @Override
      public Build map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final List validationRuns = reader.readList($responseFields[1], new ResponseReader.ListReader() {
          @Override
          public ValidationRun read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public ValidationRun read(ResponseReader reader) {
                return validationRunFieldMapper.map(reader);
              }
            });
          }
        });
        return new Build(__typename, validationRuns);
      }
    }
  }

  public static class ValidationRun {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    private final @NotNull Fragments fragments;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public ValidationRun(@NotNull String __typename, @NotNull Fragments fragments) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.fragments = Utils.checkNotNull(fragments, "fragments == null");
    }

    public @NotNull String __typename() {
      return this.__typename;
    }

    public @NotNull Fragments fragments() {
      return this.fragments;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          fragments.marshaller().marshal(writer);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "ValidationRun{"
          + "__typename=" + __typename + ", "
          + "fragments=" + fragments
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof ValidationRun) {
        ValidationRun that = (ValidationRun) o;
        return this.__typename.equals(that.__typename)
         && this.fragments.equals(that.fragments);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= fragments.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static class Fragments {
      final @NotNull ValidationRunFragment validationRunFragment;

      private transient volatile String $toString;

      private transient volatile int $hashCode;

      private transient volatile boolean $hashCodeMemoized;

      public Fragments(@NotNull ValidationRunFragment validationRunFragment) {
        this.validationRunFragment = Utils.checkNotNull(validationRunFragment, "validationRunFragment == null");
      }

      public @NotNull ValidationRunFragment validationRunFragment() {
        return this.validationRunFragment;
      }

      public ResponseFieldMarshaller marshaller() {
        return new ResponseFieldMarshaller() {
          @Override
          public void marshal(ResponseWriter writer) {
            writer.writeFragment(validationRunFragment.marshaller());
          }
        };
      }

      @Override
      public String toString() {
        if ($toString == null) {
          $toString = "Fragments{"
            + "validationRunFragment=" + validationRunFragment
            + "}";
        }
        return $toString;
      }

      @Override
      public boolean equals(Object o) {
        if (o == this) {
          return true;
        }
        if (o instanceof Fragments) {
          Fragments that = (Fragments) o;
          return this.validationRunFragment.equals(that.validationRunFragment);
        }
        return false;
      }

      @Override
      public int hashCode() {
        if (!$hashCodeMemoized) {
          int h = 1;
          h *= 1000003;
          h ^= validationRunFragment.hashCode();
          $hashCode = h;
          $hashCodeMemoized = true;
        }
        return $hashCode;
      }

      public static final class Mapper implements ResponseFieldMapper {
        static final ResponseField[] $responseFields = {
          ResponseField.forFragment("__typename", "__typename", Collections.emptyList())
        };

        final ValidationRunFragment.Mapper validationRunFragmentFieldMapper = new ValidationRunFragment.Mapper();

        @Override
        public @NotNull Fragments map(ResponseReader reader) {
          final ValidationRunFragment validationRunFragment = reader.readFragment($responseFields[0], new ResponseReader.ObjectReader() {
            @Override
            public ValidationRunFragment read(ResponseReader reader) {
              return validationRunFragmentFieldMapper.map(reader);
            }
          });
          return new Fragments(validationRunFragment);
        }
      }
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Fragments.Mapper fragmentsFieldMapper = new Fragments.Mapper();

      @Override
      public ValidationRun map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Fragments fragments = fragmentsFieldMapper.map(reader);
        return new ValidationRun(__typename, fragments);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy