Skip to content

Commit

Permalink
- Added API update/delete role routes
Browse files Browse the repository at this point in the history
- Added Farm image tracking routes
  • Loading branch information
kfitzgerald committed Oct 9, 2019
1 parent da39f05 commit 89e9ef3
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 7 deletions.
100 changes: 99 additions & 1 deletion dist/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function Client(config) {
/**
* SDK Version
*/
Client.Version = '3.0.0';
Client.Version = '3.1.0';

/**
* Expose the Provider base class
Expand Down Expand Up @@ -1103,6 +1103,46 @@ Client.resourceBinders.push(function(Client) {
}, callback);
},

/**
* Updates a role
* @param {string} role_id – Object identifier.
* @param {object} payload - Resource or parameters
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.roles#
*/
update: function(role_id, payload, callback) {
return Client._makeRequest({
api: 'api',
action: 'role.update',
method: 'PUT',
path: '/roles/{role_id}',
pathParams: {
role_id: role_id
},
payload: payload
}, callback);
},

/**
* Deletes a role
* @param {string} role_id – Object identifier.
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.roles#
*/
delete: function(role_id, callback) {
return Client._makeRequest({
api: 'api',
action: 'role.delete',
method: 'DELETE',
path: '/roles/{role_id}',
pathParams: {
role_id: role_id
}
}, callback);
},

/**
* Adds an account to a role.
* @param {string} role_id – Object identifier.
Expand Down Expand Up @@ -1562,6 +1602,35 @@ Client.resourceBinders.push(function(Client) {
}, callback);
},

/**
* Tracks an image impression for the given Amazon link
* @param {string} instance_id – Instance Id
* @param {string} vendor_id_asin – Unique amazon product id, using combined vendor_id:asin pair
* @param {object} [query] - Filter arguments
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.amazon_links#
*/
track_impression: function(instance_id, vendor_id_asin, query, callback) {
// Shift optional arguments, if necessary
if (typeof query === "function") {
callback = query;
query = undefined;
}

return Client._makeRequest({
api: 'farm',
action: 'amazon_link.track_impression',
method: 'GET',
path: '/images/{instance_id}/links/amazon/{vendor_id_asin}',
pathParams: {
instance_id: instance_id,
vendor_id_asin: vendor_id_asin
},
query: query
}, callback);
},

/**
* Deletes an Amazon link.
* @param {string} instance_id – Instance Id
Expand Down Expand Up @@ -2092,6 +2161,35 @@ Client.resourceBinders.push(function(Client) {
vendor_offer_id: vendor_offer_id
}
}, callback);
},

/**
* Tracks an image impression for the given offer
* @param {string} instance_id – Instance Id
* @param {string} vendor_offer_id – Unique offer id, using combined vendor_id:offer_id pair
* @param {object} [query] - Filter arguments
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.direct_links#
*/
track_impression: function(instance_id, vendor_offer_id, query, callback) {
// Shift optional arguments, if necessary
if (typeof query === "function") {
callback = query;
query = undefined;
}

return Client._makeRequest({
api: 'farm',
action: 'direct_link.track_impression',
method: 'GET',
path: '/images/{instance_id}/links/{vendor_offer_id}',
pathParams: {
instance_id: instance_id,
vendor_offer_id: vendor_offer_id
},
query: query
}, callback);
}

};
Expand Down
102 changes: 100 additions & 2 deletions dist/okanjo-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ function copy(destination, source) {
*/
function buildPath(path, params) {

var extractParams = /\{([a-zA-Z_]+)}/g,
var extractParams = /{([a-zA-Z_]+)}/g,
resultPath = path,
p, token, name;

Expand Down Expand Up @@ -1904,7 +1904,7 @@ function Client(config) {
/**
* SDK Version
*/
Client.Version = '3.0.0';
Client.Version = '3.1.0';

/**
* Expose the Provider base class
Expand Down Expand Up @@ -2925,6 +2925,46 @@ Client.resourceBinders.push(function(Client) {
}, callback);
},

/**
* Updates a role
* @param {string} role_id – Object identifier.
* @param {object} payload - Resource or parameters
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.roles#
*/
update: function(role_id, payload, callback) {
return Client._makeRequest({
api: 'api',
action: 'role.update',
method: 'PUT',
path: '/roles/{role_id}',
pathParams: {
role_id: role_id
},
payload: payload
}, callback);
},

/**
* Deletes a role
* @param {string} role_id – Object identifier.
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.roles#
*/
delete: function(role_id, callback) {
return Client._makeRequest({
api: 'api',
action: 'role.delete',
method: 'DELETE',
path: '/roles/{role_id}',
pathParams: {
role_id: role_id
}
}, callback);
},

/**
* Adds an account to a role.
* @param {string} role_id – Object identifier.
Expand Down Expand Up @@ -3384,6 +3424,35 @@ Client.resourceBinders.push(function(Client) {
}, callback);
},

/**
* Tracks an image impression for the given Amazon link
* @param {string} instance_id – Instance Id
* @param {string} vendor_id_asin – Unique amazon product id, using combined vendor_id:asin pair
* @param {object} [query] - Filter arguments
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.amazon_links#
*/
track_impression: function(instance_id, vendor_id_asin, query, callback) {
// Shift optional arguments, if necessary
if (typeof query === "function") {
callback = query;
query = undefined;
}

return Client._makeRequest({
api: 'farm',
action: 'amazon_link.track_impression',
method: 'GET',
path: '/images/{instance_id}/links/amazon/{vendor_id_asin}',
pathParams: {
instance_id: instance_id,
vendor_id_asin: vendor_id_asin
},
query: query
}, callback);
},

/**
* Deletes an Amazon link.
* @param {string} instance_id – Instance Id
Expand Down Expand Up @@ -3914,6 +3983,35 @@ Client.resourceBinders.push(function(Client) {
vendor_offer_id: vendor_offer_id
}
}, callback);
},

/**
* Tracks an image impression for the given offer
* @param {string} instance_id – Instance Id
* @param {string} vendor_offer_id – Unique offer id, using combined vendor_id:offer_id pair
* @param {object} [query] - Filter arguments
* @param {requestCallback} [callback] – Optional callback. When present, the request is executed
* @return {Query} - Compiled query ready for execution
* @memberof Client.direct_links#
*/
track_impression: function(instance_id, vendor_offer_id, query, callback) {
// Shift optional arguments, if necessary
if (typeof query === "function") {
callback = query;
query = undefined;
}

return Client._makeRequest({
api: 'farm',
action: 'direct_link.track_impression',
method: 'GET',
path: '/images/{instance_id}/links/{vendor_offer_id}',
pathParams: {
instance_id: instance_id,
vendor_offer_id: vendor_offer_id
},
query: query
}, callback);
}

};
Expand Down
4 changes: 2 additions & 2 deletions dist/okanjo-sdk.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/okanjo-sdk.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "okanjo",
"version": "3.0.0",
"version": "3.1.0",
"description": "Integrate your application with the Okanjo API.",
"main": "dist/client.js",
"scripts": {
Expand Down

0 comments on commit 89e9ef3

Please sign in to comment.