class CypherAPI extends API {

    private static final Logger LOG = Log.logger(CypherAPI.class);
    private static final Charset UTF8 = StandardCharsets.UTF_8;
    private static final String CLIENT_CONF = "conf/remote-objects.yaml";
    private final Base64.Decoder decoder = Base64.getUrlDecoder();
    private final String basic = "Basic ";
    private final String bearer = "Bearer ";

    private CypherManager cypherManager;

    private CypherManager cypherManager() {
        if (this.cypherManager == null) {
            this.cypherManager = CypherManager.configOf(CLIENT_CONF);
        }
        return this.cypherManager;
    }

    @GET
    @Timed
    @CompressInterceptor.Compress(buffer = (1024 * 40))
    @Produces(APPLICATION_JSON_WITH_CHARSET)
    public CypherModel query(@PathParam("graph") String graph, @Context HttpHeaders headers,
                             @QueryParam("cypher") String cypher) {
        LOG.debug("Graph [{}] query by cypher: {}", graph, cypher);
        return this.queryByCypher(graph, headers, cypher);
    }

    @POST
    @Timed
    @CompressInterceptor.Compress
    @Consumes(APPLICATION_JSON)
    @Produces(APPLICATION_JSON_WITH_CHARSET)
    public CypherModel post(@PathParam("graph") String graph,
                            @Context HttpHeaders headers, String cypher) {
        LOG.debug("Graph [{}] query by cypher: {}", graph, cypher);
        return this.queryByCypher(graph, headers, cypher);
    }

    private CypherModel queryByCypher(String graph, HttpHeaders headers, String cypher) {
        E.checkArgument(graph != null && !graph.isEmpty(),
                        "The graph parameter can't be null or empty");
        E.checkArgument(cypher != null && !cypher.isEmpty(),
                        "The cypher parameter can't be null or empty");

        Map<String, String> aliases = new HashMap<>(1, 1);
        aliases.put("g", "__g_" + graph);

        return this.client(headers).submitQuery(cypher, aliases);
    }

    private CypherClient client(HttpHeaders headers) {<FILL_FUNCTION_BODY>}

    private CypherClient clientViaBasic(String auth) {
        Pair<String, String> userPass = this.toUserPass(auth);
        E.checkNotNull(userPass, "user-password-pair");

        return this.cypherManager().getClient(userPass.getLeft(), userPass.getRight());
    }

    private CypherClient clientViaToken(String auth) {
        return this.cypherManager().getClient(auth.substring(bearer.length()));
    }

    private Pair<String, String> toUserPass(String auth) {
        if (auth == null || auth.isEmpty()) {
            return null;
        }
        if (!auth.startsWith(basic)) {
            return null;
        }

        String[] split;
        try {
            String encoded = auth.substring(basic.length());
            byte[] userPass = this.decoder.decode(encoded);
            String authorization = new String(userPass, UTF8);
            split = authorization.split(":");
        } catch (Exception e) {
            LOG.error("Failed convert auth to credential.", e);
            return null;
        }

        if (split.length != 2) {
            return null;
        }
        return ImmutablePair.of(split[0], split[1]);
    }
}

        String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);

        if (auth != null && !auth.isEmpty()) {
            auth = auth.split(",")[0];
        }

        if (auth != null) {
            if (auth.startsWith(basic)) {
                return this.clientViaBasic(auth);
            } else if (auth.startsWith(bearer)) {
                return this.clientViaToken(auth);
            }
        }

        throw new NotAuthorizedException("The Cypher-API called without any authorization.");
    
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegraph.core.GraphManager, java.lang.String) ,public static org.apache.hugegraph.HugeGraph graph4admin(org.apache.hugegraph.core.GraphManager, java.lang.String) ,public static java.lang.Object[] properties(Map<java.lang.String,java.lang.Object>) <variables>public static final java.lang.String ACTION_APPEND,public static final java.lang.String ACTION_CLEAR,public static final java.lang.String ACTION_ELIMINATE,public static final java.lang.String APPLICATION_JSON,public static final java.lang.String APPLICATION_JSON_WITH_CHARSET,public static final java.lang.String APPLICATION_TEXT_WITH_CHARSET,public static final java.lang.String CHARSET,private static final Meter EXPECTED_ERROR_METER,private static final Meter ILLEGAL_ARG_ERROR_METER,public static final java.lang.String JSON,protected static final Logger LOG,private static final Meter SUCCEED_METER,public static final java.lang.String TEXT_PLAIN,private static final Meter UNKNOWN_ERROR_METER