@industriousoffice/mailchimp_marketing
Version:
This is a modified version of the official Node client library for the Mailchimp Marketing API meant to be usesd for both production and testing purposes.
840 lines (750 loc) • 40.9 kB
JavaScript
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* Reporting service.
* @module api/ReportingApi
*/
/**
* Constructs a new ReportingApi.
* @alias module:api/ReportingApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* List facebook ads reports
* Get reports of Facebook ads.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {module:model/String} opts.sortField Returns files sorted by the specified field.
* @param {module:model/String} opts.sortDir Determines the order direction for sorted results.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20010} and HTTP response
*/
this.getFacebookAdsReportAllWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset']),
'sort_field': ( opts['sortField'] ? opts['sortField'] : opts['sort_field']),
'sort_dir': ( opts['sortDir'] ? opts['sortDir'] : opts['sort_dir'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/facebook-ads', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List facebook ads reports
* Get reports of Facebook ads.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {module:model/String} opts.sortField Returns files sorted by the specified field.
* @param {module:model/String} opts.sortDir Determines the order direction for sorted results.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20010}
*/
this.getFacebookAdsReportAll = function(opts) {
return this.getFacebookAdsReportAllWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get facebook ad report
* Get report of a Facebook ad.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20011} and HTTP response
*/
this.getFacebookAdReportWithHttpInfo = function(outreachId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
var pathParams = {
'outreach_id': outreachId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/facebook-ads/{outreach_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get facebook ad report
* Get report of a Facebook ad.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20011}
*/
this.getFacebookAdReport = function(outreachId, opts) {
return this.getFacebookAdReportWithHttpInfo(outreachId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List facebook ecommerce report
* Get breakdown of product activity for an outreach.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {module:model/String} opts.sortField Returns files sorted by the specified field.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2007} and HTTP response
*/
this.getFacebookAdProductActivityReportWithHttpInfo = function(outreachId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
var pathParams = {
'outreach_id': outreachId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset']),
'sort_field': ( opts['sortField'] ? opts['sortField'] : opts['sort_field'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/facebook-ads/{outreach_id}/ecommerce-product-activity', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List facebook ecommerce report
* Get breakdown of product activity for an outreach.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {module:model/String} opts.sortField Returns files sorted by the specified field.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2007}
*/
this.getFacebookAdProductActivityReport = function(outreachId, opts) {
return this.getFacebookAdProductActivityReportWithHttpInfo(outreachId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List landing pages reports
* Get reports of landing pages.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20012} and HTTP response
*/
this.getLandingPageReportsAllWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/landing-pages', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List landing pages reports
* Get reports of landing pages.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20012}
*/
this.getLandingPageReportsAll = function(opts) {
return this.getLandingPageReportsAllWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get landing page report
* Get report of a landing page.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/LandingPageReport} and HTTP response
*/
this.getLandingPageReportWithHttpInfo = function(outreachId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
var pathParams = {
'outreach_id': outreachId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/landing-pages/{outreach_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get landing page report
* Get report of a landing page.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/LandingPageReport}
*/
this.getLandingPageReport = function(outreachId, opts) {
return this.getLandingPageReportWithHttpInfo(outreachId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List survey reports
* Get reports for surveys.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20013} and HTTP response
*/
this.getSurveyReportsAllWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List survey reports
* Get reports for surveys.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20013}
*/
this.getSurveyReportsAll = function(opts) {
return this.getSurveyReportsAllWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get survey report
* Get report for a survey.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SurveyReport} and HTTP response
*/
this.getSurveyReportWithHttpInfo = function(outreachId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
var pathParams = {
'outreach_id': outreachId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys/{outreach_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get survey report
* Get report for a survey.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SurveyReport}
*/
this.getSurveyReport = function(outreachId, opts) {
return this.getSurveyReportWithHttpInfo(outreachId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List survey question reports
* Get reports for survey questions.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20014} and HTTP response
*/
this.getSurveyQuestionReportsAllWithHttpInfo = function(outreachId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
var pathParams = {
'outreach_id': outreachId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys/{outreach_id}/questions', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List survey question reports
* Get reports for survey questions.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20014}
*/
this.getSurveyQuestionReportsAll = function(outreachId, opts) {
return this.getSurveyQuestionReportsAllWithHttpInfo(outreachId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get survey question report
* Get report for a survey question.
* @param {String} outreachId The outreach id.
* @param {String} questionId The ID of the survey question.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SurveyQuestionReport} and HTTP response
*/
this.getSurveyQuestionReportWithHttpInfo = function(outreachId, questionId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
// verify the required parameter 'questionId' is set
if (questionId === undefined || questionId === null) {
throw new Error("Missing the required parameter 'questionId' when calling ");
}
var pathParams = {
'outreach_id': outreachId,
'question_id': questionId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys/{outreach_id}/questions/{question_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get survey question report
* Get report for a survey question.
* @param {String} outreachId The outreach id.
* @param {String} questionId The ID of the survey question.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SurveyQuestionReport}
*/
this.getSurveyQuestionReport = function(outreachId, questionId, opts) {
return this.getSurveyQuestionReportWithHttpInfo(outreachId, questionId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List answers for question
* Get answers for a survey question.
* @param {String} outreachId The outreach id.
* @param {String} questionId The ID of the survey question.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {module:model/String} opts.respondentFamiliarityIs Filter survey responses by familiarity of the respondents.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20015} and HTTP response
*/
this.getSurveyQuestionAnswersWithHttpInfo = function(outreachId, questionId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
// verify the required parameter 'questionId' is set
if (questionId === undefined || questionId === null) {
throw new Error("Missing the required parameter 'questionId' when calling ");
}
var pathParams = {
'outreach_id': outreachId,
'question_id': questionId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'respondent_familiarity_is': ( opts['respondentFamiliarityIs'] ? opts['respondentFamiliarityIs'] : opts['respondent_familiarity_is'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys/{outreach_id}/questions/{question_id}/answers', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List answers for question
* Get answers for a survey question.
* @param {String} outreachId The outreach id.
* @param {String} questionId The ID of the survey question.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {module:model/String} opts.respondentFamiliarityIs Filter survey responses by familiarity of the respondents.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20015}
*/
this.getSurveyQuestionAnswers = function(outreachId, questionId, opts) {
return this.getSurveyQuestionAnswersWithHttpInfo(outreachId, questionId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List survey responses
* Get responses to a survey.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.answeredQuestion The ID of the question that was answered.
* @param {String} opts.choseAnswer The ID of the option chosen to filter responses on.
* @param {module:model/String} opts.respondentFamiliarityIs Filter survey responses by familiarity of the respondents.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse20016} and HTTP response
*/
this.getSurveyResponsesAllWithHttpInfo = function(outreachId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
var pathParams = {
'outreach_id': outreachId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'answered_question': ( opts['answeredQuestion'] ? opts['answeredQuestion'] : opts['answered_question']),
'chose_answer': ( opts['choseAnswer'] ? opts['choseAnswer'] : opts['chose_answer']),
'respondent_familiarity_is': ( opts['respondentFamiliarityIs'] ? opts['respondentFamiliarityIs'] : opts['respondent_familiarity_is'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys/{outreach_id}/responses', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List survey responses
* Get responses to a survey.
* @param {String} outreachId The outreach id.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.answeredQuestion The ID of the question that was answered.
* @param {String} opts.choseAnswer The ID of the option chosen to filter responses on.
* @param {module:model/String} opts.respondentFamiliarityIs Filter survey responses by familiarity of the respondents.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse20016}
*/
this.getSurveyResponsesAll = function(outreachId, opts) {
return this.getSurveyResponsesAllWithHttpInfo(outreachId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get survey response
* Get a single survey response.
* @param {String} outreachId The outreach id.
* @param {String} responseId The ID of the survey response.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SurveyResponse} and HTTP response
*/
this.getSurveyResponseWithHttpInfo = function(outreachId, responseId) {
var postBody = null;
// verify the required parameter 'outreachId' is set
if (outreachId === undefined || outreachId === null) {
throw new Error("Missing the required parameter 'outreachId' when calling ");
}
// verify the required parameter 'responseId' is set
if (responseId === undefined || responseId === null) {
throw new Error("Missing the required parameter 'responseId' when calling ");
}
var pathParams = {
'outreach_id': outreachId,
'response_id': responseId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/reporting/surveys/{outreach_id}/responses/{response_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get survey response
* Get a single survey response.
* @param {String} outreachId The outreach id.
* @param {String} responseId The ID of the survey response.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SurveyResponse}
*/
this.getSurveyResponse = function(outreachId, responseId) {
return this.getSurveyResponseWithHttpInfo(outreachId, responseId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};