public global::StrawberryShake.IOperationResult <IGetHeroResult> Build(global::StrawberryShake.Response <global::System.Text.Json.JsonDocument> response) { (IGetHeroResult Result, GetHeroResultInfo Info)? data = null; global::System.Collections.Generic.IReadOnlyList <global::StrawberryShake.IClientError>?errors = null; try { if (response.Body != null) { if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) { data = BuildData(dataElement); } if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement)) { errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement); } } } catch (global::System.Exception ex) { errors = new global::StrawberryShake.IClientError[] { new global::StrawberryShake.ClientError(ex.Message, exception: ex) }; } return(new global::StrawberryShake.OperationResult <IGetHeroResult>(data?.Result, data?.Info, _resultDataFactory, errors)); }
public global::StrawberryShake.IOperationResult <IFindPlayersResult> Build(global::StrawberryShake.Response <global::System.Text.Json.JsonDocument> response) { (IFindPlayersResult Result, FindPlayersResultInfo Info)? data = null; global::System.Collections.Generic.IReadOnlyList <global::StrawberryShake.IClientError>?errors = null; if (response.Exception is null) { try { if (response.Body != null) { if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) { data = BuildData(dataElement); } if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement)) { errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement); } } } catch (global::System.Exception ex) { errors = new global::StrawberryShake.IClientError[] { new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary <global::System.String, global::System.Object?> { { "body", response.Body?.RootElement.ToString() } }) }; } } else { errors = new global::StrawberryShake.IClientError[] { new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary <global::System.String, global::System.Object?> { { "body", response.Body?.RootElement.ToString() } }) }; } return(new global::StrawberryShake.OperationResult <IFindPlayersResult>(data?.Result, data?.Info, _resultDataFactory, errors)); }