Class GraphQLRouter

java.lang.Object
io.evitadb.externalApi.graphql.io.GraphQLRouter
All Implemented Interfaces:
com.linecorp.armeria.common.util.Unwrappable, com.linecorp.armeria.server.HttpService, com.linecorp.armeria.server.Service<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>

public class GraphQLRouter extends Object implements com.linecorp.armeria.server.HttpService
Custom HTTP router for GraphQL APIs.
Author:
Lukáš Hornych, FG Forrest a.s. (c) 2024
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    refreshCatalogApi(String catalogName, GraphQLInstanceType instanceType, graphql.GraphQL newApi)
    Swaps GraphQL instance for already registered API for defined catalog
    void
    registerCatalogApi(String catalogName, GraphQLInstanceType instanceType, graphql.GraphQL api)
    Registers new endpoints for defined catalog.
    void
    registerSystemApi(graphql.GraphQL systemApi)
    Registers new system endpoints.
    com.linecorp.armeria.common.HttpResponse
    serve(com.linecorp.armeria.server.ServiceRequestContext ctx, com.linecorp.armeria.common.HttpRequest req)
     
    void
    Unregisters all APIs associated with the defined catalog.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.linecorp.armeria.server.HttpService

    decorate, decorate, exchangeType, options

    Methods inherited from interface com.linecorp.armeria.server.Service

    as, serviceAdded, shouldCachePath, unwrap

    Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable

    equalsIgnoreWrapper, unwrapAll
  • Field Details

  • Constructor Details

    • GraphQLRouter

      public GraphQLRouter()
  • Method Details

    • serve

      @Nonnull public com.linecorp.armeria.common.HttpResponse serve(@Nonnull com.linecorp.armeria.server.ServiceRequestContext ctx, @Nonnull com.linecorp.armeria.common.HttpRequest req) throws Exception
      Specified by:
      serve in interface com.linecorp.armeria.server.HttpService
      Specified by:
      serve in interface com.linecorp.armeria.server.Service<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>
      Throws:
      Exception
    • registerSystemApi

      public void registerSystemApi(@Nonnull graphql.GraphQL systemApi)
      Registers new system endpoints.
    • registerCatalogApi

      public void registerCatalogApi(@Nonnull String catalogName, @Nonnull GraphQLInstanceType instanceType, @Nonnull graphql.GraphQL api)
      Registers new endpoints for defined catalog.
    • refreshCatalogApi

      public void refreshCatalogApi(@Nonnull String catalogName, @Nonnull GraphQLInstanceType instanceType, @Nonnull graphql.GraphQL newApi)
      Swaps GraphQL instance for already registered API for defined catalog
    • unregisterCatalogApis

      public void unregisterCatalogApis(@Nonnull String catalogName)
      Unregisters all APIs associated with the defined catalog.