Skip to content

Commit

Permalink
1.1.0 update (#37)
Browse files Browse the repository at this point in the history
* 1.1.0 update
  • Loading branch information
spencerhunter authored May 20, 2019
1 parent 3c17c1c commit 37d5e7e
Show file tree
Hide file tree
Showing 22 changed files with 1,394 additions and 28 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The new Dwolla API V2 SDK, as generated by [this fork of swagger-codegen](https:

## Version

1.0.20
1.1.0

## Installation

Expand Down Expand Up @@ -33,7 +33,7 @@ To get started, all you need to set is the `access_token` and `host` values.
DwollaSwagger\Configuration::$access_token = 'a token';

# For Sandbox
$apiClient = new DwollaSwagger\ApiClient("https://api-sandbox.dwolla.com/");
$apiClient = new DwollaSwagger\ApiClient("https://api-sandbox.dwolla.com");

# For production
$apiClient = new DwollaSwagger\ApiClient("https://api.dwolla.com");
Expand Down Expand Up @@ -91,6 +91,9 @@ Each API module is named in accordance to ([Dwolla's API Spec](http://docsv2.dwo
* `DocumentsApi`
* `EventsApi`
* `FundingsourcesApi`
* `LabelsApi`
* `LabelreallocationsApi`
* `LedgerentriesApi`
* `MasspaymentitemsApi`
* `MasspaymentsApi`
* `OndemandauthorizationsApi`
Expand Down Expand Up @@ -151,6 +154,12 @@ Each model represents the different kinds of requests and responses that can be

## Changelog

1.1.0
* API schema updated, `CustomersApi` updated to support Labels related endpoints.
* New `LabelsApi`, `LabelreallocationsApi`, and `LedgerentriesApi`.
* Existing `CreateCustomer`, `Customer`, `MassPaymentRequestBody`, `MassPaymentRequestBody`, `Owner`, `Transfer`, `TransferRequestBody` and `UpdateCustomer` models updated.
* New `AddLabelLedgerEntryRequest`, `CreateCustomerLabelRequest`, `Label`, `LabelListResponse`, `LabelReallocation`, `LabelReallocationRequest`, `LedgerEntry`, and `LedgerEntryListResponse` models.

1.0.20
* Fix previously patched issue with parsing Location header in 201 response in ApiClient.

Expand Down
2 changes: 1 addition & 1 deletion lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ApiClient {
/*
* @var string user agent of the HTTP request, set to "PHP-Swagger" by default
*/
protected $user_agent = "PHP-Swagger";
protected $user_agent = "php-swagger-1.1.0";

/**
* @param string $host Base url of the API server (optional)
Expand Down
143 changes: 142 additions & 1 deletion lib/CustomersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,5 +852,146 @@ public function getCustomerIavToken($id) {
return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'IavToken');
}

/**
* createLabel
*
* Create a label.
*
* @param CreateCustomerLabelRequest $body Label to create. (required)
* @param string $id Customer id to create label for. (required)
* @return Label
*/
public function createLabel($body, $id) {

// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling createLabel');
}


// parse inputs
$resourcePath = "/customers/{id}/labels";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/vnd.dwolla.v1.hal+json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/vnd.dwolla.v1.hal+json'));




// Entire URL for ID
if (filter_var($id, FILTER_VALIDATE_URL)) {
$split = explode('/', $id);
$id = end($split);
}
// path params
if($id !== null) {
$resourcePath = str_replace("{" . "id" . "}",
$this->apiClient->toPathValue($id), $resourcePath);
}

// body params
$_tempBody = null;
if (isset($body)) {
$_tempBody = $body;
}

// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) {
// for HTTP post (form)
$httpBody = $formParams;
}

// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $httpBody,
$headerParams, $this->authSettings);

if(!$response[1]) {
return null;
}

return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'Label');
}

/**
* getLabelsForCustomer
*
* Get labels for customer.
*
* @param string $id Customer id to get labels for. (required)
* @return LabelListResponse
*/
public function getLabelsForCustomer($id, $limit = null, $offset = null) {

// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling getLabelsForCustomer');
}


// parse inputs
$resourcePath = "/customers/{id}/labels";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/vnd.dwolla.v1.hal+json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/vnd.dwolla.v1.hal+json'));

// query params
if($limit !== null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}// query params
if($offset !== null) {
$queryParams['offset'] = $this->apiClient->toQueryValue($offset);
}

// Entire URL for ID
if (filter_var($id, FILTER_VALIDATE_URL)) {
$split = explode('/', $id);
$id = end($split);
}
// path params
if($id !== null) {
$resourcePath = str_replace("{" . "id" . "}",
$this->apiClient->toPathValue($id), $resourcePath);
}



// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) {
// for HTTP post (form)
$httpBody = $formParams;
}

// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $httpBody,
$headerParams, $this->authSettings);

if(!$response[1]) {
return null;
}

return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'LabelListResponse');
}

}
}
182 changes: 182 additions & 0 deletions lib/LabelreallocationsApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<?php
/**
* Copyright 2015 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*/

namespace DwollaSwagger;

class LabelreallocationsApi {

function __construct($apiClient = null) {
if (null === $apiClient) {
if (Configuration::$apiClient === null) {
Configuration::$apiClient = new ApiClient(); // create a new API client if not present
$this->apiClient = Configuration::$apiClient;
}
else
$this->apiClient = Configuration::$apiClient; // use the default one
} else {
$this->apiClient = $apiClient; // use the one provided by the user
}

// Authentication methods
$this->authSettings = array('oauth2');
}

private $apiClient; // instance of the ApiClient

/**
* get the API client
*/
public function getApiClient() {
return $this->apiClient;
}

/**
* set the API client
*/
public function setApiClient($apiClient) {
$this->apiClient = $apiClient;
}


/**
* reallocateLabel
*
* Reallocate two labels.
*
* @param LabelReallocationRequest $body Labels to reallocate. (required)
* @return LabelReallocation
*/
public function reallocateLabel($body) {


// parse inputs
$resourcePath = "/label-reallocations";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/vnd.dwolla.v1.hal+json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/vnd.dwolla.v1.hal+json'));





// body params
$_tempBody = null;
if (isset($body)) {
$_tempBody = $body;
}

// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) {
// for HTTP post (form)
$httpBody = $formParams;
}

// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $httpBody,
$headerParams, $this->authSettings);

if(!$response[1]) {
return null;
}

return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'LabelReallocation');
}

/**
* getLabelReallocation
*
* Get label reallocation.
*
* @param string $id Label reallocation ID (required)
* @return LabelReallocation
*/
public function getLabelReallocation($id) {

// verify the required parameter 'id' is set
if ($id === null) {
throw new \InvalidArgumentException('Missing the required parameter $id when calling getLabelReallocation');
}


// parse inputs
$resourcePath = "/label-reallocations/{id}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/vnd.dwolla.v1.hal+json'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/vnd.dwolla.v1.hal+json'));




// Entire URL for ID
if (filter_var($id, FILTER_VALIDATE_URL)) {
$split = explode('/', $id);
$id = end($split);
}
// path params
if($id !== null) {
$resourcePath = str_replace("{" . "id" . "}",
$this->apiClient->toPathValue($id), $resourcePath);
}



// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) {
// for HTTP post (form)
$httpBody = $formParams;
}

// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $httpBody,
$headerParams, $this->authSettings);

if(!$response[1]) {
return null;
}

return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],'LabelReallocation');
}


}
Loading

0 comments on commit 37d5e7e

Please sign in to comment.