Skip to content

Commit

Permalink
update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Jun 12, 2024
1 parent e0a457e commit 8855d22
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
16 changes: 8 additions & 8 deletions samples/client/petstore/zapier/apis/PetApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
...Pet.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -84,7 +84,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -127,7 +127,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -170,7 +170,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -214,7 +214,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -254,7 +254,7 @@ module.exports = {
...Pet.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -307,7 +307,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -364,7 +364,7 @@ module.exports = {
},
body: formData,
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/zapier/apis/StoreApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -74,7 +74,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return { data: results };
Expand Down Expand Up @@ -118,7 +118,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -158,7 +158,7 @@ module.exports = {
...Order.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down
16 changes: 8 additions & 8 deletions samples/client/petstore/zapier/apis/UserApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
...User.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -76,7 +76,7 @@ module.exports = {
...User.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -119,7 +119,7 @@ module.exports = {
...User.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -162,7 +162,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -206,7 +206,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -257,7 +257,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return { data: results };
Expand Down Expand Up @@ -294,7 +294,7 @@ module.exports = {
body: {
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down Expand Up @@ -339,7 +339,7 @@ module.exports = {
...User.mapping(bundle),
},
}
return z.request(options).then((response) => {
return z.request(utils.requestOptionsMiddleware(z, bundle, options)).then((response) => {
response.throwForStatus();
const results = response.json;
return results;
Expand Down
10 changes: 9 additions & 1 deletion samples/client/petstore/zapier/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ const searchMiddleware = (action) => {
return action
}

const requestOptionsMiddleware = (z, bundle, requestOptions) => {
// TODO: modify the request options for all outgoing request to your api
// if you are using session authentication without a Bearer token.
// This may be true if your API uses basic authentication or api keys.
return requestOptions
}

module.exports = {
replacePathParameters: replacePathParameters,
childMapping: childMapping,
Expand All @@ -31,4 +38,5 @@ module.exports = {
hasSearchRequisites: hasSearchRequisites,
isSearchAction: isSearchAction,
searchMiddleware: searchMiddleware,
}
requestOptionsMiddleware: requestOptionsMiddleware,
}

0 comments on commit 8855d22

Please sign in to comment.