Skip to content

Commit

Permalink
Merge pull request #91 from BDav24/create_many
Browse files Browse the repository at this point in the history
Add support for create_many imports/tickets and create_many group_memberships
  • Loading branch information
miogalang committed Jul 10, 2015
2 parents 821ef56 + d2e9ebb commit 5dd0643
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Zendesk/API/GroupMemberships.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,27 @@ public function create(array $params)
return $response;
}

/**
* Create multiple new group memberships
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function createMany(array $params) {
$endPoint = Http::prepare('group_memberships/create_many.json');
$response = Http::send($this->client, $endPoint, array (self::OBJ_NAME_PLURAL => $params), 'POST');
if ((!is_object($response)) || ($this->client->getDebug()->lastResponseCode != 200)) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}

/**
* Delete a group membership
*
Expand Down
20 changes: 20 additions & 0 deletions src/Zendesk/API/TicketImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,24 @@ public function import(array $params)
return $response;
}

/**
* Create multiple new tickets
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function importMany(array $params) {
$endPoint = Http::prepare('imports/tickets/create_many.json');
$response = Http::send($this->client, $endPoint, array (self::OBJ_NAME_PLURAL => $params), 'POST');
if ((!is_object($response)) || ($this->client->getDebug()->lastResponseCode != 200)) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}

}
9 changes: 9 additions & 0 deletions src/Zendesk/API/Tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,15 @@ public function import(array $params)
return $this->import->import($params);
}

/**
* @param array $params
*
* @throws ResponseException
*
* @return mixed
*/
public function importMany(array $params) { return $this->import->importMany($params); }

/**
* @param array $params
*
Expand Down

0 comments on commit 5dd0643

Please sign in to comment.