public MySampleApiCallMvc(IMySampleApiCall mySampleApiCall, CloudwatchLogsSink logs, CloudwatchMetricsSink metrics) : base(mySampleApiCall .WithAlteredLogsApi() .WithCloudwatchMetrics(metrics, nameof(MySampleApiCallMvc)) .WithCloudwatchLogs(logs, nameof(MySampleApiCallMvc))) // this function could populate the Entity property of your request // by reading the EntityId property and calling cdom // that code would be written once, and work with code/lambda/api/exe/etc // as long as its request shape implements IEntity //.WithCdomEntity() { }
public MySampleApiCallApi(IMySampleApiCall mySampleApiCall) : base(async(request) => { var response = new AlteredApiResponse(); var myDataIn = JObject.Parse(request.Body); var mySampleApiCallRequest = new MySampleApiCallRequest { RequestId = request.RequestId, //BearerToken = MyDataIn = myDataIn }; var mySampleApiCallResponse = await mySampleApiCall.Execute(mySampleApiCallRequest); response.StatusCode = mySampleApiCallResponse.StatusCode; response.Headers[HeaderNames.ContentType] = "application/json"; response.Body = AlteredJson.SerializeObject(mySampleApiCallResponse.MyDataOut); return(response); }) { }