This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getConfig(request) { | |
const config = communityConnector.getConfig(); | |
config.newInfo() | |
.setId('instructions') | |
.setText('Enter Country Name to fetch university data.'); | |
config.newTextInput() | |
.setId('country') | |
.setName('Country') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"timeZone": "Europe/Athens", | |
"dependencies": {}, | |
"exceptionLogging": "STACKDRIVER", | |
"runtimeVersion": "V8", | |
"dataStudio": { | |
"name": "Looker Universities List Connector", | |
"company": "Apptiva", | |
"logoUrl": "https://media.licdn.com/dms/image/C4D0BAQFef_MA6VQpeQ/company-logo_100_100/0/1621108560492?e=1698278400&v=beta&t=vXBwKHavpEkU5GFY3Lb-IAS5FwBpI5f0ueTqwIwh8-E", | |
"addonUrl": "https://www.apptivasoftware.com", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getData(request) { | |
let dataSchema = []; | |
request.fields.forEach(function (field) { | |
for (const element of schema) { | |
if (element.name == field.name) { | |
dataSchema.push(element); | |
break; | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let schema = [ | |
{name: 'alpha_two_code', label: 'Alpha Two Code', dataType: 'STRING', semantics: {conceptType: 'DIMENSION'}}, | |
{name: 'country', label: 'Country', dataType: 'STRING', semantics: {conceptType: 'DIMENSION'}}, | |
{name: 'name', label: 'Name', dataType: 'STRING', semantics: {conceptType: 'DIMENSION'}}, | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use of the "new" keyword in order to be able to override non virtual methods | |
public async new Task<HttpResponseMessage> GetAsync(Uri requestUri) | |
{ | |
var res = await _httpClient.GetAsync(requestUri); | |
LogResponseMessage(requestUri, res, "GET"); | |
return res; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SerilogHttpClientWrapper(HttpClient httpClient, ILogger logger) | |
{ | |
_httpClient = httpClient; | |
_logger = logger; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Implements the log logic of the Wrapper | |
/// </summary> | |
/// <param name="requestUri">Uri of the REST call</param> | |
/// <param name="responseMessage">Response Message</param> | |
/// <param name="restAction">Rest Action Name (GET,PUT,POST,DELETE)</param> | |
/// <param name="sentHttpContent">Sent HttpContent</param> | |
protected virtual void LogResponseMessage(Uri requestUri, HttpResponseMessage responseMessage, string restAction, HttpContent sentHttpContent = null) | |
{ | |
using (LogContext.PushProperty("Request", sentHttpContent)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Serilog.Context; | |
namespace Serilog.RestCallMonitoring | |
{ | |
public class SerilogHttpClientWrapper : HttpClient | |
{ | |
private static string _templateString = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (LogContext.PushProperties(new UserLogEventEnricher(User))) | |
{ | |
Log.Logger.Information("Properties were added to the context using the enricher"); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserLogEventEnricher : ILogEventEnricher | |
{ | |
private readonly IUser _user; | |
public UserLogEventEnricher(IUser user) | |
{ | |
_user = user; | |
} | |
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) |