Skip to content

Instantly share code, notes, and snippets.

@ahelland
Created March 29, 2017 09:39
Show Gist options
  • Save ahelland/44d540ae5846f145c93ead96b0fe37b0 to your computer and use it in GitHub Desktop.
Save ahelland/44d540ae5846f145c93ead96b0fe37b0 to your computer and use it in GitHub Desktop.
API Playground - loadGet Template
function loadGet() {
document.getElementById("csxEditor").innerHTML = "";
var strGetTemplate = [
'using System;',
'using System.Net.Http;',
'\npublic class HelloAPI',
'{',
'\tpublic static void Main()',
'\t{',
'\t\tusing (var client = new HttpClient())',
'\t\t{',
'\t\t\tstring requestUrl = $\"https://api01.contoso.local/api/HttpGET?name=Azure\";',
'\t\t\tHttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl);',
'\t\t\tHttpResponseMessage response = client.SendAsync(request).Result;',
'\t\t\tvar responseString = response.Content.ReadAsStringAsync().Result;',
'\t\t\tConsole.WriteLine(responseString);',
'\t\t}\n\t}\n}',
];
window.editor = monaco.editor.create(document.getElementById('csxEditor'), {
value: strGetTemplate.join('\n'),
language: 'csharp',
wrappingColumn: '0',
wrappingIndent: 'indent'
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment