Skip to content

Commit

Permalink
feat(dart): extract method gen from requests template for guides
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluf22 committed Jan 24, 2025
1 parent 5827f29 commit b024bab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
23 changes: 23 additions & 0 deletions templates/dart/tests/method.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
client.{{method}}(
{{#parametersWithDataType}}
{{> tests/request_param}}
{{/parametersWithDataType}}
{{#hasRequestOptions}}
requestOptions : RequestOptions(
{{#requestOptions.headers}}
headers: {
{{#parametersWithDataType}}
'{{{key}}}' : '{{value}}',
{{/parametersWithDataType}}
},
{{/requestOptions.headers}}
{{#requestOptions.queryParameters}}
urlParameters: {
{{#parametersWithDataType}}
'{{{key}}}' : {{> tests/param_value}},
{{/parametersWithDataType}}
},
{{/requestOptions.queryParameters}}
)
{{/hasRequestOptions}}
)
24 changes: 1 addition & 23 deletions templates/dart/tests/requests/requests.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,7 @@ void main() {
{{/hasRegionalHost}}
options: ClientOptions(requester: requester),
),
call: (client) => client.{{method}}(
{{#parametersWithDataType}}
{{> tests/request_param}}
{{/parametersWithDataType}}
{{#hasRequestOptions}}
requestOptions : RequestOptions(
{{#requestOptions.headers}}
headers: {
{{#parametersWithDataType}}
'{{{key}}}' : '{{value}}',
{{/parametersWithDataType}}
},
{{/requestOptions.headers}}
{{#requestOptions.queryParameters}}
urlParameters: {
{{#parametersWithDataType}}
'{{{key}}}' : {{> tests/param_value}},
{{/parametersWithDataType}}
},
{{/requestOptions.queryParameters}}
),
{{/hasRequestOptions}}
),
call: (client) => {{> method}},
intercept: (request) {
{{#request}}
expectPath(request.path, '{{{path}}}');
Expand Down

0 comments on commit b024bab

Please sign in to comment.