private static void writeSnippet(SnippetCodeGraph codeGraph, StringBuilder builder) { writeHeadersAndOptions(codeGraph, builder); WriteBody(codeGraph, builder); builder.AppendLine(""); WriteExecutionStatement( codeGraph, builder, codeGraph.HasHeaders() || codeGraph.HasOptions() || codeGraph.HasParameters(), codeGraph.HasBody() ? requestBodyVarName : default,
private static void WriteRequestExecutionPath(SnippetCodeGraph codeGraph, StringBuilder payloadSb, IndentManager indentManager) { var method = codeGraph.HttpMethod.Method.ToLower(); var configParameter = codeGraph.HasHeaders() || codeGraph.HasParameters() ? $"{RequestConfigurationVarName}" : string.Empty; var bodyParameter = codeGraph.HasBody() ? $"{RequestBodyVarName}" : string.Empty; var optionsParameter = codeGraph.HasOptions() ? "options" : string.Empty; var returnVar = codeGraph.HasReturnedBody() ? "$requestResult = " : string.Empty; var parameterList = GetActionParametersList(bodyParameter, configParameter, optionsParameter); payloadSb.AppendLine(GetRequestConfiguration(codeGraph, indentManager)); payloadSb.AppendLine($"{returnVar}{ClientVarName}->{GetFluentApiPath(codeGraph.Nodes)}->{method}({parameterList});"); }