Skip to content

Commit

Permalink
changed get random feedback; now contains Count of Feedbacks requested
Browse files Browse the repository at this point in the history
  • Loading branch information
Galileon-venta committed Nov 12, 2020
1 parent cad08e5 commit 62ffa48
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/ventAPI.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php

namespace ventAPI;
use Exception;
use GuzzleHttp;

require 'vendor/autoload.php';

class ventAPI{
private $http;
/**
* @var int
*/

/**
* ventAPI constructor.
Expand All @@ -18,12 +22,12 @@ public function __construct()

public function ventAPI_get_game_groups(){
$url = "http://ventaGaming.de:9090/api/secure/groups/gamegroups/webpanel";
return json_decode($this->file_get_contents_secure($url), true);
return json_decode($this->get_secure($url));
}

public function ventAPI_get_random_feedback(){
$url = "http://ventaGaming.de:9090/api/secure/web/getFeedback/random";
return json_decode($this->file_get_contents_secure($url));
public function ventAPI_get_random_feedback($count){
$url = "http://ventaGaming.de:9090/api/secure/web/getFeedback/random/".$count."";
return json_decode($this->get_secure($url));
}

public function ventAPI_login($username,$password){
Expand All @@ -42,7 +46,11 @@ public function ventAPI_login($username,$password){
$_SESSION['ventAPItoken'] = $response->getBody();
}

private function file_get_contents_secure($url){
private function get_secure($url){
if(!isset($_SESSION['ventAPItoken'])){
echo ('Not logged in for Secure Action');
return [];
}
return $this->http->request('GET',$url,[
'headers' => [
'AUTHORIZATION' => 'Bearer '.$_SESSION['ventAPItoken'],
Expand Down

0 comments on commit 62ffa48

Please sign in to comment.