-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
238 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Eskrano\QuickbaseRest\Sections; | ||
|
||
class Reports extends AbstractSection | ||
{ | ||
/** | ||
* Table reports (all reports) | ||
* @see https://developer.quickbase.com/operation/getTableReports | ||
* @param string $table_id | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function tableReports(string $table_id) | ||
{ | ||
return $this->client->query( | ||
'GET', | ||
'reports', | ||
[], | ||
[ | ||
'tableId' => $table_id | ||
], | ||
); | ||
} | ||
|
||
/** | ||
* Get report | ||
* @see https://developer.quickbase.com/operation/getReport | ||
* @param string $table_id | ||
* @param int $report_id | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function getReport(string $table_id, int $report_id) | ||
{ | ||
return $this->client->query( | ||
'GET', | ||
'reports/' . $report_id, | ||
[], | ||
[ | ||
'tableId' => $table_id | ||
], | ||
); | ||
} | ||
|
||
/** | ||
* Run report | ||
* @see https://developer.quickbase.com/operation/runReport | ||
* @param string $table_id | ||
* @param int $report_id | ||
* @param int $skip | ||
* @param int $top | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function runReport(string $table_id, int $report_id, int $skip = 0, int $top = 100) | ||
{ | ||
return $this->client->query( | ||
'GET', | ||
'reports/' . $report_id, | ||
[], | ||
[ | ||
'tableId' => $table_id, | ||
'skip' => $skip, | ||
'top' => $top, | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?php | ||
|
||
namespace Eskrano\QuickbaseRest\Sections; | ||
|
||
class Tables extends AbstractSection | ||
{ | ||
|
||
/** | ||
* Create table | ||
* | ||
* @param string $app_id | ||
* @param string $table_name | ||
* @param string $description | ||
* @param string $single_record_name | ||
* @param string $plural_record_name | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function create( | ||
string $app_id, | ||
string $table_name, | ||
string $description, | ||
string $single_record_name, | ||
string $plural_record_name | ||
) | ||
{ | ||
$create = [ | ||
'name' => $table_name, | ||
'description' => $description, | ||
'singleRecordName' => $single_record_name, | ||
'pluralRecordName' => $plural_record_name | ||
]; | ||
|
||
|
||
return $this->client->query( | ||
'POST', | ||
'tables', | ||
$create, | ||
[ | ||
'appId' => $app_id, | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Get all tables from the APP | ||
* | ||
* @param string $app_id | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function getTablesFromApp(string $app_id) | ||
{ | ||
return $this->client->query( | ||
'GET', | ||
'tables', | ||
[], | ||
[ | ||
'appId' => $app_id | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Get one table info | ||
* | ||
* @param string $app_id | ||
* @param string $table_id | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function getTable(string $app_id, string $table_id) | ||
{ | ||
return $this->client->query( | ||
'GET', | ||
'tables/' . $table_id, | ||
[], | ||
[ | ||
'appId' => $app_id | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Update table | ||
* | ||
* @param string $app_id | ||
* @param string $table_id | ||
* @param array $update | ||
* @return \Psr\Http\Message\ResponseInterface | ||
*/ | ||
public function updateTable(string $app_id, string $table_id, array $update) | ||
{ | ||
$update_final = [ | ||
'name' => $update['table_name'], | ||
'description' => $update['description'], | ||
'singleRecordName' => $update['single_record_name'], | ||
'pluralRecordName' => $update['plural_record_name'], | ||
]; | ||
|
||
return $this->client->query( | ||
'POST', | ||
'tables/' . $table_id, | ||
$update_final, | ||
[ | ||
'appId' => $app_id, | ||
] | ||
); | ||
} | ||
|
||
|
||
public function deleteTable(string $app_id, string $table_id) | ||
{ | ||
return $this->client->query( | ||
'DELETE', | ||
'tables/' . $table_id, | ||
[], | ||
[ | ||
'appId' => $app_id | ||
] | ||
); | ||
} | ||
} |