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

net.nemerosa.ontrack.kdsl.connector.graphql.schema.FindBranchByNameQuery 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.BranchFragment;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;

public final class FindBranchByNameQuery implements Query {
  public static final String OPERATION_ID = "da3fe7eabea5e6c25f96e5bba2eac5efc2e94764ac367c63f0059d0eeb8759f3";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query FindBranchByName($project: String!, $branch: String!) {\n"
        + "  branches(project: $project, name: $branch) {\n"
        + "    __typename\n"
        + "    ...BranchFragment\n"
        + "  }\n"
        + "}\n"
        + "fragment BranchFragment on Branch {\n"
        + "  __typename\n"
        + "  id\n"
        + "  name\n"
        + "  description\n"
        + "  disabled\n"
        + "  project {\n"
        + "    __typename\n"
        + "    ...ProjectFragment\n"
        + "  }\n"
        + "}\n"
        + "fragment ProjectFragment on Project {\n"
        + "  __typename\n"
        + "  id\n"
        + "  name\n"
        + "  description\n"
        + "}"
  );

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

  private final FindBranchByNameQuery.Variables variables;

  public FindBranchByNameQuery(@NotNull String project, @NotNull String branch) {
    Utils.checkNotNull(project, "project == null");
    Utils.checkNotNull(branch, "branch == null");
    variables = new FindBranchByNameQuery.Variables(project, branch);
  }

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

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

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

  @Override
  public FindBranchByNameQuery.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 @NotNull String project;

    private @NotNull String branch;

    Builder() {
    }

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

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

    public FindBranchByNameQuery build() {
      Utils.checkNotNull(project, "project == null");
      Utils.checkNotNull(branch, "branch == null");
      return new FindBranchByNameQuery(project, branch);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final @NotNull String project;

    private final @NotNull String branch;

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

    Variables(@NotNull String project, @NotNull String branch) {
      this.project = project;
      this.branch = branch;
      this.valueMap.put("project", project);
      this.valueMap.put("branch", branch);
    }

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

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

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

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          writer.writeString("project", project);
          writer.writeString("branch", branch);
        }
      };
    }
  }

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

    final @NotNull List branches;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final Branch.Mapper branchFieldMapper = new Branch.Mapper();

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

  public static class Branch {
    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 Branch(@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 = "Branch{"
          + "__typename=" + __typename + ", "
          + "fragments=" + fragments
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Branch) {
        Branch that = (Branch) 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 BranchFragment branchFragment;

      private transient volatile String $toString;

      private transient volatile int $hashCode;

      private transient volatile boolean $hashCodeMemoized;

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

      public @NotNull BranchFragment branchFragment() {
        return this.branchFragment;
      }

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

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

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

      @Override
      public int hashCode() {
        if (!$hashCodeMemoized) {
          int h = 1;
          h *= 1000003;
          h ^= branchFragment.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 BranchFragment.Mapper branchFragmentFieldMapper = new BranchFragment.Mapper();

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy