Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token Servive should use current token from env if not provided explicitly #2

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 1 addition & 145 deletions geekyants/trelloservice/src/Services/ActionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function fetchCard($queryParams = [])
return $this->verifyIdThenSendRequest($requestOptions);
}

function fetchDisplayInfo($queryParams = [])
function fetchDisplay($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
Expand Down Expand Up @@ -192,148 +192,4 @@ function deleteComment($queryParams = [])
];
return $this->verifyIdThenSendRequest($requestOptions);
}

function fetchAdmins($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "GET",
"path" => [
"actions",
$this->id,
"admins"
],
"queryParams" => $queryParams,
];
return $this->verifyIdThenSendRequest($requestOptions);
}

function fetchSignupUrl($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "GET",
"path" => [
"actions",
$this->id,
"signupUrl"
],
"queryParams" => $queryParams,
];
return $this->verifyIdThenSendRequest($requestOptions);
}

function fetchMembers($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "GET",
"path" => [
"actions",
$this->id,
"members"
],
"queryParams" => $queryParams,
];
return $this->verifyIdThenSendRequest($requestOptions);
}

function isOrganizationTransferableToEnterprise($idOrganization)
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "GET",
"path" => [
"actions",
$this->id,
"transferrable",
"organization", $idOrganization
],
];

return $this->verifyIdThenSendRequest($requestOptions);
}

function deactivateMember($idMember, $queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "PUT",
"path" => [
"actions",
$this->id,
"members",
$idMember, "deactivated"
],
"queryParams" => $queryParams,
];

if (!array_key_exists("value", $queryParams)) {
return ["error" => "value should be present in query params"];
}
return $this->verifyIdThenSendRequest($requestOptions);
}

function tranferOrganization($queryParams)
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "PUT",
"path" => [
"actions",
$this->id,
"organizations"
],
"queryParams" => $queryParams
];
if (!array_key_exists("idOrganization", $queryParams)) {
return ["error" => "idOrganization should be present in query params"];
}
return $this->verifyIdThenSendRequest($requestOptions);
}

function makeAdmin($idMember)
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "PUT",
"path" => [
"actions",
$this->id,
"admins",
$idMember
],
];
return $this->verifyIdThenSendRequest($requestOptions);
}

function removeOrganization($idOrganization)
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "DELETE",
"path" => [
"actions",
$this->id,
"organizations",
$idOrganization
],
];
return $this->verifyIdThenSendRequest($requestOptions);
}

function removeAdmin($idMember)
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "DELETE",
"path" => [
"actions",
$this->id,
"admins",
$idMember
],
];
return $this->verifyIdThenSendRequest($requestOptions);
}
}
36 changes: 27 additions & 9 deletions geekyants/trelloservice/src/Services/BoardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,23 @@ function update($queryParams = [])
return $this->verifyIdThenSendRequest($requestOptions);
}

function addMemberByEmail($queryParams, $headers, $bodyParams)
function addMemberByEmail($queryParams, $headers, $bodyParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "PUT",
"path" => [
"boards",
$this->id,
"members"
],
"queryParams" => $queryParams,
"headers" => $headers,
"bodyParams" => $bodyParams
];

if (!array_key_exists("email", $queryParams)) {
return ["error" => "Email should be present in query params"];
return ["error" => "email should be present in query params"];
}
if (!array_key_exists("type", $headers)) {
return ["error" => "member type should be present in headers"];
Expand All @@ -296,7 +297,7 @@ function addMemberById($idMember, $queryParams)
];

if (!array_key_exists("type", $queryParams)) {
return ["error" => "Type should be present in query params"];
return ["error" => "type should be present in query params"];
}

return $this->verifyIdThenSendRequest($requestOptions);
Expand All @@ -316,7 +317,7 @@ function addMembershipById($queryParams)
];

if (!array_key_exists("type", $queryParams)) {
return ["error" => "Type should be present in query params"];
return ["error" => "type should be present in query params"];
}

if (!array_key_exists("idMembership", $queryParams)) {
Expand Down Expand Up @@ -464,7 +465,7 @@ function create($queryParams)
{

if (!array_key_exists('name', $queryParams)) {
return ["error" => "Name must be provided to create a Board"];
return ["error" => "name should be present in query params"];
}

$requestOptions = [
Expand All @@ -482,7 +483,7 @@ function create($queryParams)
return $res;
}

function enablePlugin($queryParams)
function enablePlugin($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
Expand Down Expand Up @@ -517,12 +518,29 @@ function generateEmailKey()
"requestMethod" => "POST",
"path" => [
"boards",
$this->id, "EmailKey",
$this->id, "emailKey",
"generate",
],
];
return $this->verifyIdThenSendRequest($requestOptions);
}


function addTag($queryParams){
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"boards",
$this->id, "idTags",
],
"queryParams" => $queryParams,
];
if (!array_key_exists("value", $queryParams)) {
return ["error" => "value should be present in query params"];
}

}

function createLabel($queryParams)
{
Expand Down Expand Up @@ -585,7 +603,7 @@ function enablePowerUp($queryParams)
"requestMethod" => "POST",
"path" => [
"boards",
$this->id, "lists",
$this->id, "powerUps",
],
"queryParams" => $queryParams,
];
Expand Down
29 changes: 19 additions & 10 deletions geekyants/trelloservice/src/Services/CardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function fetch($queryParams = [])
return $this->verifyIdThenSendRequest($requestOptions);
}

function fetchFeild($field, $queryParams = [])
function fetchField($field, $queryParams = [])
{
$requestOptions = [
"id" => $this->id,
Expand Down Expand Up @@ -273,8 +273,8 @@ function update($queryParams = [])

function updateComment($idAction, $queryParams = [])
{
if (!array_key_exists("Text", $queryParams) || !$this->utils->isNotEmpty($queryParams["Text"])) {
return ["error" => "Text should be present in query params"];
if (!array_key_exists("text", $queryParams)) {
return ["error" => "text should be present in query params"];
}
$requestOptions = [
"id" => $this->id,
Expand Down Expand Up @@ -343,7 +343,7 @@ function updateSticker($idSticker, $queryParams = [])

function create($queryParams)
{
if (!array_key_exists("idList", $queryParams) || !$this->utils->isNotEmpty($queryParams["idList"])) {
if (!array_key_exists("idList", $queryParams)) {
return ["error" => "idList should be present in query params"];
}
$requestOptions = [
Expand All @@ -363,15 +363,16 @@ function create($queryParams)

function addComment($queryParams)
{
if (!array_key_exists("text", $queryParams) || !$this->utils->isNotEmpty($queryParams["text"])) {
if (!array_key_exists("text", $queryParams)) {
return ["error" => "text should be present in query params"];
}
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
$this->id,
"action",
"actions",
"comments"
],
"queryParams" => $queryParams,
Expand All @@ -383,6 +384,7 @@ function addComment($queryParams)
function addAttachment($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand All @@ -398,6 +400,7 @@ function addAttachment($queryParams = [])
function addChecklist($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand All @@ -413,6 +416,7 @@ function addChecklist($queryParams = [])
function addLabels($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand All @@ -428,6 +432,7 @@ function addLabels($queryParams = [])
function addMembers($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand All @@ -439,12 +444,13 @@ function addMembers($queryParams = [])
return $this->verifyIdThenSendRequest($requestOptions);
}

function addNewLable($queryParams)
function addNewLabel($queryParams)
{
if (!array_key_exists("label", $queryParams) || !$this->utils->isNotEmpty($queryParams["label"])) {
return ["error" => "label should be present in query params"];
if (!array_key_exists("color", $queryParams)) {
return ["error" => "color should be present in query params"];
}
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand All @@ -459,6 +465,7 @@ function addNewLable($queryParams)
function markNotificationsRead($queryParams = [])
{
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand All @@ -476,6 +483,7 @@ function voteByMember($queryParams)
return ["error" => "value should be present in query params"];
}
$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand Down Expand Up @@ -506,6 +514,7 @@ function addSticker($queryParams)
}

$requestOptions = [
"id" => $this->id,
"requestMethod" => "POST",
"path" => [
"cards",
Expand Down Expand Up @@ -599,7 +608,7 @@ function removeLabel($idLabel)
"path" => [
"cards",
$this->id,
"idLabel",
"idLabels",
$idLabel
]
];
Expand Down
Loading