public static async Task <TranslationOrchestrationContext> ReadDocumentAsync([ActivityTrigger] TranslationOrchestrationContext context, [Inject] IGitHubService service, ILogger log) { var result = await service.GetFileContents(context.Owner, context.Repo, context.TargetBranch, context.Path); context.TargetSha = result.Item1.sha; // Update sha with the target document. context.SourceText = result.Item2; return(context); }
public static async Task <TranslationOrchestrationContext> TranslateDocument([ActivityTrigger] TranslationOrchestrationContext context, [Inject] ITranslatorService service, ILogger log) { context.TranslatedText = await service.TranslateAsync(context.SourceText, context.Language); return(context); }
public static async Task UpdateDocumentAsync([ActivityTrigger] TranslationOrchestrationContext context, [Inject] IGitHubService service, ILogger log) { await service.UpdateFileContentsAsync(context.Owner, context.Repo, context.Path, context.TargetBranch, context.TranslatedText, context.TargetSha, context.Language); }