powershell/resources/templates/method.ejs (66 lines of code) (raw):
<% if (method.language.default.description) {-%>
/// <summary>
/// <%=project.helper.wrapComments(' ', '/// ', method.language.default.description)%>
<%# ToDo: add externaldocsurl -%>
/// </summary>
<% };-%>
<%# ToDo: add remark if both description and summary is provided, question here is in m4, there is no summary provided-%>
<% if(method.parameters&&!method.language.default.pageable?.nextPageOperation) { method.parameters.filter(p => p.implementation != 'Client' && !project.helper.IsConstantParameter(p) && p.protocol.http?.in != 'complexHeader' && !(p.extensions && p.extensions['x-ms-parameter-grouping'])).forEach(function (parameter) {-%>
<%# ToDo: should use camel name instead of pascal name here -%>
/// <param name='<%-parameter.language.default.name%>'>
/// <%=project.helper.wrapComments(' ', '/// ', parameter.language.default.description)%>
/// </param>
<% });}-%>
<% if(!method.language.default.pageable?.nextPageOperation) {-%>
<% (method.requests[0].parameters || []).filter(p=>p.protocol.http.in == 'body' && !project.helper.IsConstantEnumParameter(p)).forEach(function(parameter){-%>
<%if(parameter.extensions && parameter.extensions['x-ms-client-flatten'] ) {-%>
<%project.helper.GetAllPublicVirtualProperties(parameter.schema.language.default.virtualProperties).filter(p => !project.helper.IsConstantEnumProperty(p) && !p.readOnly).forEach(function(vp) {-%>
/// <param name='<%-vp.property.language.default.name%>'>
/// <%=project.helper.wrapComments(' ', '/// ', vp.property.language.default.description)%>
/// </param>
<%});-%>
<%} else {-%>
/// <param name='<%-parameter.language.default.name%>'>
/// <%=project.helper.wrapComments(' ', '/// ', parameter.language.default.description)%>
/// </param>
<%}-%>
<% });-%>
<% } -%>
<% if(method.language.default.pageable?.nextPageOperation) {-%>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
<% } -%>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
<% if ((method.responses || []).filter(p => p.schema).length > 0) {-%>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
<% };-%>
<%# ToDo: add isnullable check -%>
<% if (method.parameters.filter(p => p.schema.type != 'constant' && p.required)) {-%>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
<% };-%>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
<%# ToDo: add GetObsoleteAttribute -%>
<%# ToDo: need to check in which case the method is not public(AccessModifier), currently set it to public -%>
public async System.Threading.Tasks.Task<<%-method.language.default.responseType%>> <%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodParameterDeclarationWithCustomHeader%>)
{
<%# ToDo: add support for method.Flavor, currently assume it is RestCall -%>
<%- include('methodBodyRestCall', {method: method, clientPrefix: clientPrefix}) -%>
}