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

com.longport.Config Maven / Gradle / Ivy

There is a newer version: 2.1.5
Show newest version
package com.longport;

import java.time.OffsetDateTime;
import java.util.concurrent.CompletableFuture;

/**
 * Configuration options for LongPort sdk
 */
public class Config implements AutoCloseable {
    private long raw;

    /**
     * @hidden
     */
    Config(long config) {
        this.raw = config;
    }

    /**
     * Create a new `Config` from the given environment variables
     * 

* It first gets the environment variables from the .env file in the current * directory. * * @return Config object * @throws OpenApiException If an error occurs */ public static Config fromEnv() throws OpenApiException { return new Config(SdkNative.newConfigFromEnv()); } /** * @hidden * @return Context pointer */ public long getRaw() { return this.raw; } @Override public void close() throws Exception { SdkNative.freeConfig(this.raw); } public CompletableFuture refreshAccessToken(OffsetDateTime expiredAt) throws OpenApiException { return AsyncCallback.executeTask((callback) -> { SdkNative.configRefreshAccessToken(this.raw, expiredAt, callback); }); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy