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

co.omise.resources.TokenResource Maven / Gradle / Ivy

There is a newer version: 5.1.0
Show newest version
package co.omise.resources;

import co.omise.Endpoint;
import co.omise.models.Token;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;

import java.io.IOException;

public class TokenResource extends Resource {
    public TokenResource(OkHttpClient httpClient) {
        super(httpClient);
    }

    public Token get(String tokenId) throws IOException {
        return httpGet(urlFor(tokenId)).returns(Token.class);
    }

    public Token create(Token.Create params) throws IOException {
        return httpPost(urlFor("")).params(params).returns(Token.class);
    }

    private HttpUrl urlFor(String tokenId) {
        return buildUrl(Endpoint.VAULT, "tokens", tokenId);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy