public PayInvoicesServiceClient(PayInvoicesServiceClientSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (string.IsNullOrEmpty(settings.ServiceUrl)) { throw new ArgumentException("Service URL Required"); } _httpClient = new HttpClient { BaseAddress = new Uri(settings.ServiceUrl), DefaultRequestHeaders = { { "User-Agent", $"{PlatformServices.Default.Application.ApplicationName}/{PlatformServices.Default.Application.ApplicationVersion}" } } }; _invoiceApi = RestService.For <IInvoiceApi>(_httpClient); _fileApi = RestService.For <IFileApi>(_httpClient); _runner = new ApiRunner(); }
public LipController(IRabbitMQHelper bus, LipHub hub) { _bus = bus; _hub = hub; //TODO: colocar na injeção de dependência _file = RestService.For <IFileApi>("http://file/"); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='fileId'> /// </param> /// <param name='lang'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> GetFileUriAsync(this IFileApi operations, string fileId, string lang, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetFileUriWithHttpMessagesAsync(fileId, lang, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='file'> /// </param> /// <param name='lang'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> UploadFileFromOneDriveToStorageAsync(this IFileApi operations, LMSApplicationCoreCommandsOneDriveFileCommand file, string lang, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UploadFileFromOneDriveToStorageWithHttpMessagesAsync(file, lang, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
private Program(string robustPath, string[] engineArgs) { _engineArgs = engineArgs; var zipArchive = new ZipArchive(File.OpenRead(robustPath), ZipArchiveMode.Read); AssemblyLoadContext.Default.Resolving += LoadContextOnResolving; AssemblyLoadContext.Default.ResolvingUnmanagedDll += LoadContextOnResolvingUnmanaged; var prefix = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { prefix = "Space Station 14.app/Contents/Resources/"; } _fileApi = new ZipFileApi(zipArchive, prefix); }
public static async Task <HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Anonymous, methods: new string[] { "GET", "POST", "OPTIONS" })] HttpRequestMessage req, TraceWriter log, [Inject(typeof(IFileApi))] IFileApi fileApi) { var httpMethods = new Dictionary <string, Func <HttpRequestMessage, TraceWriter, Task <HttpResponseMessage> > > { { "GET", async(r, l) => await fileApi.Get(r, l) }, { "POST", async(r, l) => await fileApi.Post(r, l) } }; var response = httpMethods.ContainsKey(req.Method.Method) ? await httpMethods[req.Method.Method](req, log) : req.CreateResponse(req.Method.Method == "OPTIONS" ? HttpStatusCode.OK : HttpStatusCode.NotFound); AddCORSHeader(req, response, $"GET, POST, OPTIONS"); return(response); }
public LoaderApiLoader(IFileApi api, string prefix) { _api = api; _prefix = prefix; }
public MainArgs(string[] args, IFileApi fileApi) { Args = args; FileApi = fileApi; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='file'> /// </param> /// <param name='lang'> /// </param> public static object UploadFileFromOneDriveToStorage(this IFileApi operations, LMSApplicationCoreCommandsOneDriveFileCommand file, string lang) { return(operations.UploadFileFromOneDriveToStorageAsync(file, lang).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='fileId'> /// </param> /// <param name='lang'> /// </param> public static object GetFileUri(this IFileApi operations, string fileId, string lang) { return(operations.GetFileUriAsync(fileId, lang).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='filesIds'> /// </param> /// <param name='lang'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task RemoveFilesMaterialAsync(this IFileApi operations, LMSApplicationCoreCommandsRemoveFilesMaterialCommand filesIds, string lang, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.RemoveFilesMaterialWithHttpMessagesAsync(filesIds, lang, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='filesIds'> /// </param> /// <param name='lang'> /// </param> public static void RemoveFilesMaterial(this IFileApi operations, LMSApplicationCoreCommandsRemoveFilesMaterialCommand filesIds, string lang) { operations.RemoveFilesMaterialAsync(filesIds, lang).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='lang'> /// </param> public static object GetThemeTemplate(this IFileApi operations, string lang) { return(operations.GetThemeTemplateAsync(lang).GetAwaiter().GetResult()); }