Skip to content

Commit 1c5c766

Browse files
authored
Merge pull request #77 from pipedrive/GRAL-3316
GRAL-3316 Added shortened aliases for the add/update deal product methods
2 parents 1c7719d + d8228dd commit 1c5c766

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,22 +2139,22 @@ $deals->listProductsAttachedToADeal($collect);
21392139
```
21402140

21412141

2142-
### <a name="add_a_product_to_the_deal_eventually_creating_a_new_item_called_a_deal_product"></a>![Method: ](https://apidocs.io/img/method.png ".DealsController.addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct") addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct
2142+
### <a name="add_a_product_to_the_deal_eventually_creating_a_new_item_called_a_deal_product"></a>![Method: ](https://apidocs.io/img/method.png ".DealsController.addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct") addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct <br>_alias_ `addAProductToADeal`
21432143

21442144
> Adds a product to the deal.
21452145
21462146

21472147
```php
2148-
function addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($options)
2148+
function addAProductToADeal($options);
2149+
function addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($options);
21492150
```
21502151

21512152
#### Parameters
21522153

21532154
| Parameter | Tags | Description |
21542155
|-----------|------|-------------|
21552156
| id | ``` Required ``` | ID of the deal |
2156-
| body | ``` Optional ``` | TODO: Add a parameter description |
2157-
2157+
| body | ``` Required ``` | [Body object](https://developers.pipedrive.com/docs/api/v1/Deals#addDealProduct) that has all required body parameters |
21582158

21592159

21602160
#### Example Usage
@@ -2166,29 +2166,32 @@ $collect['id'] = $id;
21662166
$body = array('key' => 'value');
21672167
$collect['body'] = $body;
21682168

2169-
2170-
$result = $deals->addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($collect);
2169+
$result = $deals->addAProductToADeal($collect);
2170+
// OR
2171+
// $result = $deals->addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($collect);
21712172

21722173
```
21732174

21742175

2175-
### <a name="update_product_attachment_details_of_the_deal_product_a_product_already_attached_to_a_deal"></a>![Method: ](https://apidocs.io/img/method.png ".DealsController.updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal") updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal
2176+
### <a name="update_product_attachment_details_of_the_deal_product_a_product_already_attached_to_a_deal"></a>![Method: ](https://apidocs.io/img/method.png ".DealsController.updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal") updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal <br>_alias_ `updateTheProductAttachedToADeal`
21762177

21772178
> Updates product attachment details.
21782179
21792180

21802181
```php
2181-
function updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($options)
2182+
function updateTheProductAttachedToADeal($options);
2183+
function updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($options);
21822184
```
21832185

21842186
#### Parameters
21852187

21862188
| Parameter | Tags | Description |
21872189
|-----------|------|-------------|
21882190
| id | ``` Required ``` | ID of the deal |
2189-
| productAttachmentId | ``` Required ``` | ID of the deal-product (the ID of the product attached to the deal) |
2190-
| itemPrice | ``` Optional ``` | Price at which this product will be added to the deal |
2191-
| quantity | ``` Optional ``` | Quantity – e.g. how many items of this product will be added to the deal |
2191+
| productAttachmentId | ``` Required ``` | The ID of the deal-product (the ID of the product attached to the deal) |
2192+
| productId | ``` Required ``` | The ID of the product to use |
2193+
| itemPrice | ``` Required ``` | Price at which this product will be added to the deal |
2194+
| quantity | ``` Required ``` | Quantity – e.g. how many items of this product will be added to the deal |
21922195
| discountPercentage | ``` Optional ``` | Discount %. If omitted, will be set to 0 |
21932196
| duration | ``` Optional ``` | Duration of the product (when product durations are not enabled for the company or if omitted, defaults to 1) |
21942197
| productVariationId | ``` Optional ``` | ID of the product variation to use. When omitted, no variation will be used. |
@@ -2206,6 +2209,9 @@ $collect['id'] = $id;
22062209
$productAttachmentId = 27;
22072210
$collect['productAttachmentId'] = $productAttachmentId;
22082211

2212+
$productId = 2;
2213+
$collect['productId'] = $productId;
2214+
22092215
$itemPrice = 27.9633801840075;
22102216
$collect['itemPrice'] = $itemPrice;
22112217

@@ -2227,8 +2233,9 @@ $collect['comments'] = $comments;
22272233
$enabledFlag = int::ENUM_0;
22282234
$collect['enabledFlag'] = $enabledFlag;
22292235

2230-
2231-
$result = $deals->updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($collect);
2236+
$result = $deals->updateTheProductAttachedToADeal($collect);
2237+
// OR
2238+
// $result = $deals->updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($collect);
22322239

22332240
```
22342241

src/Controllers/DealsController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,9 @@ public function listProductsAttachedToADeal(
15261526
* @return mixed response from the API call
15271527
* @throws APIException Thrown if API call fails
15281528
*/
1529+
public function addAProductToADeal($options) {
1530+
return $this->addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($options);
1531+
}
15291532
public function addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct(
15301533
$options
15311534
) {
@@ -1605,6 +1608,9 @@ public function addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct
16051608
* @return mixed response from the API call
16061609
* @throws APIException Thrown if API call fails
16071610
*/
1611+
public function updateTheProductAttachedToADeal($options) {
1612+
return $this->updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($options);
1613+
}
16081614
public function updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal(
16091615
$options
16101616
) {
@@ -1632,6 +1638,7 @@ public function updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAtt
16321638

16331639
//prepare parameters
16341640
$_parameters = array (
1641+
'product_id' => $this->val($options, 'productId'),
16351642
'item_price' => $this->val($options, 'itemPrice'),
16361643
'quantity' => $this->val($options, 'quantity'),
16371644
'discount_percentage' => $this->val($options, 'discountPercentage'),

0 commit comments

Comments
 (0)