Skip to content

Commit

Permalink
Merge pull request #267 from plivo/SMS-4444-Brand-Usecase
Browse files Browse the repository at this point in the history
Brand Usecase
  • Loading branch information
renoldthomas-plivo committed Nov 9, 2022
2 parents c6350fa + 28a0148 commit 4377404
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [v4.35.0](https://github.com/plivo/plivo-node/tree/v4.35.0) (2022-11-04)
**Brand Usecase Request**
- Brand Usecase Request endpoint added

## [v4.34.3](https://github.com/plivo/plivo-go/tree/v4.34.3) (2022-11-07)
**Bug fix - List all Endpoint**
- Removed duplicate responses
Expand Down
18 changes: 15 additions & 3 deletions lib/resources/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ let idKey = Symbol('id filed');
}
}


export class BrandCreationResponse {
constructor(params) {
params = params || {};
Expand Down Expand Up @@ -79,7 +78,7 @@ export class BrandCreationResponse {
/**
* Brand Registration
* @method
* @param {object} params
* @param {object} params
* @param {string} brand_alias
* @param {string} profile_uuid
* @param {string} brand_type
Expand All @@ -105,4 +104,17 @@ export class BrandCreationResponse {
});

}
}

/**
* get BrandUsecases by given id
* @method
* @param {string} brandID - id of brand
* @promise {object} return {@link Brand} object
* @fail {Error} return Error
*/
get_usecases(brandId) {
return super.customexecuteAction(action+brandId+'/usecases/', 'GET');
}


}
20 changes: 18 additions & 2 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export function Request(config) {
"total_rate": "0.03570",
"stir_verification": "Not Applicable",
"voice_network_group": "India All Networks",
"stir_attestation": ""
"stir_attestation": ""
}
});
}
Expand Down Expand Up @@ -1314,6 +1314,22 @@ export function Request(config) {
}
});
}
else if (action == '10dlc/Brand/BRPXS6E/usecases/' && method == 'GET'){
resolve({
response: {},
body: {
"api_id": "dbc70630-3296-11ed-9b52-0242ac110004",
"use_cases": [
{
"name": "Starter",
"code": "STARTER",
"details": "Low cost campaign type designed for individuals and small businesses"
}
],
"brand_id": "BRPXS6E"
}
});
}
else if(action == 'Profile/' && method == 'GET'){
resolve({
response: {},
Expand Down Expand Up @@ -1568,7 +1584,7 @@ export function Request(config) {
body: {
apiId: '5b058374-bba8-11ec-ab4d-0242ac110002',
campaignId: 'CFSOBZQ',
message: 'Request to create campaign was received and is being processed.'
message: 'Request to create campaign was received and is being processed.'
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plivo",
"version": "4.34.3",
"version": "4.35.0",
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
"homepage": "https://github.com/plivo/plivo-node",
"files": [
Expand Down
17 changes: 12 additions & 5 deletions test/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import {
} from '../lib/base.js';
import assert from 'assert';
import sinon from 'sinon';

let client = new Client('sampleid', 'sammpletoken', 'sampleproxy');

describe('brand', function () {
it('should get brand', function () {
return client.brand.get('BRPXS6E')
.then(function (brand) {
assert.equal(brand.brand.brandId, 'B1QSGGS')
})
});

it('list brand', function () {
return client.brand.list()
.then(function (brand) {
Expand All @@ -31,5 +31,12 @@ import {
})
});


});
it('should get brand usecases', function () {
return client.brand.get_usecases('BRPXS6E')
.then(function (brand) {
assert.equal(brand.brandId, 'BRPXS6E')
})
});


});

0 comments on commit 4377404

Please sign in to comment.