>>=y,p-=y),p<15&&(c+=E[n++]<>>=y=g>>>24,p-=y,!(16&(y=g>>>16&255))){if(0==(64&y)){g=_[(65535&g)+(c&(1<>>=y,p-=y,(y=s-o)>3,c&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new O.Buf16(320),this.work=new O.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=L,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new O.Buf32(n),t.distcode=t.distdyn=new O.Buf32(i),t.sane=1,t.back=-1,N):U}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,o(e)):U}function f(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(O.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),O.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(O.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=D(r.check,C,2,0),d=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(d-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=D(r.check,C,2,0)),d=u=0,r.mode=3;case 3:for(;d<32;){if(0===a)break e;a--,u+=n[s++]<>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=D(r.check,C,4,0)),d=u=0,r.mode=4;case 4:for(;d<16;){if(0===a)break e;a--,u+=n[s++]<>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=D(r.check,C,2,0)),d=u=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===a)break e;a--,u+=n[s++]<>>8&255,r.check=D(r.check,C,2,0)),d=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(a<(c=r.length)&&(c=a),c&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),O.arraySet(r.head.extra,n,s,c,k)),512&r.flags&&(r.check=D(r.check,n,c,s)),a-=c,s+=c,r.length-=c),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break e;for(c=0;k=n[s+c++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&c>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;d<32;){if(0===a)break e;a--,u+=n[s++]<>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===a)break e;a--,u+=n[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,d-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===a)break e;a--,u+=n[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,d=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(c=r.length){if(a>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,286>>=3,d-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,v=65535&z,!((_=z>>>24)<=d);){if(0===a)break e;a--,u+=n[s++]<>>=_,d-=_,r.lens[r.have++]=v;else{if(16===v){for(E=_+2;d>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],c=3+(3&u),u>>>=2,d-=2}else if(17===v){for(E=_+3;d>>=_)),u>>>=3,d-=3}else{for(E=_+7;d>>=_)),u>>>=7,d-=7}if(r.have+c>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;c--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(R,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=a&&258<=f){e.next_out=o,e.avail_out=f,e.next_in=s,e.avail_in=a,r.hold=u,r.bits=d,B(e,l),o=e.next_out,i=e.output,f=e.avail_out,s=e.next_in,n=e.input,a=e.avail_in,u=r.hold,d=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;w=(z=r.lencode[u&(1<>>16&255,v=65535&z,!((_=z>>>24)<=d);){if(0===a)break e;a--,u+=n[s++]<>g)])>>>16&255,v=65535&z,!(g+(_=z>>>24)<=d);){if(0===a)break e;a--,u+=n[s++]<>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,r.length=v,0===w){r.mode=26;break}if(32&w){r.back=-1,r.mode=12;break}if(64&w){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&w,r.mode=22;case 22:if(r.extra){for(E=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;w=(z=r.distcode[u&(1<>>16&255,v=65535&z,!((_=z>>>24)<=d);){if(0===a)break e;a--,u+=n[s++]<>g)])>>>16&255,v=65535&z,!(g+(_=z>>>24)<=d);){if(0===a)break e;a--,u+=n[s++]<>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,64&w){e.msg="invalid distance code",r.mode=30;break}r.offset=v,r.extra=15&w,r.mode=24;case 24:if(r.extra){for(E=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===f)break e;if(c=l-f,r.offset>c){if((c=r.offset-c)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=c>r.wnext?(c-=r.wnext,r.wsize-c):r.wnext-c,c>r.length&&(c=r.length),m=r.window}else m=i,p=o-r.offset,c=r.length;for(fc?(m=B[T+o[g]],A[O+o[g]]):(m=96,0),f=1<>S)+(u-=f)]=p<<24|m<<16|_|0,0!==u;);for(f=1<>=1;if(0!==f?(C&=f-1,C+=f):C=0,g++,0==--I[v]){if(v===b)break;v=t[r+o[g]]}if(k>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function S(e,t,r){e.bi_valid>i-r?(e.bi_buf|=t<>i-e.bi_valid,e.bi_valid+=r-i):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function C(e,t,r){var n,i,s=new Array(_+1),o=0;for(n=1;n<=_;n++)s[n]=o=o+r[n-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=z(s[a]++,a))}}function A(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function O(e){8>1;1<=r;r--)D(e,s,r);for(i=f;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,D(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,o,a,f=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,l=t.stat_desc.extra_bits,c=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=_;s++)e.bl_count[s]=0;for(f[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)p<(s=f[2*f[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),f[2*n+1]=s,u>=7;n<30;n++)for(y[n]=i<<7,e=0;e<1<>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),T(e,e.l_desc),T(e,e.d_desc),o=function(e){var t;for(R(e,e.dyn_ltree,e.l_desc.max_code),R(e,e.dyn_dtree,e.d_desc.max_code),T(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?U(e,t,r,n):4===e.strategy||s===i?(S(e,2+(n?1:0),3),B(e,h,l)):(S(e,4+(n?1:0),3),function(e,t,r,n){var i;for(S(e,t-257,5),S(e,r-1,5),S(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(p[r]+256+1)]++,e.dyn_dtree[2*k(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){var t;S(e,2,3),E(e,256,h),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){"use strict";t.exports="function"==typeof setImmediate?setImmediate:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
\ No newline at end of file
diff --git a/js/na-api-explorer.js b/js/na-api-explorer.js
new file mode 100644
index 00000000..6cfefbee
--- /dev/null
+++ b/js/na-api-explorer.js
@@ -0,0 +1,488 @@
+let auth0 = null;
+let token = "";
+
+const configureClient = async () => {
+ auth0 = await createAuth0Client({
+ domain: "netapp-cloud-account.auth0.com",
+ client_id: "GDbjOb692SeKIoXQUyD8FcJCDToe9fuZ",
+ audience: "https://api.cloud.netapp.com",
+ // useRefreshTokens: true,
+ cacheLocation: 'localstorage'
+ });
+};
+
+const login = async () => {
+ await auth0.loginWithRedirect({
+ redirect_uri: window.location.origin+'/us-en/cloud/api-callback.html',
+ appState: { target: window.location.href }
+ });
+};
+
+const callApi = async (token, requestData) => {
+ let payload = requestData;
+ requestUrl = payload.url;
+ delete payload.url;
+ fetch(requestUrl, payload)
+ .then(response => {
+ let responseObject = "";
+ try {
+ responseObject = response.text();
+ return responseObject;
+ } catch(error) {
+ console.error("Unable to parse json object: ", error);
+ return response;
+ }
+ })
+ .then(responseMessage => {
+ if(typeof responseObject === 'object') {
+ responseMessage = JSON.stringify(responseMessage, null, 2); // Attempt to convert into a string
+ }
+
+ if(typeof responseMessage === 'string' && (responseMessage.startsWith('{') || responseMessage.startsWith('['))) {
+ // Format as prettified JSON if string variant:
+ responseMessage = JSON.stringify(JSON.parse(responseMessage), null, 2);
+ }
+
+ const responseElement = document.getElementById("response-code");
+ responseElement.innerText = responseMessage;
+ displayIfActive('#response-code', 'explorer-response');
+
+ })
+ .catch((error) => {
+ console.error('Unable to parse API response: ', error);
+ if(typeof error === 'object') {
+ error = JSON.stringify(error, null, 2); // Attempt to convert into a string
+ }
+
+ if(typeof error === 'string' && (error.startsWith('{') || error.startsWith('['))) {
+ // Format as prettified JSON if string variant:
+ error = JSON.stringify(JSON.parse(error), null, 2);
+ }
+ const responseElement = document.getElementById("response-code");
+ responseElement.innerText = error;
+ displayIfActive('#response-code', 'explorer-response');
+ });
+
+ return false;
+};
+
+
+window.onload = async () => {
+ $("#preamble").after("Try it out ");
+ await configureClient();
+ // const query = window.location.search;
+ // if (query.includes("code=") && query.includes("state=")) {
+ // console.log("Handling Redirect Callback...");
+ // console.log("Callback URL: " + document.location.href);
+ // /*
+ // handleRedirectCallback can only be called once.
+ // Probably should be in callback logic, and see if auth0 can
+ // read from localStorage between pages using isAuthenticated()
+ // and getTokenSilently() since login should persist across pages.
+ // */
+
+ // redirectResponse = await auth0.handleRedirectCallback();
+ // console.log("Response: "+JSON.stringify(redirectResponse, null, 2));
+ // const url = window.location.origin + '' + window.location.pathname;
+ // console.log("URL is: "+url);
+ // window.history.replaceState({}, document.title, url);
+
+ // const redirect_uri = redirectResponse.appState.target;
+ // if (redirect_uri) {
+ // console.log("Redirect URL: "+redirect_uri);
+ // document.location.href = redirect_uri + document.location.search;
+ // } else {
+ // console.log("No valid callback uri was found");
+ // }
+ // } else {
+
+ // }
+
+ const isAuthenticated = await auth0.isAuthenticated();
+ if(!isAuthenticated) {
+ $("#try-it-button").click(openPanel);
+ $(".side-panel-container").css('display','none');
+ $("#api-login-overlay").css('display','block');
+ } else {
+ token = await auth0.getTokenSilently();
+ const userProfile = await auth0.getUser();
+ let endpointData = extractEndpoint();
+ initializeExplorer(endpointData);
+ $("#try-it-button").click(openPanel);
+ $(".side-panel-container").css('display','block');
+ $("#api-login-overlay").css('display','none');
+ openPanel();
+ document.getElementById('api-btn-submit').addEventListener('click', submitApiRequest);
+ }
+}
+
+// Retrieve all parameters from page
+function extractEndpoint() {
+ let endpoint = {}
+ endpoint.operation = $('.api-doc-operation').text();
+ endpoint.path = $('.api-doc-code-block code').text();
+
+ endpoint.parameters = [];
+ endpoint.parameters = endpoint.parameters.concat(extractTableParameters('parameters'));
+ endpoint.parameters = endpoint.parameters.concat(extractTableParameters('request-body'));
+
+ return endpoint;
+}
+
+// Extract path, query, and body parameters from HTML for populating the API Explorer.
+function extractTableParameters(header) {
+ let parameters = [];
+ const headerElement = document.getElementById(header);
+ if(!headerElement) return parameters;
+ let rows = headerElement.parentElement.querySelectorAll('table > tbody > tr');
+ for(let rowFields of rows) {
+ let fields = rowFields.querySelectorAll('p.tableblock');
+ let parameter = {};
+ try {
+ parameter['name'] = fields[0].innerText;
+ parameter['type'] = fields[1].innerText;
+ if(fields.length === 3) {
+ parameter['in'] = 'body';
+ parameter['required'] = fields[2].innerText;
+ const type = parameter['type'].trim().toLowerCase();
+ if(type !== 'string' && type !== 'boolean' && type.indexOf('array') == -1 && type.indexOf('string') == -1 && type.indexOf('integer') == -1) {
+ // Resolve object definition
+ parameter['parameters'] = extractTableParameters(type);
+ parameter['type'] = 'object'; // set to common value
+ }
+ } else if(header === 'parameters' && fields.length === 4) {
+ parameter['in'] = fields[2].innerText;
+ parameter['required'] = fields[3].innerText;
+ } else {
+ console.error("Invalid number of parameter fields");
+ continue;
+ }
+
+ parameters.push(parameter);
+ } catch(e) {
+ console.error(e.stack());
+ return parameters;
+ }
+ }
+
+ return parameters;
+}
+
+function extractDefinition(header) {
+ let parameters = [];
+ const headerElement = document.getElementById(header);
+ if(!headerElement) return parameters;
+ let rows = headerElement.parentElement.querySelectorAll('')
+}
+
+// Populates the API Explorer display with endpoint info such as parameters.
+function initializeExplorer(endpoint) {
+ $('#api-explorer-form').attr('data-operation', endpoint.operation);
+ $('#api-explorer-form').attr('data-path', endpoint.path);
+ initializeExplorerParameters(endpoint);
+ displayIfActive('#explorer-parameters > .row','explorer-parameters');
+ displayIfActive('#explorer-headers > .row','explorer-headers');
+ displayIfActive('#explorer-body > .row','explorer-body');
+}
+
+function displayIfActive(searchCSS, toggleId) {
+ if($(searchCSS).children().length > 0 || $(searchCSS).text().length > 0) $('#'+toggleId).css('display','block');
+}
+
+function initializeExplorerParameters(endpoint) {
+ if(!endpoint.parameters) return;
+ let params = endpoint.parameters;
+ for(let i=0;i -1) {
+ console.error('Unresolved field in path ['+requestData.path+']');
+ requestData.valid = false;
+ } else {
+ //TODO: Put data-auth-type and data-baseurl on form element to differentiate between API services
+ const requestUrl = "https://cloudmanager.cloud.netapp.com" + requestData.path + (requestData.queryParams.length > 0 ? "?"+requestData.queryParams.join('&') : '');
+ requestData.url = requestUrl;
+ }
+
+ if(!requestData.body || Object.keys(requestData.body).length === 0) delete requestData.body;
+ else {
+ requestData.headers['Content-Type'] = 'application/json';
+ requestData.body = JSON.stringify(requestData.body); // Fetch expects stringified json body.
+ }
+
+ delete requestData.path;
+ delete requestData.queryParams;
+ return requestData;
+}
+
+function processInputFieldType(requestData, elementType) {
+ $('#api-explorer-form '+elementType).each(function() {
+ const name = $(this).attr('name');
+ const id = $(this).attr('id');
+ const inputValue = $(this).val().trim();
+ const required = $(this).attr('required');
+ const type = $(this).attr('data-type');
+ const isValid = parameterValid(id, name, inputValue, required, type);
+ if(requestData.valid) requestData.valid = isValid;
+ if (inputValue === '') return; // Skip if no value provided.
+ const location = $(this).attr('data-location').toLowerCase();
+ if(location === 'path') {
+ requestData.path = replacePath(requestData.path, name, inputValue);
+ } else if(location === 'query') {
+ let queryJson = {}
+ queryJson[name] = inputValue; //Compliance for pre-ES6
+ requestData.queryParams.push($.param(queryJson)); // Formats query param
+ } else if(location === 'header') {
+ requestData.headers[name] = inputValue;
+ } else if(location === 'body') {
+ requestData.body[name] = parseString(inputValue, type);
+ } else {
+ console.error('The parameter ['+name+'] of input ['+location+'] is not supported.');
+ return;
+ }
+ });
+}
+
+// Converts string to an object, boolean, or string.
+function parseString(text) {
+ const inputType = (typeof text);
+ if(text.toLowerCase() === 'true') return true;
+ else if(text.toLowerCase() === 'false') return false;
+ try {
+ return JSON.parse(text);
+ } catch(e) {
+ console.error("The JSON text was unable to be parsed. Likely a simple string.",e);
+ return text;
+ }
+}
+
+// Validate an input field
+function parameterValid(id, name, value, required, type) {
+ clearValidation(id);
+ if (typeof required === 'undefined') return true; // Skip optional fields.
+ else if (value === '') {
+ document.getElementById(id).classList.add('explorer-field-error');
+ document.getElementById('error-'+id).innerHTML = 'Missing required value';
+ return false; // Required field is empty.
+ }
+
+ // Basic check for object or array
+ // TODO: Check each object field to ensure it matches format.
+ if(type.indexOf('array') > -1 || type.indexOf('object') > -1) {
+ try {
+ JSON.parse(value);
+ } catch(e) {
+ document.getElementById(id).classList.add('explorer-field-error');
+ document.getElementById('error-'+id).innerHTML = 'Invalid format of '+(typeof value)+'. Expected '+type;
+ return false; // Object or array is invalid.
+ }
+ }
+
+ return true;
+}
+
+function clearValidation(id) {
+ document.getElementById(id).classList.remove('explorer-field-error');
+ document.getElementById('error-'+id).innerHTML = '';
+}
+
+// Custom replace function instead of regex
+function replacePath(url, query, replace) {
+ let segments = url.split("/");
+ for(let i=0;i 1) {
+ $('._Search_display_wrapper').show();
+ }
+ });
+
+ $(document).on('click', function(event) {
+ if(!$(event.target).closest('#react-search').length
+ && $('._Search_display_wrapper').is(":visible")) {
+ $('._Search_display_wrapper').hide();
+ }
+ });
+
+ $("body").on('DOMSubtreeModified', '.search__results', function() {
+ if (window.location.search === "") {
+ $('._Search_display_wrapper').hide();
+ } else {
+ $('._Search_display_wrapper').show();
+ if (document.querySelector('.sk-no-hits') !== null) {
+ $('._Search_display_wrapper .search__all').hide();
+ } else {
+ var element = document.getElementsByClassName("search__all")[0];
+ var searchHtml = element.getAttribute('data-search-html');
+ element.innerHTML = "See all results... ";
+ $('._Search_display_wrapper .search__all').show();
+ }
+ }
+ });
+});
diff --git a/js/prism-curl.js b/js/prism-curl.js
new file mode 100644
index 00000000..b87ab4f8
--- /dev/null
+++ b/js/prism-curl.js
@@ -0,0 +1,56 @@
+/* Custom Lexer for curl */
+Prism.languages.insertBefore("bash", "operator", {
+ "api-key": {
+ pattern: /(?:-u )([a-zA-Z0-9_]+)/g,
+ inside: {
+ "request-flag": /(^-u)/g
+ }
+ },
+ "request-param": {
+ pattern: /(?:-d )([a-zA-Z0-9]+)/g,
+ inside: {
+ "request-flag": /(^-d)/g
+ }
+ },
+ "request-value": {
+ pattern: /(?:=)(.*?)(?:\n|\\)/g,
+ inside: {
+ operator: /(^=)|(\\$)/g
+ }
+ }
+});
+
+Prism.languages.insertBefore("bash", "number", {
+ "request-url": {
+ pattern: /(?:^curl )(.*?)(?:\n|\\)/g,
+ inside: {
+ operator: /(\\$)/g,
+ keyword: /(^curl)/g
+ }
+ }
+});
+
+// Prism curl
+Prism.languages.curl = {
+ 'curl': /\bcurl\b/,
+ 'url': /https?:[a-zA-Z0-9:.?=\/\-\_{}\<\>]*/,
+ 'parameter': {
+ pattern: /[A-Za-z0-9\[\]\-\_]+ *(?=[=:])/
+ },
+ 'value': [{
+ pattern: /([=:])([A-Za-z0-9\-\_\.\/\<\>]*)/,
+ lookbehind: true,
+ }, {
+ pattern: /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ }, {
+ pattern: /(\-u )([A-Za-z0-9-_.{}]*)/,
+ lookbehind: true,
+ }],
+ 'option': / *-[a-zA-Z]*\b/,
+};
+
+// Prism HTTP
+Prism.languages.http = {
+ 'method': /(HEAD|POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)/,
+ 'url': /(?:http:|https:|\s\/)[a-zA-Z0-9:.\?=\/\-\_{}\<\>\&]*/
+};
diff --git a/js/prism.js b/js/prism.js
new file mode 100644
index 00000000..4f584158
--- /dev/null
+++ b/js/prism.js
@@ -0,0 +1,18 @@
+/* PrismJS 1.15.0
+https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+http+json+powershell+puppet+python+yaml&plugins=line-numbers+toolbar+show-language+copy-to-clipboard */
+var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-([\w-]+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(w instanceof s)){if(m&&b!=t.length-1){f.lastIndex=k;var _=f.exec(e);if(!_)break;for(var j=_.index+(d?_[1].length:0),P=_.index+_[0].length,A=b,O=k,x=t.length;x>A&&(P>O||!t[A].type&&!t[A-1].greedy);++A)O+=t[A].length,j>=O&&(++b,k=O);if(t[b]instanceof s)continue;I=A-b,w=e.slice(k,O),_.index-=k}else{f.lastIndex=0;var _=f.exec(w),I=1}if(_){d&&(p=_[1]?_[1].length:0);var j=_.index+p,_=_[0].slice(p),P=j+_.length,N=w.slice(0,j),S=w.slice(P),E=[b,I];N&&(++b,k+=N.length,E.push(N));var C=new s(u,h?n.tokenize(_,h):_,y,_,m);if(E.push(C),S&&E.push(S),Array.prototype.splice.apply(t,E),1!=I&&n.matchGrammar(e,t,a,b,k,!0,u),i)break}else if(i)break}}}}},tokenize:function(e,t){var a=[e],r=t.rest;if(r){for(var l in r)t[l]=r[l];delete t.rest}return n.matchGrammar(e,a,t,0,0,!1),a},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if(e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(o?" "+o:"")+">"+l.content+""+l.tag+">"},!_self.document)return _self.addEventListener?(n.disableWorkerMessageHandler||_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
+Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
+Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},Prism.languages.css.atrule.inside.rest=Prism.languages.css,Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(