Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WinClain committed Oct 23, 2023
1 parent 03fad83 commit 534f17c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 158 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sempico/sempico-php",
"description": "Api library to interact with Sempico Solutions REST Api",
"name": "sempico/api-sms-php",
"description": "Api library to interact with Sempico Solutions Api",
"type": "library",
"version": "1.0.0",
"minimum-stability": "stable",
Expand Down
38 changes: 1 addition & 37 deletions src/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,11 @@

class ApiClient
{
/**
* api token
* @var string
*/
private string $token;

/**
* domain
* @var string
*/
private string $domain;

public function __construct(string $token, string $domain)
{
$this->token = $token;
$this->domain = $domain;
}

/**
* Get api token
* @return string
*/
public function getToken(): string
{
return $this->token;
}

/**
* Get api domain
* @return string
*/
public function getDomain(): string
{
return $this->domain;
}
private string $domain = 'https://api.sempico.solutions/';

/**
* Make curl request
Expand All @@ -52,12 +22,6 @@ public function curlRequest(string $url, string|bool $customMethod, array $data)
$output = [];
$ch = curl_init();

// Header
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'x-access-token: '. $this->token
]);

// Url
curl_setopt($ch, CURLOPT_URL, $this->domain . $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Expand Down
42 changes: 42 additions & 0 deletions src/Sms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Sempico\Api;

class Sms
{
/**
* Api client
* @var ApiClient
*/
private $client;

public function __construct(ApiClient $client)
{
$this->client = $client;
}

/**
* Get all source prices
* @param array $config
* @return array
*/
public function send(array $config)
{
$route = 'v1/send'.http_build_query($config);

return $this->client->curlRequest($route, false, []);
}

/**
* Refactor sms data
* @param int $id
* @param array $config
* @return array
*/
public function refactore(array $config)
{
$route = 'v1/replacement?'.http_build_query($config);

return $this->client->curlRequest($route, false, []);
}
}
66 changes: 0 additions & 66 deletions src/SourcePrice.php

This file was deleted.

53 changes: 0 additions & 53 deletions src/Statistic.php

This file was deleted.

0 comments on commit 534f17c

Please sign in to comment.