Skip to content

Instantly share code, notes, and snippets.

@webislife
Created May 8, 2019 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webislife/039b1199c2414cafd082bb163727e9c2 to your computer and use it in GitHub Desktop.
Save webislife/039b1199c2414cafd082bb163727e9c2 to your computer and use it in GitHub Desktop.
<%_ let pathNames = Object.keys(paths); -%>
/* eslint-disable */
/**
* Class Swagger API
*/
export class SwaggerApi {
<%_ for(let i = 0; i < pathNames.length; ++i) {
let path = paths[pathNames[i]]; -%>
<% for(let action in path) {
let endpoint = path[action];
%>
/**
* <%=endpoint.summary%>
* @param {Object} payload query <%=(action === 'get') ? 'params' : 'data'%>
* @returns {Object} {<%=Object.keys(endpoint.responses["200"].content["application/json"].schema.properties).join(", ")%>}
*/
<%=endpoint.operationId%>(payload) {
return this.Request.<%=action%>("/api/v4<%=pathNames[i]%>/",
{
<%=(action === 'get') ? 'params' : 'data'%>: payload
}
);
} <% } } %>
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment