Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow relative paths in base uri #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getBaseUri()
*/
public function setBaseUri($baseUri)
{
$this->baseUri = $baseUri ? rtrim($baseUri, '/') : null;
$this->baseUri = $baseUri ? sprintf('%s%s', rtrim($baseUri, '/'), '/') : null;
}

/**
Expand Down
22 changes: 11 additions & 11 deletions src/PrivateApi/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Account extends KuCoinApi
*/
public function create($type, $currency)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/accounts', compact('type', 'currency'));
$response = $this->call(Request::METHOD_POST, 'api/v1/accounts', compact('type', 'currency'));
return $response->getApiData();
}

Expand All @@ -37,7 +37,7 @@ public function create($type, $currency)
*/
public function getList(array $params = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/accounts', $params);
$response = $this->call(Request::METHOD_GET, 'api/v1/accounts', $params);
return $response->getApiData();
}

Expand All @@ -51,7 +51,7 @@ public function getList(array $params = [])
*/
public function getDetail($accountId)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/accounts/' . $accountId);
$response = $this->call(Request::METHOD_GET, 'api/v1/accounts/' . $accountId);
return $response->getApiData();
}

Expand All @@ -69,7 +69,7 @@ public function getDetail($accountId)
*/
public function getLedgers($accountId, array $params = [], array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/accounts/' . $accountId . '/ledgers', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/accounts/' . $accountId . '/ledgers', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -84,7 +84,7 @@ public function getLedgers($accountId, array $params = [], array $pagination = [
*/
public function getHolds($accountId, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/accounts/' . $accountId . '/holds', $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/accounts/' . $accountId . '/holds', $pagination);
return $response->getApiData();
}

Expand Down Expand Up @@ -141,7 +141,7 @@ public function innerTransferV2($clientOid, $currency, $from, $to, $amount)
*/
public function getSubAccountUsers()
{
$response = $this->call(Request::METHOD_GET, '/api/v1/sub/user');
$response = $this->call(Request::METHOD_GET, 'api/v1/sub/user');
return $response->getApiData();
}

Expand All @@ -155,7 +155,7 @@ public function getSubAccountUsers()
*/
public function getSubAccountDetail($subUserId)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/sub-accounts/' . $subUserId);
$response = $this->call(Request::METHOD_GET, 'api/v1/sub-accounts/' . $subUserId);
return $response->getApiData();
}

Expand All @@ -168,7 +168,7 @@ public function getSubAccountDetail($subUserId)
*/
public function getSubAccountList()
{
$response = $this->call(Request::METHOD_GET, '/api/v1/sub-accounts');
$response = $this->call(Request::METHOD_GET, 'api/v1/sub-accounts');
return $response->getApiData();
}

Expand All @@ -183,7 +183,7 @@ public function getSubAccountList()
*/
public function subTransfer(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/accounts/sub-transfer', $params);
$response = $this->call(Request::METHOD_POST, 'api/v1/accounts/sub-transfer', $params);
return $response->getApiData();
}

Expand All @@ -198,7 +198,7 @@ public function subTransfer(array $params)
*/
public function subTransferV2(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v2/accounts/sub-transfer', $params);
$response = $this->call(Request::METHOD_POST, 'api/v2/accounts/sub-transfer', $params);
return $response->getApiData();
}

Expand All @@ -213,7 +213,7 @@ public function subTransferV2(array $params)
*/
public function getLedgersV2(array $params = [], array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/accounts/ledgers', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/accounts/ledgers', $params + $pagination);
return $response->getApiData();
}
}
10 changes: 5 additions & 5 deletions src/PrivateApi/Deposit.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Deposit extends KuCoinApi
*/
public function createAddress($currency, $chain = null)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/deposit-addresses', compact('currency', 'chain'));
$response = $this->call(Request::METHOD_POST, 'api/v1/deposit-addresses', compact('currency', 'chain'));
return $response->getApiData();
}

Expand All @@ -38,7 +38,7 @@ public function createAddress($currency, $chain = null)
*/
public function getAddress($currency, $chain = null)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/deposit-addresses', compact('currency', 'chain'));
$response = $this->call(Request::METHOD_GET, 'api/v1/deposit-addresses', compact('currency', 'chain'));
return $response->getApiData();
}

Expand All @@ -54,7 +54,7 @@ public function getAddress($currency, $chain = null)
*/
public function getAddresses($currency)
{
$response = $this->call(Request::METHOD_GET, '/api/v2/deposit-addresses', compact('currency'));
$response = $this->call(Request::METHOD_GET, 'api/v2/deposit-addresses', compact('currency'));
return $response->getApiData();
}

Expand All @@ -69,7 +69,7 @@ public function getAddresses($currency)
*/
public function getDeposits(array $params, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/deposits', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/deposits', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -84,7 +84,7 @@ public function getDeposits(array $params, array $pagination = [])
*/
public function getV1Deposits(array $params, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/hist-deposits', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/hist-deposits', $params + $pagination);
return $response->getApiData();
}
}
4 changes: 2 additions & 2 deletions src/PrivateApi/Fill.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Fill extends KuCoinApi
*/
public function getList(array $params = [], array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/fills', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/fills', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -36,7 +36,7 @@ public function getList(array $params = [], array $pagination = [])
*/
public function getRecentList()
{
$response = $this->call(Request::METHOD_GET, '/api/v1/limit/fills');
$response = $this->call(Request::METHOD_GET, 'api/v1/limit/fills');
return $response->getApiData();
}
}
36 changes: 18 additions & 18 deletions src/PrivateApi/Margin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getMarkPrice($symbol)
*/
public function getConfig()
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/config');
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/config');
return $response->getApiData();
}

Expand All @@ -54,7 +54,7 @@ public function getConfig()
*/
public function getAccount()
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/account');
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/account');
return $response->getApiData();
}

Expand All @@ -69,7 +69,7 @@ public function getAccount()
*/
public function borrow(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/margin/borrow', $params);
$response = $this->call(Request::METHOD_POST, 'api/v1/margin/borrow', $params);
return $response->getApiData();
}

Expand All @@ -84,7 +84,7 @@ public function borrow(array $params)
*/
public function getBorrow($orderId)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/borrow', compact('orderId'));
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/borrow', compact('orderId'));
return $response->getApiData();
}

Expand All @@ -99,7 +99,7 @@ public function getBorrow($orderId)
*/
public function getOutstanding($currency)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/borrow/outstanding', compact('currency'));
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/borrow/outstanding', compact('currency'));
return $response->getApiData();
}

Expand All @@ -114,7 +114,7 @@ public function getOutstanding($currency)
*/
public function getRepayRecord($currency)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/borrow/repaid', compact('currency'));
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/borrow/repaid', compact('currency'));
return $response->getApiData();
}

Expand All @@ -129,7 +129,7 @@ public function getRepayRecord($currency)
*/
public function repayAll(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/margin/repay/all', $params);
$response = $this->call(Request::METHOD_POST, 'api/v1/margin/repay/all', $params);
return $response->getApiData();
}

Expand All @@ -144,7 +144,7 @@ public function repayAll(array $params)
*/
public function repaySingle(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/margin/repay/single', $params);
$response = $this->call(Request::METHOD_POST, 'api/v1/margin/repay/single', $params);
return $response->getApiData();
}

Expand All @@ -159,7 +159,7 @@ public function repaySingle(array $params)
*/
public function lend(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/margin/lend', $params);
$response = $this->call(Request::METHOD_POST, 'api/v1/margin/lend', $params);
return $response->getApiData();
}

Expand All @@ -174,7 +174,7 @@ public function lend(array $params)
*/
public function cancelLend($orderId)
{
$response = $this->call(Request::METHOD_DELETE, '/api/v1/margin/lend/' . $orderId);
$response = $this->call(Request::METHOD_DELETE, 'api/v1/margin/lend/' . $orderId);
return $response->getApiData();
}

Expand All @@ -189,7 +189,7 @@ public function cancelLend($orderId)
*/
public function setAutoLend(array $params)
{
$response = $this->call(Request::METHOD_POST, '/api/v1/margin/toggle-auto-lend', $params);
$response = $this->call(Request::METHOD_POST, 'api/v1/margin/toggle-auto-lend', $params);
return $response->getApiData();
}

Expand All @@ -205,7 +205,7 @@ public function setAutoLend(array $params)
*/
public function getLendActive(array $params, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/lend/active', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/lend/active', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -221,7 +221,7 @@ public function getLendActive(array $params, array $pagination = [])
*/
public function getLendDone(array $params, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/lend/done', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/lend/done', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -237,7 +237,7 @@ public function getLendDone(array $params, array $pagination = [])
*/
public function getUnsettled(array $params, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/lend/trade/unsettled', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/lend/trade/unsettled', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -253,7 +253,7 @@ public function getUnsettled(array $params, array $pagination = [])
*/
public function getSettled(array $params, array $pagination = [])
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/lend/trade/settled', $params + $pagination);
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/lend/trade/settled', $params + $pagination);
return $response->getApiData();
}

Expand All @@ -268,7 +268,7 @@ public function getSettled(array $params, array $pagination = [])
*/
public function getLendAssets($currency)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/lend/assets', compact('currency'));
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/lend/assets', compact('currency'));
return $response->getApiData();
}

Expand All @@ -283,7 +283,7 @@ public function getLendAssets($currency)
*/
public function getMarket(array $params)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/market', $params);
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/market', $params);
return $response->getApiData();
}

Expand All @@ -298,7 +298,7 @@ public function getMarket(array $params)
*/
public function getTradeLast($currency)
{
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/trade/last', compact('currency'));
$response = $this->call(Request::METHOD_GET, 'api/v1/margin/trade/last', compact('currency'));
return $response->getApiData();
}
}
Loading