<commit_before>package com.buttercoin.api;

import com.buttercoin.api.functions.Status202ExtractLocation;
import com.buttercoin.api.functions.Status204SuccessFailure;
import com.buttercoin.api.functions.ThrowOnHttpFailure;
import com.buttercoin.api.functions.MapResponseJson;
import com.buttercoin.api.utils.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.SignatureCalculator;
import com.ning.http.client.extra.ThrottleRequestFilter;
import com.ning.http.client.providers.jdk.JDKAsyncHttpProvider;
import com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig;

import java.math.BigDecimal;
import java.net.URL;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

import static com.google.common.util.concurrent.Futures.transform;

interface UnauthenticatedAPI {
    /**
     * Returns the current bid, ask, and last sell prices on Buttercoin.
     *
     * @return the current bid, ask, and last sell prices on Buttercoin
     */
    ListenableFuture<Ticker> getTicker();

    /**
     * Returns the current orders in the Buttercoin order book.
     *
     * @return the current orders in the Buttercoin order book
     */
    ListenableFuture<OrderBook> getOrderBook();

    /**
     * Returns the last 100 trades.
     *
     * @return the last 100 trades
     */
    ListenableFuture<TradeHistory> getTradeHistory();
}

interface AccountAPI {
    /**
     * Returns set of permissions associated with this account.
     *
     * @return permissions associated with this account
     */
    ListenableFuture<Permissions> getKey();

    /**
     * Returns set of permissions associated with this account.
     *
     * @return permissions associated with this account
     */
    ListenableFuture<Permissions> getKey(long timestamp);

    /**
     * Returns balances for this account.
     *
     * @return balances for this account
     */
    ListenableFuture<AccountBalances> getBalances();

    /**
     * Returns balances for this account.
     *
     * @return balances for this account
     */
    ListenableFuture<AccountBalances> getBalances(long timestamp);

    /**
     * Returns bitcoin address string to deposit your funds into the Buttercoin platform.
     *
     * @return bitcoin address string to deposit your funds into the Buttercoin platform
     */
    ListenableFuture<DepositAddress> getDepositAddress();

    /**
     * Returns bitcoin address string to deposit your funds into the Buttercoin platform.
     *
     * @return bitcoin address string to deposit your funds into the Buttercoin platform
     */
    ListenableFuture<DepositAddress> getDepositAddress(long timestamp);
}

interface OrderAPI {
    ListenableFuture<Order> getOrder(String orderId);

    ListenableFuture<Order> getOrder(long timestamp, String orderId);

    ListenableFuture<Order> getOrder(URL url);

    ListenableFuture<Order> getOrder(long timestamp, URL url);

    ListenableFuture<Orders> getOrders(URL url);

    ListenableFuture<Orders> getOrders(long timestamp, URL url);

    ListenableFuture<Orders> getOrders(Order.Status... status);

    ListenableFuture<Orders> getOrders(long timestamp, Order.Status... status);

    ListenableFuture<Orders> getOrders(Order.Side... side);

    ListenableFuture<Orders> getOrders(long timestamp, Order.Side... side);

    ListenableFuture<Orders> getOrders(Order.OrderType... orderType);

    ListenableFuture<Orders> getOrders(long timestamp, Order.OrderType... orderType);

    ListenableFuture<Orders> getOrders(Order.Status status, Order.Side side, Order.OrderType orderType);

    ListenableFuture<Orders> getOrders(long timestamp, Order.Status status, Order.Side side, Order.OrderType orderType);

    ListenableFuture<Orders> getOrders(Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes);

    ListenableFuture<Orders> getOrders(long timestamp, Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes);

    ListenableFuture<Orders> getOrders(Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes, int page, int pageSize);

    ListenableFuture<Orders> getOrders(long timestamp, Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes, int page, int pageSize);

    ListenableFuture<Orders> getOrders(String... orderIds);

    ListenableFuture<Orders> getOrders(long timestamp, String... orderIds);

    ListenableFuture<URL> createOrder(CreateOrder.Instrument instrument, Order.Side side, Order.OrderType orderType, BigDecimal price, BigDecimal quantity);

    ListenableFuture<URL> createOrder(long timestamp, CreateOrder.Instrument instrument, Order.Side side, Order.OrderType orderType, BigDecimal price, BigDecimal quantity);

    ListenableFuture<Boolean> cancelOrder(String orderId);

    ListenableFuture<Boolean> cancelOrder(long timestamp, String orderId);
}

interface TransactionAPI {
    ListenableFuture<Transaction> getTransaction(String transactionId);

    ListenableFuture<Transaction> getTransaction(long timestamp, String transactionId);

    ListenableFuture<Transaction> getTransaction(URL url);

    ListenableFuture<Transaction> getTransaction(long timestamp, URL url);

    ListenableFuture<Transactions> getTransactions(URL url);

    ListenableFuture<Transactions> getTransactions(long timestamp, URL url);

    ListenableFuture<Transactions> getTransactions(Transaction.Status... status);

    ListenableFuture<Transactions> getTransactions(long timestamp, Transaction.Status... status);

    ListenableFuture<Transactions> getTransactions(Transaction.TransactionType... transactionType);

    ListenableFuture<Transactions> getTransactions(long timestamp, Transaction.TransactionType... transactionType);

    ListenableFuture<Transactions> getTransactions(Transaction.Status status, Transaction.TransactionType transactionType);

    ListenableFuture<Transactions> getTransactions(long timestamp, Transaction.Status status, Transaction.TransactionType transactionType);

    ListenableFuture<Transactions> getTransactions(Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes);

    ListenableFuture<Transactions> getTransactions(long timestamp, Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes);

    ListenableFuture<Transactions> getTransactions(Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes, int page, int pageSize);

    ListenableFuture<Transactions> getTransactions(long timestamp, Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes, int page, int pageSize);

    ListenableFuture<URL> createDeposit(String method, String currency, BigDecimal amount);

    ListenableFuture<URL> createDeposit(long timestamp, String method, String currency, BigDecimal amount);

    ListenableFuture<URL> createWithdrawal(String method, String currency, BigDecimal amount);

    ListenableFuture<URL> createWithdrawal(long timestamp, String method, String currency, BigDecimal amount);

    ListenableFuture<URL> sendBitcoin(BigDecimal amount, String destination);

    ListenableFuture<URL> sendBitcoin(long timestamp, BigDecimal amount, String destination);

    ListenableFuture<URL> sendBitcoin(String currency, BigDecimal amount, String destination);

    ListenableFuture<URL> sendBitcoin(long timestamp, String currency, BigDecimal amount, String destination);

    ListenableFuture<Boolean> cancelTransaction(String transactionId);

    ListenableFuture<Boolean> cancelTransaction(long timestamp, String transactionId);
}

public interface Buttercoin extends UnauthenticatedAPI, AccountAPI, OrderAPI, TransactionAPI {
    public static Builder newBuilder() {
        return new Builder();
    }

    static final class Builder {
        private int throttleRequestFilterMaxConnections = 16;
        private int requestTimeout = 60 * 1000;
        private int idleTimeout = 60 * 1000;
        private boolean compressionEnforced = true;
        private ExecutorService executorService;

        private String apiKey;
        private String apiSecret;

        private String baseUrl = "https://api.buttercoin.com";

        // specific to Async Http Client
        private boolean useJDKAsyncHttpProvider = false;
        private NettyAsyncHttpProviderConfig nettyAsyncHttpProviderConfig = null;

        public Builder() {
        }

        public Builder throttleRequestFilterMaxConnections(int throttleRequestFilterMaxConnections) {
            this.throttleRequestFilterMaxConnections = throttleRequestFilterMaxConnections;
            return this;
        }

        public Builder requestTimeout(long timeout, TimeUnit unit) {
            this.requestTimeout = (int) unit.toMillis(timeout);
            return this;
        }

        public Builder idleTimout(long timeout, TimeUnit unit) {
            this.idleTimeout = (int) unit.toMillis(timeout);
            return this;
        }

        public Builder compressionEnforced(boolean compressionEnforced) {
            this.compressionEnforced = compressionEnforced;
            return this;
        }

        public Builder executorService(ExecutorService executorService) {
            this.executorService = executorService;
            return this;
        }

        public Builder apiKey(String apiKey) {
            Preconditions.checkNotNull(apiKey);<commit_msg>Support java.util.Duration and fix builder typo.<commit_after>package com.buttercoin.api;

import com.buttercoin.api.functions.Status202ExtractLocation;
import com.buttercoin.api.functions.Status204SuccessFailure;
import com.buttercoin.api.functions.ThrowOnHttpFailure;
import com.buttercoin.api.functions.MapResponseJson;
import com.buttercoin.api.utils.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.SignatureCalculator;
import com.ning.http.client.extra.ThrottleRequestFilter;
import com.ning.http.client.providers.jdk.JDKAsyncHttpProvider;
import com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig;

import java.math.BigDecimal;
import java.net.URL;
import java.time.Duration;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

import static com.google.common.util.concurrent.Futures.transform;

interface UnauthenticatedAPI {
    /**
     * Returns the current bid, ask, and last sell prices on Buttercoin.
     *
     * @return the current bid, ask, and last sell prices on Buttercoin
     */
    ListenableFuture<Ticker> getTicker();

    /**
     * Returns the current orders in the Buttercoin order book.
     *
     * @return the current orders in the Buttercoin order book
     */
    ListenableFuture<OrderBook> getOrderBook();

    /**
     * Returns the last 100 trades.
     *
     * @return the last 100 trades
     */
    ListenableFuture<TradeHistory> getTradeHistory();
}

interface AccountAPI {
    /**
     * Returns set of permissions associated with this account.
     *
     * @return permissions associated with this account
     */
    ListenableFuture<Permissions> getKey();

    /**
     * Returns set of permissions associated with this account.
     *
     * @return permissions associated with this account
     */
    ListenableFuture<Permissions> getKey(long timestamp);

    /**
     * Returns balances for this account.
     *
     * @return balances for this account
     */
    ListenableFuture<AccountBalances> getBalances();

    /**
     * Returns balances for this account.
     *
     * @return balances for this account
     */
    ListenableFuture<AccountBalances> getBalances(long timestamp);

    /**
     * Returns bitcoin address string to deposit your funds into the Buttercoin platform.
     *
     * @return bitcoin address string to deposit your funds into the Buttercoin platform
     */
    ListenableFuture<DepositAddress> getDepositAddress();

    /**
     * Returns bitcoin address string to deposit your funds into the Buttercoin platform.
     *
     * @return bitcoin address string to deposit your funds into the Buttercoin platform
     */
    ListenableFuture<DepositAddress> getDepositAddress(long timestamp);
}

interface OrderAPI {
    ListenableFuture<Order> getOrder(String orderId);

    ListenableFuture<Order> getOrder(long timestamp, String orderId);

    ListenableFuture<Order> getOrder(URL url);

    ListenableFuture<Order> getOrder(long timestamp, URL url);

    ListenableFuture<Orders> getOrders(URL url);

    ListenableFuture<Orders> getOrders(long timestamp, URL url);

    ListenableFuture<Orders> getOrders(Order.Status... status);

    ListenableFuture<Orders> getOrders(long timestamp, Order.Status... status);

    ListenableFuture<Orders> getOrders(Order.Side... side);

    ListenableFuture<Orders> getOrders(long timestamp, Order.Side... side);

    ListenableFuture<Orders> getOrders(Order.OrderType... orderType);

    ListenableFuture<Orders> getOrders(long timestamp, Order.OrderType... orderType);

    ListenableFuture<Orders> getOrders(Order.Status status, Order.Side side, Order.OrderType orderType);

    ListenableFuture<Orders> getOrders(long timestamp, Order.Status status, Order.Side side, Order.OrderType orderType);

    ListenableFuture<Orders> getOrders(Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes);

    ListenableFuture<Orders> getOrders(long timestamp, Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes);

    ListenableFuture<Orders> getOrders(Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes, int page, int pageSize);

    ListenableFuture<Orders> getOrders(long timestamp, Iterable<Order.Status> status, Iterable<Order.Side> sides, Iterable<Order.OrderType> orderTypes, int page, int pageSize);

    ListenableFuture<Orders> getOrders(String... orderIds);

    ListenableFuture<Orders> getOrders(long timestamp, String... orderIds);

    ListenableFuture<URL> createOrder(CreateOrder.Instrument instrument, Order.Side side, Order.OrderType orderType, BigDecimal price, BigDecimal quantity);

    ListenableFuture<URL> createOrder(long timestamp, CreateOrder.Instrument instrument, Order.Side side, Order.OrderType orderType, BigDecimal price, BigDecimal quantity);

    ListenableFuture<Boolean> cancelOrder(String orderId);

    ListenableFuture<Boolean> cancelOrder(long timestamp, String orderId);
}

interface TransactionAPI {
    ListenableFuture<Transaction> getTransaction(String transactionId);

    ListenableFuture<Transaction> getTransaction(long timestamp, String transactionId);

    ListenableFuture<Transaction> getTransaction(URL url);

    ListenableFuture<Transaction> getTransaction(long timestamp, URL url);

    ListenableFuture<Transactions> getTransactions(URL url);

    ListenableFuture<Transactions> getTransactions(long timestamp, URL url);

    ListenableFuture<Transactions> getTransactions(Transaction.Status... status);

    ListenableFuture<Transactions> getTransactions(long timestamp, Transaction.Status... status);

    ListenableFuture<Transactions> getTransactions(Transaction.TransactionType... transactionType);

    ListenableFuture<Transactions> getTransactions(long timestamp, Transaction.TransactionType... transactionType);

    ListenableFuture<Transactions> getTransactions(Transaction.Status status, Transaction.TransactionType transactionType);

    ListenableFuture<Transactions> getTransactions(long timestamp, Transaction.Status status, Transaction.TransactionType transactionType);

    ListenableFuture<Transactions> getTransactions(Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes);

    ListenableFuture<Transactions> getTransactions(long timestamp, Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes);

    ListenableFuture<Transactions> getTransactions(Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes, int page, int pageSize);

    ListenableFuture<Transactions> getTransactions(long timestamp, Iterable<Transaction.Status> status, Iterable<Transaction.TransactionType> transactionTypes, int page, int pageSize);

    ListenableFuture<URL> createDeposit(String method, String currency, BigDecimal amount);

    ListenableFuture<URL> createDeposit(long timestamp, String method, String currency, BigDecimal amount);

    ListenableFuture<URL> createWithdrawal(String method, String currency, BigDecimal amount);

    ListenableFuture<URL> createWithdrawal(long timestamp, String method, String currency, BigDecimal amount);

    ListenableFuture<URL> sendBitcoin(BigDecimal amount, String destination);

    ListenableFuture<URL> sendBitcoin(long timestamp, BigDecimal amount, String destination);

    ListenableFuture<URL> sendBitcoin(String currency, BigDecimal amount, String destination);

    ListenableFuture<URL> sendBitcoin(long timestamp, String currency, BigDecimal amount, String destination);

    ListenableFuture<Boolean> cancelTransaction(String transactionId);

    ListenableFuture<Boolean> cancelTransaction(long timestamp, String transactionId);
}

public interface Buttercoin extends UnauthenticatedAPI, AccountAPI, OrderAPI, TransactionAPI {
    public static Builder newBuilder() {
        return new Builder();
    }

    static final class Builder {
        private int throttleRequestFilterMaxConnections = 16;
        private int requestTimeout = 60 * 1000;
        private int idleTimeout = 60 * 1000;
        private boolean compressionEnforced = true;
        private ExecutorService executorService;

        private String apiKey;
        private String apiSecret;

        private String baseUrl = "https://api.buttercoin.com";

        // specific to Async Http Client
        private boolean useJDKAsyncHttpProvider = false;
        private NettyAsyncHttpProviderConfig nettyAsyncHttpProviderConfig = null;

        public Builder() {
        }

        public Builder throttleRequestFilterMaxConnections(int throttleRequestFilterMaxConnections) {
            this.throttleRequestFilterMaxConnections = throttleRequestFilterMaxConnections;
            return this;
        }

        public Builder requestTimeout(Duration duration) {
            this.requestTimeout = (int) duration.toMillis();
            return this;
        }

        public Builder requestTimeout(long timeout, TimeUnit unit) {
            this.requestTimeout = (int) unit.toMillis(timeout);
            return this;
        }

        public Builder idleTimeout(Duration duration) {
            this.idleTimeout = (int) duration.toMillis();
            return this;
        }

        public Builder idleTimeout(long timeout, TimeUnit unit) {
            this.idleTimeout = (int) unit.toMillis(timeout);
            return this;
        }

        public Builder compressionEnforced(boolean compressionEnforced) {
            this.compressionEnforced = compressionEnforced;
            return this;
        }

        public Builder executorService(ExecutorService executorService) {
            this.executorService = executorService;
            return this;
        }

        public Builder apiKey(String apiKey) {
            Preconditions.checkNotNull(apiKey);
{'fraction_non_alphanumeric': 0.08313341493268053, 'fraction_numerical': 0.0025458996328029376, 'mean_word_length': 4.40799576383373, 'pattern_counts': {'":': 0, '<': 161, '<?xml version=': 0, '>': 161, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6713027', 'n_tokens_mistral': 5358, 'n_tokens_neox': 5118, 'n_words': 1312}