Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit f51ccc6

Browse files
committed
ps
Signed-off-by: Finbarrs Oketunji <f@finbarrs.eu>
1 parent 929376e commit f51ccc6

File tree

6 files changed

+211
-1
lines changed

6 files changed

+211
-1
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.*
7+
8+
jobs:
9+
create-release:
10+
if: github.repository_owner == 'moatsystems'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: taiki-e/create-gh-release-action@v1
15+
with:
16+
changelog: CHANGELOG.md
17+
branch: main
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ $dailyAverageDate = '2023_04_10';
8080
$weeklyAverageFromDate = '2023_04_03';
8181
$weeklyAverageToDate = '2023_04_07';
8282

83+
// Set the UUID of the performance you want to retrieve
84+
$performanceId = 'performance_id';
85+
86+
// Set the UUID of the signal you want to retrieve
87+
$signalId = 'signal_id';
88+
8389
// Call the convert method to perform the currency conversion
8490
$conversionResult = $currensees->convert($username, $date, $baseCurrency, $targetCurrency, $amount);
8591
if ($conversionResult) {
@@ -168,6 +174,43 @@ if ($marginSpreadResult) {
168174
} else {
169175
echo "Failed to retrieve margin or spread details for the given date.\n";
170176
}
177+
178+
// Call the getAllPerformances method to get all performances
179+
$getAllPerformancesResult = $currensees->getAllPerformances($username);
180+
if ($getAllPerformancesResult) {
181+
echo "Performances list:\n";
182+
echo json_encode($getAllPerformancesResult) . "\n";
183+
} else {
184+
echo "Failed to retrieve performances.\n";
185+
}
186+
187+
// Call the getPerformanceById method to get the details of a specific performance
188+
$getPerformanceByIdResult = $currensees->getPerformanceById($performanceId, $username);
189+
if ($getPerformanceByIdResult) {
190+
echo "Performance details for " . $performanceId . ":\n";
191+
echo json_encode($getPerformanceByIdResult) . "\n";
192+
} else {
193+
echo "Failed to retrieve performance details for the given ID.\n";
194+
}
195+
196+
// Call the getAllSignals method to get all signals
197+
$getAllSignalsResult = $currensees->getAllSignals($username);
198+
if ($getAllSignalsResult) {
199+
echo "Signals list:\n";
200+
echo json_encode($getAllSignalsResult) . "\n";
201+
} else {
202+
echo "Failed to retrieve signals.\n";
203+
}
204+
205+
// Call the getSignalById method to get the details of a specific signal
206+
$getSignalByIdResult = $currensees->getSignalById($signalId, $username);
207+
if ($getSignalByIdResult) {
208+
echo "Signal details for " . $signalId . ":\n";
209+
echo json_encode($getSignalByIdResult) . "\n";
210+
} else {
211+
echo "Failed to retrieve signal details for the given ID.\n";
212+
}
213+
171214
?>
172215
```
173216

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.4
1+
1.0.5

example.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,46 @@
129129
echo "Failed to retrieve margin or spread details for the given date.\n";
130130
}
131131

132+
// Call the getAllPerformances method to get all performances
133+
$getAllPerformancesResult = $currensees->getAllPerformances($username);
134+
if ($getAllPerformancesResult) {
135+
echo "Performances list:\n";
136+
echo json_encode($getAllPerformancesResult) . "\n";
137+
} else {
138+
echo "Failed to retrieve performances.\n";
139+
}
140+
141+
// Set the UUID of the performance you want to retrieve
142+
$performanceId = 'performance_id';
143+
144+
// Call the getPerformanceById method to get the details of a specific performance
145+
$getPerformanceByIdResult = $currensees->getPerformanceById($performanceId, $username);
146+
if ($getPerformanceByIdResult) {
147+
echo "Performance details for " . $performanceId . ":\n";
148+
echo json_encode($getPerformanceByIdResult) . "\n";
149+
} else {
150+
echo "Failed to retrieve performance details for the given ID.\n";
151+
}
152+
153+
// Call the getAllSignals method to get all signals
154+
$getAllSignalsResult = $currensees->getAllSignals($username);
155+
if ($getAllSignalsResult) {
156+
echo "Signals list:\n";
157+
echo json_encode($getAllSignalsResult) . "\n";
158+
} else {
159+
echo "Failed to retrieve signals.\n";
160+
}
161+
162+
// Set the UUID of the signal you want to retrieve
163+
$signalId = 'signal_id';
164+
165+
// Call the getSignalById method to get the details of a specific signal
166+
$getSignalByIdResult = $currensees->getSignalById($signalId, $username);
167+
if ($getSignalByIdResult) {
168+
echo "Signal details for " . $signalId . ":\n";
169+
echo json_encode($getSignalByIdResult) . "\n";
170+
} else {
171+
echo "Failed to retrieve signal details for the given ID.\n";
172+
}
173+
132174
?>

src/currensees.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,76 @@ public function getMarginSpread($uuid, $username, $day, $month, $year)
217217
}
218218
}
219219

220+
public function getAllPerformances($username)
221+
{
222+
$client = new Client();
223+
$headers = [
224+
'Content-Type' => 'application/json',
225+
'Accept' => 'application/json'
226+
];
227+
$url = 'https://currensees.com/v1/performances?username=' . $username;
228+
$request = new Request('GET', $url, $headers);
229+
$res = $client->sendAsync($request)->wait();
230+
231+
if ($res->getStatusCode() == 200) {
232+
return json_decode($res->getBody(), true);
233+
} else {
234+
return false;
235+
}
236+
}
237+
238+
public function getPerformanceById($uuid, $username)
239+
{
240+
$client = new Client();
241+
$headers = [
242+
'Content-Type' => 'application/json',
243+
'Accept' => 'application/json'
244+
];
245+
$url = 'https://currensees.com/v1/performances/' . $uuid . '?username=' . $username;
246+
$request = new Request('GET', $url, $headers);
247+
$res = $client->sendAsync($request)->wait();
248+
249+
if ($res->getStatusCode() == 200) {
250+
return json_decode($res->getBody(), true);
251+
} else {
252+
return false;
253+
}
254+
}
255+
256+
public function getAllSignals($username)
257+
{
258+
$client = new Client();
259+
$headers = [
260+
'Content-Type' => 'application/json',
261+
'Accept' => 'application/json'
262+
];
263+
$url = 'https://currensees.com/v1/signals?username=' . $username;
264+
$request = new Request('GET', $url, $headers);
265+
$res = $client->sendAsync($request)->wait();
266+
267+
if ($res->getStatusCode() == 200) {
268+
return json_decode($res->getBody(), true);
269+
} else {
270+
return false;
271+
}
272+
}
273+
274+
public function getSignalById($uuid, $username)
275+
{
276+
$client = new Client();
277+
$headers = [
278+
'Content-Type' => 'application/json',
279+
'Accept' => 'application/json'
280+
];
281+
$url = 'https://currensees.com/v1/signals/' . $uuid . '?username=' . $username;
282+
$request = new Request('GET', $url, $headers);
283+
$res = $client->sendAsync($request)->wait();
284+
285+
if ($res->getStatusCode() == 200) {
286+
return json_decode($res->getBody(), true);
287+
} else {
288+
return false;
289+
}
290+
}
291+
220292
}

tests/CurrenseesTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,38 @@ public function testGetMarginSpread()
134134
$result = $this->currensees->getMarginSpread($uuid, $username, $day, $month, $year);
135135
$this->assertTrue(is_array($result));
136136
}
137+
138+
public function testGetAllPerformances()
139+
{
140+
$username = 'your_username';
141+
142+
$result = $this->currensees->getAllPerformances($username);
143+
$this->assertTrue(is_array($result));
144+
}
145+
146+
public function testGetPerformanceById()
147+
{
148+
$uuid = 'd4762c44-e3c6-11ed-8570-acde48001122';
149+
$username = 'your_username';
150+
151+
$result = $this->currensees->getPerformanceById($uuid, $username);
152+
$this->assertTrue(is_array($result));
153+
}
154+
155+
public function testGetAllSignals()
156+
{
157+
$username = 'your_username';
158+
159+
$result = $this->currensees->getAllSignals($username);
160+
$this->assertTrue(is_array($result));
161+
}
162+
163+
public function testGetSignalById()
164+
{
165+
$uuid = 'd46cc05a-e3c6-11ed-8570-acde48001122';
166+
$username = 'your_username';
167+
168+
$result = $this->currensees->getSignalById($uuid, $username);
169+
$this->assertTrue(is_array($result));
170+
}
137171
}

0 commit comments

Comments
 (0)