com.coinbase.client.service.CoinbaseAPIv2Service Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coinbase-java-api Show documentation
Show all versions of coinbase-java-api Show documentation
Java project for connecting the Coinbase V2 API
package com.coinbase.client.service;
import com.coinbase.domain.account.request.CbAccountUpdateRequest;
import com.coinbase.domain.account.response.CbAccountListResponse;
import com.coinbase.domain.account.response.CbAccountResponse;
import com.coinbase.domain.address.request.CbCreateAddressRequest;
import com.coinbase.domain.address.response.CbAddressListResponse;
import com.coinbase.domain.address.response.CbAddressResponse;
import com.coinbase.domain.address.response.CbAddressTransactionListResponse;
import com.coinbase.domain.address.response.CbAddressTransactionResponse;
import com.coinbase.domain.order.request.CbOrderRequest;
import com.coinbase.domain.price.response.CbCurrencyCodeListResponse;
import com.coinbase.domain.price.response.CbExchangeRateResponse;
import com.coinbase.domain.price.response.CbPriceResponse;
import com.coinbase.domain.system.response.CbTimeResponse;
import com.coinbase.domain.trade.request.CbCashTransactionRequest;
import com.coinbase.domain.trade.response.CbCashTransactionListResponse;
import com.coinbase.domain.trade.response.CbCashTransactionResponse;
import com.coinbase.domain.trade.response.CbTradeListResponse;
import com.coinbase.domain.trade.response.CbTradeResponse;
import com.coinbase.domain.transaction.request.CbMoneyRequest;
import com.coinbase.domain.transaction.response.CbPaymentMethodListResponse;
import com.coinbase.domain.transaction.response.CbPaymentMethodResponse;
import com.coinbase.domain.user.request.CbUserUpdateRequest;
import com.coinbase.domain.user.response.CbUserResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.concurrent.CompletionStage;
/**
* The MIT License (MIT)
*
* Copyright (c) 2021 antlen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* ------------------------------------------------
* The main service for the rest api. The implementation will be generated as a proxy.
*
* @author antlen
*/
@Consumes(value = MediaType.APPLICATION_JSON)
@Produces({MediaType.APPLICATION_JSON})
@Path("/v2")
public interface CoinbaseAPIv2Service{
@GET
@Path("/user")
CompletionStage getUser();
@GET
@Path("/users/{user}")
CompletionStage getUser(@PathParam("user") String userId);
@GET
@Path("/payment-methods")
CompletionStage getPaymentMethods(@QueryParam("limit") int pageSize, @QueryParam("starting_after") String after);
@GET
@Path("/payment-methods/{id}")
CompletionStage getPaymentMethod(@PathParam("id") String id);
@PUT
@Path("/user")
CompletionStage updateUser(CbUserUpdateRequest u);
@GET
@Path("/accounts")
CompletionStage getAccounts(@QueryParam("limit") int pageSize, @QueryParam("starting_after") String after);
@GET
@Path("/accounts/{id}")
CompletionStage getAccount(@PathParam("id") String id);
@PUT
@Path("/accounts")
CompletionStage updateAccountName(@PathParam("account") String account, CbAccountUpdateRequest req);
@DELETE
@Path("/accounts/{account}")
CompletionStage deleteAccount(@PathParam("account") String account);
@GET
@Path("/accounts/{account}/addresses")
CompletionStage getAddresses(@PathParam("account") String account, @QueryParam("limit") int pageSize, @QueryParam("starting_after") String after);
@GET
@Path("/accounts/{account}/addresses/{address}")
CompletionStage getAddress(@PathParam("account") String account, @PathParam("address") String addressId);
@POST
@Path("/accounts/{account}/addresses")
CompletionStage createAddress(@PathParam("account") String account, CbCreateAddressRequest request);
@GET
@Path("/accounts/{account}/addresses/{address}/transactions")
CompletionStage getTransactions(@PathParam("account") String account, @PathParam("address") String address,
@QueryParam("limit") int pageSize, @QueryParam("starting_after") String after);
@GET
@Path("/time")
CompletionStage getServerTime();
@GET
@Path("/prices/{ticker}/{type}")
CompletionStage getPrice(@PathParam("ticker") String ticker, @PathParam("type") String type);
@GET
@Path("/prices/{ticker}/spot")
CompletionStage getSpotPrice(@PathParam("ticker") String ticker, @QueryParam("date") String date);
@GET
@Path("/currencies")
CompletionStage getCurrencyCodes();
@GET
@Path("/exchange-rates")
CompletionStage getExchangeRate(@QueryParam("currency") String currency);
@GET
@Path("/exchange-rates")
CompletionStage getExchangeRate();
@POST
@Path("/accounts/{account}/transactions")
CompletionStage sendMoneyRequest(@PathParam("account") String account, CbMoneyRequest req);
@GET
@Path("/accounts/{account}/{side}")
CompletionStage getTrades(@PathParam("account") String account, @PathParam("side") String side,
@QueryParam("limit") int pageSize, @QueryParam("starting_after") String after);
@GET
@Path("/accounts/{account}/{side}/{id}")
CompletionStage getTrade(@PathParam("account") String account, @PathParam("side")String side, @PathParam("id") String id);
@GET
@Path("/accounts/{account}/{type}")
CompletionStage getCashTransactions(@PathParam("account") String account, @PathParam("type") String type,
@QueryParam("limit") int pageSize, @QueryParam("starting_after") String after);
@GET
@Path("/accounts/{account}/{type}/{id}")
CompletionStage getCashTransaction(@PathParam("account") String account,
@PathParam("type") String type, @PathParam("id") String id);
@POST
@Path("/accounts/{account}/{type}")
CompletionStage executeCashTransaction(@PathParam("type") String type, CbCashTransactionRequest req);
@POST
@Path("/accounts/{account}/{type}/{id}/commit")
CompletionStage commitCashTransaction(@PathParam("account") String account,
@PathParam("type") String type, @PathParam("id") String id);
@POST
@Path("/accounts/{account}/{side}")
CompletionStage placeOrder(@PathParam("account") String account, @PathParam("type") String side, CbOrderRequest request);
@POST
@Path("/accounts/{account}/{side}/{id}/commit")
CompletionStage commitOrder(@PathParam("account") String account, @PathParam("side") String side, @PathParam("id") String id);
}