Skip to content

Commit

Permalink
Unofficial EditUserTargets method
Browse files Browse the repository at this point in the history
  • Loading branch information
Allyans3 committed Feb 5, 2024
1 parent e652cf6 commit 71f4768
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/DMarketAuthApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use DMarketAuthApi\Requests\DepositAssets;
use DMarketAuthApi\Requests\DepositStatus;
use DMarketAuthApi\Requests\EditUserOffers;
use DMarketAuthApi\Requests\EditUserTargets;
use DMarketAuthApi\Requests\LastSales;
use DMarketAuthApi\Requests\MarketItems;
use DMarketAuthApi\Requests\OffersByTitle;
Expand Down Expand Up @@ -253,6 +254,17 @@ public function createUserTargets(array $postParams, array $proxy = [])
return $class->call($this->publicKey, $this->secretKey, $postParams, $proxy)->response();
}

/**
* @throws \SodiumException
*/
public function editUserTargets(array $postParams, array $proxy = [])
{
$class = new EditUserTargets();

return $class->call($this->publicKey, $this->secretKey, $postParams, $proxy)->response();
}


/**
* @throws \SodiumException
*/
Expand Down
36 changes: 36 additions & 0 deletions src/Requests/EditUserTargets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace DMarketAuthApi\Requests;

use DMarketAuthApi\Engine\Request;
use DMarketAuthApi\Interfaces\RequestInterface;

class EditUserTargets extends Request implements RequestInterface
{
const URL = "/exchange/v1/target/update";

private string $method = 'POST';

public function getUrl(): string
{
return self::URL;
}

/**
* @throws \SodiumException
*/
public function call(string $publicKey, string $secretKey, array $postParams = [], array $proxy = [])
{
return $this->dmarketHttpRequest($publicKey, $secretKey, $postParams, $proxy);
}

public function getRequestMethod(): string
{
return $this->method;
}

public function getRootUrl(): string
{
return "https://api.dmarket.com";
}
}
25 changes: 25 additions & 0 deletions src/Responses/EditUserTargets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace DMarketAuthApi\Responses;

use DMarketAuthApi\Interfaces\ResponseInterface;

class EditUserTargets implements ResponseInterface
{
private $data;

public function __construct($response)
{
$this->data = $this->decodeResponse($response);
}

public function response()
{
return $this->data;
}

private function decodeResponse($response)
{
return json_decode($response, true);
}
}

0 comments on commit 71f4768

Please sign in to comment.