diff --git a/src/Webserver.API/Services/RequestHandling/ApiHttpClientRequestHandler.cs b/src/Webserver.API/Services/RequestHandling/ApiHttpClientRequestHandler.cs index 5587372..7aec347 100644 --- a/src/Webserver.API/Services/RequestHandling/ApiHttpClientRequestHandler.cs +++ b/src/Webserver.API/Services/RequestHandling/ApiHttpClientRequestHandler.cs @@ -158,7 +158,7 @@ public ApiHttpClientRequestHandler(HttpClient httpClient, IApiRequestFactory api /// /// further information about the Api requeest the user tried to send (or was trying to send) /// string: response from thePLC - public async Task> SendPostRequestAsyncFileName(string apiRequestString) + public async Task> SendPostRequestAsyncFileName(string apiRequestString, CancellationToken cancellationToken = default(CancellationToken)) { List result = new List(); byte[] byteArr = Encoding.GetBytes(apiRequestString); @@ -208,7 +208,7 @@ public async Task> SendPostRequestAsyncFileName(string apiRequestSt /// /// Cancellation token to cancel pending requests. /// BrowseTickets Response containing: Max_Tickets:uint, Tickets:Array of Ticket - public async Task ApiBrowseTicketsAsync(CancellationToken cancellationToken) => await ApiBrowseTicketsAsync((string) null, cancellationToken); + public async Task ApiBrowseTicketsAsync(CancellationToken cancellationToken) => await ApiBrowseTicketsAsync((string)null, cancellationToken); /// /// Send an Api.BrowseTickets Request using the Request from the ApiRequestFactory @@ -289,10 +289,10 @@ public async Task> SendPostRequestAsyncFileName(string apiRequestSt /// The current password for the user /// The new password for the user /// True if changing password for the user was successful - public async Task ApiChangePasswordAsync(string username, string currentPassword, string newPassword) + public async Task ApiChangePasswordAsync(string username, string currentPassword, string newPassword, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiChangePasswordRequest(username, currentPassword, newPassword); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -309,10 +309,10 @@ public ApiTrueOnSuccessResponse ApiChangePassword(string username, string curren /// Send an Api.GetCertificateUrl Request using the Request from the ApiRequestFactory /// /// ApiSingleStringResponse that contians the URL to the certificate - public async Task ApiGetCertificateUrlAsync() + public async Task ApiGetCertificateUrlAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiGetCertificateUrlRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); if (!response.Contains("/MiniWebCA_Cer.crt")) Console.WriteLine("unexpected response: " + response + " for Api.GetCertificateUrl!"); return JsonConvert.DeserializeObject(response); @@ -338,10 +338,10 @@ public async Task ApiGetCertificateUrlAsync() /// Send an Api.GetQuantityStructures Request using the Request from the ApiRequestFactory /// /// Api Quantity Structure object - public async Task ApiGetQuantityStructuresAsync() + public async Task ApiGetQuantityStructuresAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiGetQuantityStructuresRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); return JsonConvert.DeserializeObject(response); } @@ -380,10 +380,10 @@ public async Task ApiGetQuantityStructuresAsyn /// Send an Api.Ping Request using the Request from the ApiRequestFactory /// /// ApiSingleStringResponse - an Id that'll stay the same for the users session - public async Task ApiPingAsync() + public async Task ApiPingAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPingRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -397,10 +397,10 @@ public async Task ApiPingAsync() /// Send an Api.Version Request using the Request from the ApiRequestFactory /// /// a double that contains the value for the current ApiVersion - public async Task ApiVersionAsync() + public async Task ApiVersionAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiVersionRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -415,10 +415,10 @@ public async Task ApiVersionAsync() /// /// The HWID of a node (module) for which a service data file can be downloaded /// Ticket to use for downloading the service data - public async Task ModulesDownloadServiceDataAsync(ApiPlcHwId hwid) + public async Task ModulesDownloadServiceDataAsync(ApiPlcHwId hwid, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetModulesDownloadServiceData(hwid); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -434,10 +434,10 @@ public ApiTicketIdResponse ModulesDownloadServiceData(ApiPlcHwId hwid) => /// Send a Plc.ReadOperatingMode Request using the Request from the ApiRequestFactory /// /// The current Plc OperatingMode - public async Task PlcReadOperatingModeAsync() + public async Task PlcReadOperatingModeAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcReadOperatingModeRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -453,10 +453,10 @@ public async Task PlcReadOperatingModeAsync() /// valid plcOperatingModes are: "run", "stop" - others will lead to an invalid params exception. /// /// valid plcOperatingModes are: "run", "stop" - others will lead to an invalid params exception. - public async Task PlcRequestChangeOperatingModeAsync(ApiPlcOperatingMode plcOperatingMode) + public async Task PlcRequestChangeOperatingModeAsync(ApiPlcOperatingMode plcOperatingMode, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcRequestChangeOperatingModeRequest(plcOperatingMode); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -486,10 +486,10 @@ public ApiTrueOnSuccessResponse PlcRequestChangeOperatingMode(ApiPlcOperatingMod /// sucht die Variable und liefert eine Liste an Kind-Variablen und Metadaten. /// /// PlcProgramBrowseResponse: An Array of ApiPlcProgramData - public async Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, string var = null) + public async Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, string var = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcProgramBrowseRequest(plcProgramBrowseMode, var); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -529,10 +529,10 @@ public async Task PlcProgramBrowseAsync(ApiPlcProgr /// sucht die Variable und liefert eine Liste an Kind-Variablen und Metadaten. /// /// PlcProgramBrowseResponse: An Array of ApiPlcProgramData - public async Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, ApiPlcProgramData var) + public async Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, ApiPlcProgramData var, CancellationToken cancellationToken = default(CancellationToken)) { string varName = var.GetVarNameForMethods(); - return await PlcProgramBrowseAsync(plcProgramBrowseMode, varName); + return await PlcProgramBrowseAsync(plcProgramBrowseMode, varName, cancellationToken); } /// /// Send a PlcProgram.Browse Request using the Request from the ApiRequestFactory @@ -608,10 +608,10 @@ public async Task PlcProgramBrowseAsync(ApiPlcProgr /// • "raw": liefert Variablenwerte gemäß der Darstellung "raw" /// in Kapitel "Unterstützte Datentypen" /// ApiPlcProgramReadResponse: object with the value for the variables value to be read - public async Task> PlcProgramReadAsync(string var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null) + public async Task> PlcProgramReadAsync(string var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcProgramReadRequest(var, plcProgramReadMode); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject>(response); return responseObj; } @@ -653,11 +653,11 @@ public async Task> PlcProgramReadAsync(string var, ApiPl /// in Kapitel "Unterstützte Datentypen" /// ApiPlcProgramReadResponse: object with the value for the variables value to be read /// will be thrown if a ApiPlcProgramDatathat is an array will be given without an index - public async Task> PlcProgramReadAsync(ApiPlcProgramData var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null) + public async Task> PlcProgramReadAsync(ApiPlcProgramData var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null, CancellationToken cancellationToken = default(CancellationToken)) { //RequestParameterChecker.CheckPlcProgramReadOrWriteDataType(var.Datatype, true); string varName = var.GetVarNameForMethods(); - return await PlcProgramReadAsync(varName, plcProgramReadMode); + return await PlcProgramReadAsync(varName, plcProgramReadMode, cancellationToken); } /// /// Send a PlcProgram.Browse Request using the Request from the ApiRequestFactory @@ -691,12 +691,12 @@ public async Task> PlcProgramReadAsync(ApiPlcProgramData /// /// true to indicate success /// will be thrown if a ApiPlcProgramDatathat is an array will be given without an index - public async Task PlcProgramWriteAsync(ApiPlcProgramData var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null) + public async Task PlcProgramWriteAsync(ApiPlcProgramData var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null, CancellationToken cancellationToken = default(CancellationToken)) { string varName = var.GetVarNameForMethods(); // ApiRequestFactory.CheckPlcProgramReadOrWriteDataType(var.Datatype); will also be called by GetApiPlcProgramWriteValueToBeSet! var writeVal = _apiRequestFactory.GetApiPlcProgramWriteValueToBeSet(var.Datatype, valueToBeSet); - return await PlcProgramWriteAsync(varName, writeVal, plcProgramWriteMode); + return await PlcProgramWriteAsync(varName, writeVal, plcProgramWriteMode, cancellationToken); } /// /// Send a PlcProgram.Write Request using the Request from the ApiRequestFactory @@ -722,10 +722,10 @@ public ApiTrueOnSuccessResponse PlcProgramWrite(ApiPlcProgramData var, object va /// /// true to indicate success /// will be thrown if a ApiPlcProgramDatathat is an array will be given without an index - public async Task PlcProgramWriteAsync(string var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null) + public async Task PlcProgramWriteAsync(string var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcProgramWriteRequest(var, valueToBeSet, plcProgramWriteMode); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -748,9 +748,9 @@ public ApiTrueOnSuccessResponse PlcProgramWrite(string var, object valueToBeSet, /// webappdata that should be requested /// ApiWebAppBrowseResponse: Containing WebAppBrowseResult: Max_Applications:uint, /// Applications: Array of ApiWebAppdata containing one element: the webappdata that has been requested - public async Task WebAppBrowseAsync(ApiWebAppData webAppData) + public async Task WebAppBrowseAsync(ApiWebAppData webAppData, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppBrowseAsync(webAppData.Name); + return await WebAppBrowseAsync(webAppData.Name, cancellationToken); } /// /// Send a WebApp.Browse Request using the Request from the ApiRequestFactory @@ -766,10 +766,10 @@ public async Task WebAppBrowseAsync(ApiWebAppData webAp /// webapp name in case only one is requested /// ApiWebAppBrowseResponse: Containing WebAppBrowseResult: Max_Applications:uint, /// Applications: Array of ApiWebAppdata containing one element: the webappdata that has been requested - public async Task WebAppBrowseAsync(string webAppName = null) + public async Task WebAppBrowseAsync(string webAppName = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppBrowseRequest(webAppName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -791,10 +791,10 @@ public async Task WebAppBrowseAsync(string webAppName = /// If given only that resource will be inside the array (in case it exists) /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint, /// Resources:Array of ApiWebAppResource (only 1 if one is requested) - public async Task WebAppBrowseResourcesAsync(string webAppName, string resourceName = null) + public async Task WebAppBrowseResourcesAsync(string webAppName, string resourceName = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppBrowseResourcesRequest(webAppName, resourceName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -820,9 +820,9 @@ public async Task WebAppBrowseResourcesAsync(s /// If given only that resource will be inside the array (in case it exists) /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint, /// Resources:Array of ApiWebAppResource (only 1 if one is requested) - public async Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, string resourceName = null) + public async Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, string resourceName = null, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppBrowseResourcesAsync(webApp.Name, resourceName); + return await WebAppBrowseResourcesAsync(webApp.Name, resourceName, cancellationToken); } /// /// Send a WebApp.BrowseResources Request using the Request from the ApiRequestFactory @@ -845,9 +845,9 @@ public async Task WebAppBrowseResourcesAsync(A /// resource.Name to browse for /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint, /// Resources:Array of ApiWebAppResource (only 1 if one is requested) - public async Task WebAppBrowseResourcesAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppBrowseResourcesAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppBrowseResourcesAsync(webAppName, resource.Name); + return await WebAppBrowseResourcesAsync(webAppName, resource.Name, cancellationToken); } /// /// Send a WebApp.BrowseResources Request using the Request from the ApiRequestFactory @@ -871,9 +871,9 @@ public async Task WebAppBrowseResourcesAsync(s /// resource.Name to browse for /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint, /// Resources:Array of ApiWebAppResource (only 1 if one is requested) - public async Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppBrowseResourcesAsync(webApp.Name, resource.Name); + return await WebAppBrowseResourcesAsync(webApp.Name, resource.Name, cancellationToken); } /// /// Send a WebApp.BrowseResources Request using the Request from the ApiRequestFactory @@ -893,10 +893,10 @@ public async Task WebAppBrowseResourcesAsync(A /// webapp name for the app to be created /// optional parameter: state the webapp should be in /// true to indicate success - public async Task WebAppCreateAsync(string webAppName, ApiWebAppState? apiWebAppState = null) + public async Task WebAppCreateAsync(string webAppName, ApiWebAppState? apiWebAppState = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppCreateRequest(webAppName, apiWebAppState); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -913,10 +913,10 @@ public async Task WebAppCreateAsync(string webAppName, /// /// containing information about name and state for the app to be created /// true to indicate success - public async Task WebAppCreateAsync(ApiWebAppData webApp) + public async Task WebAppCreateAsync(ApiWebAppData webApp, CancellationToken cancellationToken = default(CancellationToken)) { // ApiRequestFactory.CheckState(webApp.State); will be called in WebAppCreate in Factory.GetApiWebAppCreateRequest - return await WebAppCreateAsync(webApp.Name, webApp.State); + return await WebAppCreateAsync(webApp.Name, webApp.State, cancellationToken); } /// /// Send a WebApp.Create Request using the Request from the ApiRequestFactory @@ -936,11 +936,11 @@ public async Task WebAppCreateAsync(ApiWebAppData webA /// you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on public async Task WebAppCreateResourceAsync(string webAppName, string resourceName, string media_type, - string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null) + string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppCreateResourceRequest(webAppName, resourceName, media_type, last_modified, apiWebAppResourceVisibility, etag); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -968,9 +968,9 @@ public ApiTicketIdResponse WebAppCreateResource(string webAppName, string resour /// you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on public async Task WebAppCreateResourceAsync(ApiWebAppData webApp, string resourceName, string media_type, - string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null) + string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppCreateResourceAsync(webApp.Name, resourceName, media_type, last_modified, apiWebAppResourceVisibility, etag); + return await WebAppCreateResourceAsync(webApp.Name, resourceName, media_type, last_modified, apiWebAppResourceVisibility, etag, cancellationToken); } /// /// Send a WebApp.CreateResource Request using the Request from the ApiRequestFactory @@ -995,10 +995,10 @@ public ApiTicketIdResponse WebAppCreateResource(ApiWebAppData webApp, string res /// Visibility: resource visibility (protect your confidential data) /// Etag: you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on - public async Task WebAppCreateResourceAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppCreateResourceAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { return await WebAppCreateResourceAsync(webAppName, resource.Name, resource.Media_type, - resource.Last_modified.ToString(DateTimeFormatting.ApiDateTimeFormat), resource.Visibility, resource.Etag); + resource.Last_modified.ToString(DateTimeFormatting.ApiDateTimeFormat), resource.Visibility, resource.Etag, cancellationToken); } /// /// Send a WebApp.CreateResource Request using the Request from the ApiRequestFactory @@ -1024,10 +1024,10 @@ public async Task WebAppCreateResourceAsync(string webAppNa /// Visibility: resource visibility (protect your confidential data) /// Etag: you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on - public async Task WebAppCreateResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppCreateResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { return await WebAppCreateResourceAsync(webApp.Name, resource.Name, resource.Media_type, - resource.Last_modified.ToString(DateTimeFormatting.ApiDateTimeFormat), resource.Visibility, resource.Etag); + resource.Last_modified.ToString(DateTimeFormatting.ApiDateTimeFormat), resource.Visibility, resource.Etag, cancellationToken); } /// /// Send a WebApp.CreateResource Request using the Request from the ApiRequestFactory @@ -1047,10 +1047,10 @@ public async Task WebAppCreateResourceAsync(ApiWebAppData w /// /// Name of the webapp to delete /// true to indicate success - public async Task WebAppDeleteAsync(string webAppName) + public async Task WebAppDeleteAsync(string webAppName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppDeleteRequest(webAppName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -1066,9 +1066,9 @@ public async Task WebAppDeleteAsync(string webAppName) /// /// webApp.Name of the webapp to delete /// true to indicate success - public async Task WebAppDeleteAsync(ApiWebAppData webApp) + public async Task WebAppDeleteAsync(ApiWebAppData webApp, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDeleteAsync(webApp.Name); + return await WebAppDeleteAsync(webApp.Name, cancellationToken); } /// /// Send a WebApp.Delete Request using the Request from the ApiRequestFactory @@ -1083,10 +1083,10 @@ public async Task WebAppDeleteAsync(ApiWebAppData webA /// Name of the webapp that contains the resource /// Name of the resource to delete /// true to indicate success - public async Task WebAppDeleteResourceAsync(string webAppName, string resourceName) + public async Task WebAppDeleteResourceAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppDeleteResourceRequest(webAppName, resourceName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -1104,9 +1104,9 @@ public async Task WebAppDeleteResourceAsync(string web /// webapp.Name of the webapp that contains the resource /// Name of the resource to delete /// true to indicate success - public async Task WebAppDeleteResourceAsync(ApiWebAppData webApp, string resourceName) + public async Task WebAppDeleteResourceAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDeleteResourceAsync(webApp.Name, resourceName); + return await WebAppDeleteResourceAsync(webApp.Name, resourceName, cancellationToken); } /// /// Send a WebApp.DeleteRespource Request using the Request from the ApiRequestFactory @@ -1129,9 +1129,9 @@ public async Task WebAppDeleteResourceAsync(ApiWebAppD /// webApp.Name of the webapp that contains the resource /// resource.Name of the resource to delete /// true to indicate success - public async Task WebAppDeleteResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppDeleteResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDeleteResourceAsync(webApp.Name, resource.Name); + return await WebAppDeleteResourceAsync(webApp.Name, resource.Name, cancellationToken); } /// /// Send a WebApp.DeleteRespource Request using the Request from the ApiRequestFactory @@ -1147,9 +1147,9 @@ public async Task WebAppDeleteResourceAsync(ApiWebAppD /// Name of the webapp that contains the resource /// resource.Name of the resource to delete /// true to indicate success - public async Task WebAppDeleteResourceAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppDeleteResourceAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDeleteResourceAsync(webAppName, resource.Name); + return await WebAppDeleteResourceAsync(webAppName, resource.Name, cancellationToken); } /// @@ -1158,10 +1158,10 @@ public async Task WebAppDeleteResourceAsync(string web /// Name of the webapp that contains the resource /// Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - public async Task WebAppDownloadResourceAsync(string webAppName, string resourceName) + public async Task WebAppDownloadResourceAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppDownloadResourceRequest(webAppName, resourceName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -1179,9 +1179,9 @@ public async Task WebAppDownloadResourceAsync(string webApp /// webApp.Name of the webapp that contains the resource /// Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - public async Task WebAppDownloadResourceAsync(ApiWebAppData webApp, string resourceName) + public async Task WebAppDownloadResourceAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDownloadResourceAsync(webApp.Name, resourceName); + return await WebAppDownloadResourceAsync(webApp.Name, resourceName, cancellationToken); } /// /// Send a WebApp.DownloadResource Request using the Request from the ApiRequestFactory @@ -1197,9 +1197,9 @@ public async Task WebAppDownloadResourceAsync(ApiWebAppData /// webApp.Name of the webapp that contains the resource /// resource.Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - public async Task WebAppDownloadResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppDownloadResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDownloadResourceAsync(webApp.Name, resource.Name); + return await WebAppDownloadResourceAsync(webApp.Name, resource.Name, cancellationToken); } /// /// Send a WebApp.DownloadResource Request using the Request from the ApiRequestFactory @@ -1215,9 +1215,9 @@ public async Task WebAppDownloadResourceAsync(ApiWebAppData /// Name of the webapp that contains the resource /// resource.Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - public async Task WebAppDownloadResourceAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppDownloadResourceAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppDownloadResourceAsync(webAppName, resource.Name); + return await WebAppDownloadResourceAsync(webAppName, resource.Name, cancellationToken); } /// /// Send a WebApp.DownloadResource Request using the Request from the ApiRequestFactory @@ -1234,10 +1234,10 @@ public async Task WebAppDownloadResourceAsync(string webApp /// New name for the WebApp /// This function will return the TrueOnSuccessResponse and a WebApp that only has the information: /// name which equals the newname - public async Task WebAppRenameAsync(string webAppName, string newWebAppName) + public async Task WebAppRenameAsync(string webAppName, string newWebAppName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppRenameRequest(webAppName, newWebAppName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithWebAppResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1262,9 +1262,9 @@ public async Task WebAppRenameAsync(string webAppName /// New name for the WebApp /// This function will return the TrueOnSuccessResponse and a copy of the given WebApp that has the change: /// name which equals the newname - public async Task WebAppRenameAsync(ApiWebAppData webApp, string newWebAppName) + public async Task WebAppRenameAsync(ApiWebAppData webApp, string newWebAppName, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppRenameAsync(webApp.Name, newWebAppName); + var resp = await WebAppRenameAsync(webApp.Name, newWebAppName, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Name = newWebAppName; return resp; @@ -1287,10 +1287,10 @@ public async Task WebAppRenameAsync(ApiWebAppData web /// This function will return the TrueOnSuccessResponse and a Resource that only has the information: /// name which equals the newname public async Task WebAppRenameResourceAsync(string webAppName, string resourceName, - string newResourceName) + string newResourceName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppRenameResourceRequest(webAppName, resourceName, newResourceName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); ApiTrueWithResourceResponse responseObj = new ApiTrueWithResourceResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1319,9 +1319,9 @@ public ApiTrueWithResourceResponse WebAppRenameResource(string webAppName, strin /// This function will return the TrueOnSuccessResponse and a Resource that only has the information: /// name which equals the newname public async Task WebAppRenameResourceAsync(ApiWebAppData webApp, string resourceName, - string newResourceName) + string newResourceName, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppRenameResourceAsync(webApp.Name, resourceName, newResourceName); + return await WebAppRenameResourceAsync(webApp.Name, resourceName, newResourceName, cancellationToken); } /// /// Send a WebApp.RenameResource Request using the Request from the ApiRequestFactory @@ -1343,9 +1343,9 @@ public ApiTrueWithResourceResponse WebAppRenameResource(ApiWebAppData webApp, st /// This function will return the TrueOnSuccessResponse and a copy of the Resource given that has the following change: /// name which equals the newname public async Task WebAppRenameResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, - string newResourceName) + string newResourceName, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppRenameResourceAsync(webApp.Name, resource.Name, newResourceName); + var basicResp = await WebAppRenameResourceAsync(webApp.Name, resource.Name, newResourceName, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Name = newResourceName; return basicResp; @@ -1370,9 +1370,9 @@ public ApiTrueWithResourceResponse WebAppRenameResource(ApiWebAppData webApp, Ap /// This function will return the TrueOnSuccessResponse and a copy of the Resource given that has the following change: /// name which equals the newname public async Task WebAppRenameResourceAsync(string webAppName, ApiWebAppResource resource, - string newResourceName) + string newResourceName, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppRenameResourceAsync(webAppName, resource.Name, newResourceName); + var basicResp = await WebAppRenameResourceAsync(webAppName, resource.Name, newResourceName, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Name = newResourceName; return basicResp; @@ -1397,10 +1397,10 @@ public ApiTrueWithResourceResponse WebAppRenameResource(string webAppName, ApiWe /// Name: which equals the webAppName /// Default_Page: which equals the resourceName /// - public async Task WebAppSetDefaultPageAsync(string webAppName, string resourceName) + public async Task WebAppSetDefaultPageAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppSetDefaultPageRequest(webAppName, resourceName ?? ""); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithWebAppResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1428,9 +1428,9 @@ public async Task WebAppSetDefaultPageAsync(string we /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Default_Page: which equals the resourceName /// - public async Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, string resourceName) + public async Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetDefaultPageAsync(webApp.Name, resourceName); + var resp = await WebAppSetDefaultPageAsync(webApp.Name, resourceName, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Default_page = (resourceName == "" ? null : resourceName); return resp; @@ -1453,9 +1453,9 @@ public async Task WebAppSetDefaultPageAsync(ApiWebApp /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Default_Page: which equals the resource.Name /// - public async Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetDefaultPageAsync(webApp.Name, resource.Name); + var resp = await WebAppSetDefaultPageAsync(webApp.Name, resource.Name, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Default_page = (resource.Name == "" ? null : resource.Name); return resp; @@ -1479,9 +1479,9 @@ public async Task WebAppSetDefaultPageAsync(ApiWebApp /// Name: which equals the webAppName /// Default_Page: which equals the resourceName /// - public async Task WebAppSetDefaultPageAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppSetDefaultPageAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetDefaultPageAsync(webAppName, resource.Name); + return await WebAppSetDefaultPageAsync(webAppName, resource.Name, cancellationToken); } /// /// Send a WebApp.SetDefaultPage Request using the Request from the ApiRequestFactory @@ -1503,10 +1503,10 @@ public async Task WebAppSetDefaultPageAsync(string we /// Name: which equals webAppName /// Not_authorized_page: which equals the resourceName /// - public async Task WebAppSetNotAuthorizedPageAsync(string webAppName, string resourceName) + public async Task WebAppSetNotAuthorizedPageAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppSetNotAuthorizedPageRequest(webAppName, resourceName ?? ""); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithWebAppResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1533,9 +1533,9 @@ public async Task WebAppSetNotAuthorizedPageAsync(str /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_authorized_page: which equals the resourceName /// - public async Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, string resourceName) + public async Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetNotAuthorizedPageAsync(webApp.Name, resourceName); + var resp = await WebAppSetNotAuthorizedPageAsync(webApp.Name, resourceName, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Not_authorized_page = (resourceName == "" ? null : resourceName); return resp; @@ -1557,9 +1557,9 @@ public async Task WebAppSetNotAuthorizedPageAsync(Api /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_authorized_page: which equals the resourceName /// - public async Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetNotAuthorizedPageAsync(webApp.Name, resource.Name); + var resp = await WebAppSetNotAuthorizedPageAsync(webApp.Name, resource.Name, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Not_authorized_page = (resource.Name == "" ? null : resource.Name); return resp; @@ -1583,9 +1583,9 @@ public async Task WebAppSetNotAuthorizedPageAsync(Api /// Name: which equals webAppName /// Not_authorized_page: which equals the resource.Name /// - public async Task WebAppSetNotAuthorizedPageAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppSetNotAuthorizedPageAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetNotAuthorizedPageAsync(webAppName, resource.Name); + return await WebAppSetNotAuthorizedPageAsync(webAppName, resource.Name, cancellationToken); } /// /// Send a WebApp.SetNotAuthorizedPage Request using the Request from the ApiRequestFactory @@ -1607,10 +1607,10 @@ public async Task WebAppSetNotAuthorizedPageAsync(str /// Name: which equals the webAppName /// Not_found_page: which equals the resourceName /// - public async Task WebAppSetNotFoundPageAsync(string webAppName, string resourceName) + public async Task WebAppSetNotFoundPageAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppSetNotFoundPageRequest(webAppName, resourceName ?? ""); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithWebAppResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1638,9 +1638,9 @@ public async Task WebAppSetNotFoundPageAsync(string w /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_found_page: which equals the resourceName /// - public async Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, string resourceName) + public async Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetNotFoundPageAsync(webApp.Name, resourceName); + var resp = await WebAppSetNotFoundPageAsync(webApp.Name, resourceName, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Not_found_page = (resourceName == "" ? null : resourceName); return resp; @@ -1663,9 +1663,9 @@ public async Task WebAppSetNotFoundPageAsync(ApiWebAp /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_found_page: which equals the resource.Name /// - public async Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, ApiWebAppResource resource) + public async Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetNotFoundPageAsync(webApp.Name, resource.Name); + var resp = await WebAppSetNotFoundPageAsync(webApp.Name, resource.Name, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.Not_found_page = (resource.Name == "" ? null : resource.Name); return resp; @@ -1689,9 +1689,9 @@ public async Task WebAppSetNotFoundPageAsync(ApiWebAp /// Name: which equals the webAppName /// Not_found_page: which equals the resource.Name /// - public async Task WebAppSetNotFoundPageAsync(string webAppName, ApiWebAppResource resource) + public async Task WebAppSetNotFoundPageAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetNotFoundPageAsync(webAppName, resource.Name); + return await WebAppSetNotFoundPageAsync(webAppName, resource.Name, cancellationToken); } /// /// Send a WebApp.SetNotFoundPage Request using the Request from the ApiRequestFactory @@ -1713,10 +1713,10 @@ public async Task WebAppSetNotFoundPageAsync(string w /// Name: which equals the webAppName /// State: which equals the state /// - public async Task WebAppSetStateAsync(string webAppName, ApiWebAppState apiWebAppState) + public async Task WebAppSetStateAsync(string webAppName, ApiWebAppState apiWebAppState, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebAppSetStateRequest(webAppName, apiWebAppState); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithWebAppResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1743,10 +1743,10 @@ public ApiTrueWithWebAppResponse WebAppSetState(string webAppName, ApiWebAppStat /// /// /// This function will return the TrueOnSuccessResponse - public async Task WebServerSetDefaultPageAsync(string defaultPage) + public async Task WebServerSetDefaultPageAsync(string defaultPage, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebserverSetDefaultPageRequest(defaultPage); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -1763,10 +1763,10 @@ ApiTrueOnSuccessResponse IApiRequestHandler.WebServerSetDefaultPage(string defau /// Send a WebServer.ReadDefaultPage Request using the Request from the ApiRequestFactory /// /// Returns the default page in a response object - public async Task WebServerGetReadDefaultPageAsync() + public async Task WebServerGetReadDefaultPageAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiWebserverReadDefaultPageRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -1786,9 +1786,9 @@ public ApiWebServerGetReadDefaultPageResponse WebServerGetReadDefaultPage() /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// State: which equals the state /// - public async Task WebAppSetStateAsync(ApiWebAppData webApp, ApiWebAppState apiWebAppState) + public async Task WebAppSetStateAsync(ApiWebAppData webApp, ApiWebAppState apiWebAppState, CancellationToken cancellationToken = default(CancellationToken)) { - var resp = await WebAppSetStateAsync(webApp.Name, apiWebAppState); + var resp = await WebAppSetStateAsync(webApp.Name, apiWebAppState, cancellationToken); resp.NewWebApp = webApp.ShallowCopy(); resp.NewWebApp.State = apiWebAppState; return resp; @@ -1817,10 +1817,10 @@ public ApiTrueWithWebAppResponse WebAppSetState(ApiWebAppData webApp, ApiWebAppS /// Etag: which equals the newEtagValue /// public async Task WebAppSetResourceETagAsync(string webAppName, string resourceName, - string newETagValue) + string newETagValue, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiSetResourceETagRequest(webAppName, resourceName, newETagValue ?? ""); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithResourceResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1855,9 +1855,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceETag(string webAppName, stri /// Etag: which equals the newEtagValue /// public async Task WebAppSetResourceETagAsync(ApiWebAppData webApp, string resourceName, - string newETagValue) + string newETagValue, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetResourceETagAsync(webApp.Name, resourceName, newETagValue); + return await WebAppSetResourceETagAsync(webApp.Name, resourceName, newETagValue, cancellationToken); } /// /// Send a WebApp.SetResourceETag Request using the Request from the ApiRequestFactory @@ -1884,9 +1884,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceETag(ApiWebAppData webApp, s /// Etag: which equals the newEtagValue /// public async Task WebAppSetResourceETagAsync(ApiWebAppData webApp, ApiWebAppResource resource, - string newETagValue) + string newETagValue, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceETagAsync(webApp.Name, resource.Name, newETagValue); + var basicResp = await WebAppSetResourceETagAsync(webApp.Name, resource.Name, newETagValue, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Etag = (newETagValue == "" ? null : newETagValue); return basicResp; @@ -1916,9 +1916,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceETag(ApiWebAppData webApp, A /// Etag: which equals the newEtagValue /// public async Task WebAppSetResourceETagAsync(string webAppName, ApiWebAppResource resource, - string newETagValue) + string newETagValue, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceETagAsync(webAppName, resource.Name, newETagValue); + var basicResp = await WebAppSetResourceETagAsync(webAppName, resource.Name, newETagValue, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Etag = (newETagValue == "" ? null : newETagValue); return basicResp; @@ -1947,10 +1947,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceETag(string webAppName, ApiW /// MediaType: which equals the newMediaType /// public async Task WebAppSetResourceMediaTypeAsync(string webAppName, string resourceName, - string newMediaType) + string newMediaType, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiSetResourceMediaTypeRequest(webAppName, resourceName, newMediaType); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithResourceResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -1984,9 +1984,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceMediaType(string webAppName, /// MediaType: which equals the newMediaType /// public async Task WebAppSetResourceMediaTypeAsync(ApiWebAppData webApp, string resourceName, - string newMediaType) + string newMediaType, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetResourceMediaTypeAsync(webApp.Name, resourceName, newMediaType); + return await WebAppSetResourceMediaTypeAsync(webApp.Name, resourceName, newMediaType, cancellationToken); } /// /// Send a WebApp.SetResourceMediaType Request using the Request from the ApiRequestFactory @@ -2011,9 +2011,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceMediaType(ApiWebAppData webA /// MediaType: which equals the newMediaType /// public async Task WebAppSetResourceMediaTypeAsync(ApiWebAppData webApp, ApiWebAppResource resource, - string newMediaType) + string newMediaType, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceMediaTypeAsync(webApp.Name, resource.Name, newMediaType); + var basicResp = await WebAppSetResourceMediaTypeAsync(webApp.Name, resource.Name, newMediaType, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Media_type = newMediaType; return basicResp; @@ -2040,9 +2040,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceMediaType(ApiWebAppData webA /// MediaType: which equals the newMediaType /// public async Task WebAppSetResourceMediaTypeAsync(string webAppName, ApiWebAppResource resource, - string newMediaType) + string newMediaType, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceMediaTypeAsync(webAppName, resource.Name, newMediaType); + var basicResp = await WebAppSetResourceMediaTypeAsync(webAppName, resource.Name, newMediaType, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Media_type = newMediaType; return basicResp; @@ -2070,10 +2070,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceMediaType(string webAppName, /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(string webAppName, string resourceName, - string newModificationTime) + string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiSetResourceModificationTimeRequest(webAppName, resourceName, newModificationTime); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithResourceResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); responseObj.NewResource = new ApiWebAppResource() @@ -2104,9 +2104,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(string webA /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, string resourceName, - string newModificationTime) + string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetResourceModificationTimeAsync(webApp.Name, resourceName, newModificationTime); + return await WebAppSetResourceModificationTimeAsync(webApp.Name, resourceName, newModificationTime, cancellationToken); } /// /// Send a WebApp.SetResourceModificationTime Request using the Request from the ApiRequestFactory @@ -2131,9 +2131,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(ApiWebAppDa /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, ApiWebAppResource resource, - string newModificationTime) + string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceModificationTimeAsync(webApp.Name, resource.Name, newModificationTime); + var basicResp = await WebAppSetResourceModificationTimeAsync(webApp.Name, resource.Name, newModificationTime, cancellationToken); var last_mod = basicResp.NewResource.Last_modified; basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Last_modified = last_mod; @@ -2162,10 +2162,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(ApiWebAppDa /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(string webAppName, string resourceName, - DateTime newModificationTime) + DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { return await WebAppSetResourceModificationTimeAsync(webAppName, resourceName, - newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat)); + newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat), cancellationToken); } /// /// Send a WebApp.SetResourceModificationTime Request using the Request from the ApiRequestFactory @@ -2191,10 +2191,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(string webA /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, string resourceName, - DateTime newModificationTime) + DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { return await WebAppSetResourceModificationTimeAsync(webApp.Name, resourceName, - newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat)); + newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat), cancellationToken); } /// /// Send a WebApp.SetResourceModificationTime Request using the Request from the ApiRequestFactory @@ -2219,10 +2219,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(ApiWebAppDa /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, ApiWebAppResource resource, - DateTime newModificationTime) + DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { var basicResp = await WebAppSetResourceModificationTimeAsync(webApp.Name, resource.Name, - newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat)); + newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat), cancellationToken); var last_mod = basicResp.NewResource.Last_modified; basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Last_modified = last_mod; @@ -2250,10 +2250,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(ApiWebAppDa /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(string webAppName, ApiWebAppResource resource, - DateTime newModificationTime) + DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { var basicResp = await WebAppSetResourceModificationTimeAsync(webAppName, resource.Name, - newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat)); + newModificationTime.ToString(DateTimeFormatting.ApiDateTimeFormat), cancellationToken); var last_mod = basicResp.NewResource.Last_modified; basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Last_modified = last_mod; @@ -2281,9 +2281,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(string webA /// Last_Modified: which equals the newModificationTime /// public async Task WebAppSetResourceModificationTimeAsync(string webAppName, ApiWebAppResource resource, - string newModificationTime) + string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceModificationTimeAsync(webAppName, resource.Name, newModificationTime); + var basicResp = await WebAppSetResourceModificationTimeAsync(webAppName, resource.Name, newModificationTime, cancellationToken); var last_mod = basicResp.NewResource.Last_modified; basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Last_modified = last_mod; @@ -2312,10 +2312,10 @@ public ApiTrueWithResourceResponse WebAppSetResourceModificationTime(string webA /// Visibility: which equals the newVisibility /// public async Task WebAppSetResourceVisibilityAsync(string webAppName, string resourceName, - ApiWebAppResourceVisibility newResourceVisibility) + ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiSetResourceVisibilityRequest(webAppName, resourceName, newResourceVisibility); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiTrueWithResourceResponse(); responseObj.TrueOnSuccesResponse = JsonConvert.DeserializeObject(response); if (responseObj.TrueOnSuccesResponse.Result) @@ -2348,9 +2348,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceVisibility(string webAppName /// Visibility: which equals the newResourceVisibility /// public async Task WebAppSetResourceVisibilityAsync(ApiWebAppData webApp, string resourceName, - ApiWebAppResourceVisibility newResourceVisibility) + ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)) { - return await WebAppSetResourceVisibilityAsync(webApp.Name, resourceName, newResourceVisibility); + return await WebAppSetResourceVisibilityAsync(webApp.Name, resourceName, newResourceVisibility, cancellationToken); } /// /// Send a WebApp.SetResourceVisibility Request using the Request from the ApiRequestFactory @@ -2375,9 +2375,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceVisibility(ApiWebAppData web /// Visibility: which equals the newResourceVisibility /// public async Task WebAppSetResourceVisibilityAsync(ApiWebAppData webApp, ApiWebAppResource resource, - ApiWebAppResourceVisibility newResourceVisibility) + ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceVisibilityAsync(webApp.Name, resource.Name, newResourceVisibility); + var basicResp = await WebAppSetResourceVisibilityAsync(webApp.Name, resource.Name, newResourceVisibility, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Visibility = newResourceVisibility; return basicResp; @@ -2404,9 +2404,9 @@ public ApiTrueWithResourceResponse WebAppSetResourceVisibility(ApiWebAppData web /// Visibility: which equals the newResourceVisibility /// public async Task WebAppSetResourceVisibilityAsync(string webAppName, ApiWebAppResource resource, - ApiWebAppResourceVisibility newResourceVisibility) + ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)) { - var basicResp = await WebAppSetResourceVisibilityAsync(webAppName, resource.Name, newResourceVisibility); + var basicResp = await WebAppSetResourceVisibilityAsync(webAppName, resource.Name, newResourceVisibility, cancellationToken); basicResp.NewResource = resource.ShallowCopy(); basicResp.NewResource.Visibility = newResourceVisibility; return basicResp; @@ -2505,12 +2505,12 @@ public HttpResponseMessage DownloadTicketAndGetResponse(ApiTicket ticket) /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// ByteArray that should be sent to the plc Ticketing Endpoint /// Task/void - public async Task UploadTicketAsync(string ticketId, ByteArrayContent data) + public async Task UploadTicketAsync(string ticketId, ByteArrayContent data, CancellationToken cancellationToken = default(CancellationToken)) { data.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); try { - var response = await _httpClient.PostAsync($"/api/ticket?id={ticketId}", data); + var response = await _httpClient.PostAsync($"/api/ticket?id={ticketId}", data, cancellationToken); response.EnsureSuccessStatusCode(); } catch (Exception e) @@ -2534,8 +2534,8 @@ public async Task UploadTicketAsync(string ticketId, ByteArrayContent data) /// The Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// ByteArray that should be sent to the plc Ticketing Endpoint /// Task/void - public async Task UploadTicketAsync(ApiTicket ticket, ByteArrayContent data) - => await UploadTicketAsync(ticket.Id, data); + public async Task UploadTicketAsync(ApiTicket ticket, ByteArrayContent data, CancellationToken cancellationToken = default(CancellationToken)) + => await UploadTicketAsync(ticket.Id, data, cancellationToken); /// /// Function to send the ByteArrayContent for a Ticket (e.g. CreateResource) @@ -2554,14 +2554,14 @@ public void UploadTicket(ApiTicket ticket, ByteArrayContent data) /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// File Bytes will be Read and saved into ByteArrayContent - then sent to the ticketing Endpoint /// Task/void - public async Task UploadTicketAsync(string ticketId, string pathToFile) + public async Task UploadTicketAsync(string ticketId, string pathToFile, CancellationToken cancellationToken = default(CancellationToken)) { if (!File.Exists(pathToFile)) { throw new FileNotFoundException($"file at: {pathToFile} not found!"); } var fileContent = new ByteArrayContent(File.ReadAllBytes(pathToFile)); - await UploadTicketAsync(ticketId, fileContent); + await UploadTicketAsync(ticketId, fileContent, cancellationToken); } /// /// Function to Read and send the ByteArrayContent for a file with the Ticketing Endpoint Ticket (e.g. CreateResource) @@ -2579,8 +2579,8 @@ public async Task UploadTicketAsync(string ticketId, string pathToFile) /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// File Bytes will be Read and saved into ByteArrayContent - then sent to the ticketing Endpoint /// Task/void - public async Task UploadTicketAsync(string ticketId, FileInfo pathToFile) - => await UploadTicketAsync(ticketId, pathToFile.FullName); + public async Task UploadTicketAsync(string ticketId, FileInfo pathToFile, CancellationToken cancellationToken = default(CancellationToken)) + => await UploadTicketAsync(ticketId, pathToFile.FullName, cancellationToken); /// /// Function to Read and send the ByteArrayContent for a file with the Ticketing Endpoint Ticket (e.g. CreateResource) /// MediaTypeHeaderValue: application/octet-stream @@ -2598,8 +2598,8 @@ public void UploadTicket(string ticketId, FileInfo pathToFile) /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// File Bytes will be Read and saved into ByteArrayContent - then sent to the ticketing Endpoint /// Task/void - public async Task UploadTicketAsync(ApiTicket ticket, string pathToFile) - => await UploadTicketAsync(ticket.Id, pathToFile); + public async Task UploadTicketAsync(ApiTicket ticket, string pathToFile, CancellationToken cancellationToken = default(CancellationToken)) + => await UploadTicketAsync(ticket.Id, pathToFile, cancellationToken); /// /// Function to Read and send the ByteArrayContent for a file with the Ticketing Endpoint Ticket (e.g. CreateResource) @@ -2617,8 +2617,8 @@ public async Task UploadTicketAsync(ApiTicket ticket, string pathToFile) /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// File Bytes will be Read and saved into ByteArrayContent - then sent to the ticketing Endpoint /// Task/void - public async Task UploadTicketAsync(ApiTicket ticket, FileInfo pathToFile) - => await UploadTicketAsync(ticket, pathToFile.FullName); + public async Task UploadTicketAsync(ApiTicket ticket, FileInfo pathToFile, CancellationToken cancellationToken = default(CancellationToken)) + => await UploadTicketAsync(ticket, pathToFile.FullName, cancellationToken); /// /// Function to Read and send the ByteArrayContent for a file with the Ticketing Endpoint Ticket (e.g. CreateResource) /// MediaTypeHeaderValue: application/octet-stream @@ -2636,10 +2636,10 @@ public void UploadTicket(ApiTicket ticket, FileInfo pathToFile) /// Password for the user to login with /// Used to determine wether or not a WebApplicationCookie should be included in the Response (Result) /// ApiLoginResponse: contains ApiTokenResult: Token(auth token string) and if requested Web_application_cookie - public async Task ApiLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null) + public async Task ApiLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiLoginRequest(userName, password, includeWebApplicationCookie); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = new ApiLoginResponse(); responseObj = JsonConvert.DeserializeObject(response); if (!string.IsNullOrEmpty(responseObj.Result.Token)) @@ -2666,7 +2666,7 @@ public async Task ApiLoginAsync(string userName, string passwo /// /// Api Requests to be sent as Bulk /// List of ApiResultResponses with Result as object - not "directly" casted to the expected Result type - public async Task ApiBulkAsync(IEnumerable apiRequests) + public async Task ApiBulkAsync(IEnumerable apiRequests, CancellationToken cancellationToken = default(CancellationToken)) { if ((apiRequests.GroupBy(el => el.Id).Count() != apiRequests.Count())) { @@ -2686,7 +2686,7 @@ public async Task ApiBulkAsync(IEnumerable apiRequ byte[] byteArr = Encoding.GetBytes(apiRequestString); ByteArrayContent request_body = new ByteArrayContent(byteArr); request_body.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentType); - var response = await _httpClient.PostAsync(JsonRpcApi, request_body); + var response = await _httpClient.PostAsync(JsonRpcApi, request_body, cancellationToken); _apiResponseChecker.CheckHttpResponseForErrors(response, apiRequestString); var responseString = await response.Content.ReadAsStringAsync(); ApiBulkResponse bulkResponse = new ApiBulkResponse(); @@ -2713,10 +2713,10 @@ public async Task ApiBulkAsync(IEnumerable apiRequ /// Send a Plc.ReadSystemTime Request /// /// Current Plc Utc System Time - public async Task PlcReadSystemTimeAsync() + public async Task PlcReadSystemTimeAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcReadSystemTimeRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2732,10 +2732,10 @@ public async Task PlcReadSystemTimeAsync() /// /// The timestamp of the system time to be set /// True if time was set successfully - public async Task PlcSetSystemTimeAsync(DateTime timestamp) + public async Task PlcSetSystemTimeAsync(DateTime timestamp, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcSetSystemTimeRequest(timestamp); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2751,10 +2751,10 @@ public ApiTrueOnSuccessResponse PlcSetSystemTime(DateTime timestamp) => /// Send a Plc.ReadTimeSettings Request /// /// Current Plc Time Settings - public async Task PlcReadTimeSettingsAsync() + public async Task PlcReadTimeSettingsAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcReadTimeSettingsRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2771,10 +2771,10 @@ public async Task PlcReadTimeSettingsAsync() /// The time zone offset from the UTC time in hours /// (Optional) Represents the settings for daylight-savings. If there is no daylight-savings rule configured, the utcOffset is applied to calculate the local time /// True if the settings are applied successfully - public async Task PlcSetTimeSettingsAsync(TimeSpan utcOffset, DaylightSavingsRule daylightSavings = null) + public async Task PlcSetTimeSettingsAsync(TimeSpan utcOffset, DaylightSavingsRule daylightSavings = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcSetTimeSettingsRequest(utcOffset, daylightSavings); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2793,10 +2793,10 @@ public ApiTrueOnSuccessResponse PlcSetTimeSettings(TimeSpan utcOffset, DaylightS /// Path of the directory or file relative to the memory card root to fetch the entry list. /// The resource name must start with a "/". The parameter may be omitted.In that case, it will default to "/". /// Browsed resources (files/dir/...) - public async Task FilesBrowseAsync(string resource = null) + public async Task FilesBrowseAsync(string resource = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesBrowseRequest(string.IsNullOrEmpty(resource) ? "/" : resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2814,7 +2814,8 @@ public async Task FilesBrowseAsync(string resource = nul /// /// resource to browse: file/dir/... /// Browsed resources (files/dir/...) - public async Task FilesBrowseAsync(ApiFileResource resource) => await FilesBrowseAsync(resource.GetVarNameForMethods()); + public async Task FilesBrowseAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)) + => await FilesBrowseAsync(resource.GetVarNameForMethods(), cancellationToken); /// /// Send a Files.Browse Request @@ -2829,10 +2830,10 @@ public async Task FilesBrowseAsync(string resource = nul /// /// Path of the file relative to the memory card root. /// Ticket ID. - public async Task FilesDownloadAsync(string resource) + public async Task FilesDownloadAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesDownloadRequest(resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2850,10 +2851,10 @@ public async Task FilesDownloadAsync(string resource) /// /// Path of the file relative to the memory card root. /// Ticket ID. - public async Task FilesCreateAsync(string resource) + public async Task FilesCreateAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesCreateRequest(resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var singleStringResp = JsonConvert.DeserializeObject(response); var responseObj = new ApiTicketIdResponse(singleStringResp); return responseObj; @@ -2871,8 +2872,8 @@ public async Task FilesCreateAsync(string resource) /// /// FileInfo for informations about the file to the memory card root. /// Ticket ID. - public async Task FilesCreateAsync(FileInfo resource) - => await FilesCreateAsync(resource.FullName); + public async Task FilesCreateAsync(FileInfo resource, CancellationToken cancellationToken = default(CancellationToken)) + => await FilesCreateAsync(resource.FullName, cancellationToken); /// /// Send a Files.Create request @@ -2887,10 +2888,10 @@ public async Task FilesCreateAsync(FileInfo resource) /// Current path of file/folder /// New path of file/folder /// True if the file or folder is renamed successfully - public async Task FilesRenameAsync(string resource, string new_resource) + public async Task FilesRenameAsync(string resource, string new_resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesRenameRequest(resource, new_resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2908,10 +2909,10 @@ public async Task FilesRenameAsync(string resource, st /// /// Path of the file relative to the memory card root. /// True if the file is deleted successfully - public async Task FilesDeleteAsync(string resource) + public async Task FilesDeleteAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesDeleteRequest(resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2928,10 +2929,10 @@ public async Task FilesDeleteAsync(string resource) /// /// Path of the file relative to the memory card root. /// True if the directory is created successfully - public async Task FilesCreateDirectoryAsync(string resource) + public async Task FilesCreateDirectoryAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesCreateDirectoryRequest(resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2949,10 +2950,10 @@ public async Task FilesCreateDirectoryAsync(string res /// /// DirectoryInfo for informations about the file to the memory card root. /// True if the directory is created successfully - public async Task FilesCreateDirectoryAsync(DirectoryInfo resource) + public async Task FilesCreateDirectoryAsync(DirectoryInfo resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesCreateDirectoryRequest(resource.FullName); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -2969,10 +2970,10 @@ public async Task FilesCreateDirectoryAsync(DirectoryI /// /// The resource to create /// True if the directory is created successfully - public async Task FilesCreateDirectoryAsync(ApiFileResource resource) + public async Task FilesCreateDirectoryAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)) { var varNameForMethods = resource.GetVarNameForMethods(); - return await FilesCreateDirectoryAsync(varNameForMethods); + return await FilesCreateDirectoryAsync(varNameForMethods, cancellationToken); } @@ -2989,10 +2990,10 @@ public ApiTrueOnSuccessResponse FilesCreateDirectory(ApiFileResource resource) /// /// Path of the file relative to the memory card root. /// True if the directory is deleted successfully - public async Task FilesDeleteDirectoryAsync(string resource) + public async Task FilesDeleteDirectoryAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiFilesDeleteDirectoryRequest(resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3009,10 +3010,10 @@ public async Task FilesDeleteDirectoryAsync(string res /// /// Path of the file relative to the memory card root. /// Ticket ID. - public async Task DatalogsDownloadAndClearAsync(string resource) + public async Task DatalogsDownloadAndClearAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiDatalogsDownloadAndClearRequest(resource); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3028,10 +3029,10 @@ public async Task DatalogsDownloadAndClearAsync(string reso /// Send Plc.CreateBackup Request /// /// Ticket ID. - public async Task PlcCreateBackupAsync() + public async Task PlcCreateBackupAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetPlcCreateBackupRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3047,10 +3048,10 @@ public async Task PlcCreateBackupAsync() /// /// /// - public async Task PlcRestoreBackupAsync(string password = null) + public async Task PlcRestoreBackupAsync(string password = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetPlcRestoreBackupRequest(password); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3069,10 +3070,10 @@ public async Task PlcRestoreBackupAsync(string password = n /// /// /// - public async Task ReLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null) + public async Task ReLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null, CancellationToken cancellationToken = default(CancellationToken)) { - await ApiLogoutAsync(); - return await ApiLoginAsync(userName, password, includeWebApplicationCookie); + await ApiLogoutAsync(cancellationToken); + return await ApiLoginAsync(userName, password, includeWebApplicationCookie, cancellationToken); } /// @@ -3089,10 +3090,10 @@ public async Task ReLoginAsync(string userName, string passwor /// /// the resource that shall be deleted. /// True if the file is deleted successfully - public async Task FilesDeleteAsync(ApiFileResource resource) + public async Task FilesDeleteAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)) { var varNameForMethods = resource.GetVarNameForMethods(); - return await FilesDeleteAsync(varNameForMethods); + return await FilesDeleteAsync(varNameForMethods, cancellationToken); } /// @@ -3109,10 +3110,10 @@ public ApiTrueOnSuccessResponse FilesDelete(ApiFileResource resource) /// /// the directory to delete. /// True if the directory is deleted successfully - public async Task FilesDeleteDirectoryAsync(ApiFileResource resource) + public async Task FilesDeleteDirectoryAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)) { var varNameForMethods = resource.GetVarNameForMethods(); - return await FilesDeleteDirectoryAsync(varNameForMethods); + return await FilesDeleteDirectoryAsync(varNameForMethods, cancellationToken); } /// @@ -3128,10 +3129,10 @@ public ApiTrueOnSuccessResponse FilesDeleteDirectory(ApiFileResource resource) /// /// The hardware identifier from which the parameters shall be read /// Response with Failsafe parameters - public async Task FailsafeReadParametersAsync(uint hwid) + public async Task FailsafeReadParametersAsync(uint hwid, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetFailsafeReadParametersRequest(hwid); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3148,10 +3149,10 @@ public ApiFailsafeReadParametersResponse FailsafeReadParameters(uint hwid) => /// Send a Failsafe.ReadRuntimeGroups request /// /// Response with Runtime Groups - public async Task FailsafeReadRuntimeGroupsAsync() + public async Task FailsafeReadRuntimeGroupsAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetFailsafeReadRuntimeGroupsRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3166,10 +3167,10 @@ public async Task FailsafeReadRuntimeGroup /// Send an Api.GetPasswordPolicy request /// /// ApiGetPasswordPolicy response - public async Task ApiGetPasswordPolicyAsync() + public async Task ApiGetPasswordPolicyAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiGetPasswordPolicyRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3184,10 +3185,10 @@ public async Task ApiGetPasswordPolicyAsync() /// Send an Api.GetAuthenticationMode request /// /// A response containing the authentication modes - public async Task ApiGetAuthenticationModeAsync() + public async Task ApiGetAuthenticationModeAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiGetAuthenticationModeRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3202,10 +3203,10 @@ public async Task ApiGetAuthenticationModeAsyn /// Send a Project.ReadLanguages Request /// /// Languages Response containing a list of languages - public async Task ProjectReadLanguagesAsync() + public async Task ProjectReadLanguagesAsync(CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiProjectReadLanguagesRequest(); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); var responseObj = JsonConvert.DeserializeObject(response); return responseObj; } @@ -3221,10 +3222,10 @@ public async Task ProjectReadLanguagesAsync() /// /// In an R/H system, a PLC with ID 1 (primary) or 2 (backup). For standard PLCs, enum value 0 (StandardPLC) is required. /// Mode Selector state - public async Task PlcReadModeSelectorStateAsync(ApiPlcRedundancyId rhid) + public async Task PlcReadModeSelectorStateAsync(ApiPlcRedundancyId rhid, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiPlcReadModeSelectorStateRequest(rhid); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); return JsonConvert.DeserializeObject(response); } @@ -3246,10 +3247,10 @@ public ApiPlcReadModeSelectorStateResponse PlcReadModeSelectorState(ApiPlcRedund /// Optionally allows the user to provide the id of an entry as a starting point for the returned entries array.
/// This allows the user to traverse through the syslog buffer using multiple API calls. /// ApiSyslogBrowseResponse - public async Task ApiSyslogBrowseAsync(ApiPlcRedundancyId? redundancy_id = null, uint? count = null, uint? first = null) + public async Task ApiSyslogBrowseAsync(ApiPlcRedundancyId? redundancy_id = null, uint? count = null, uint? first = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiSyslogBrowseRequest(redundancy_id, count, first); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); return JsonConvert.DeserializeObject(response); } /// @@ -3271,10 +3272,10 @@ public async Task ApiSyslogBrowseAsync(ApiPlcRedundancy /// The Acknowledgement ID of the alarm which shall be acknowledged.
/// The acknowledgement ID can be found in the alarm object that was returned by method Alarms.Browse. /// ApiTrueOnSuccessResponse - public async Task AlarmsAcknowledgeAsync(string id) + public async Task AlarmsAcknowledgeAsync(string id, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiAlarmsAcknowledgeRequest(id); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); return JsonConvert.DeserializeObject(response); } /// @@ -3301,10 +3302,10 @@ public async Task AlarmsAcknowledgeAsync(string id) /// /// (optional) The CPU alarm ID for which the user wants to return the data. If this is provided, no count parameter can be provided as filter. /// (optional) Optional object that contains parameters to filter the response. - public async Task ApiAlarmsBrowseAsync(CultureInfo language, int? count = null, string alarm_id = null, ApiAlarms_RequestFilters filters = null) + public async Task ApiAlarmsBrowseAsync(CultureInfo language, int? count = null, string alarm_id = null, ApiAlarms_RequestFilters filters = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiAlarmsBrowseRequest(language, count, alarm_id, filters); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); return JsonConvert.DeserializeObject(response); } @@ -3332,10 +3333,10 @@ public async Task ApiAlarmsBrowseAsync(CultureInfo lang /// (optional) The maximum number of diagnostic buffer entries to be requested. Default value: 50. A count of 0 will omit any diagnostic buffer entries from the response /// (optional) ApiDiagnosticBufferBrowse_RequestFilters representing various filtering possibilities. /// ApiDiagnosticBufferBrowseResponse - public async Task ApiDiagnosticBufferBrowseAsync(CultureInfo language, uint? count = null, ApiDiagnosticBuffer_RequestFilters filters = null) + public async Task ApiDiagnosticBufferBrowseAsync(CultureInfo language, uint? count = null, ApiDiagnosticBuffer_RequestFilters filters = null, CancellationToken cancellationToken = default(CancellationToken)) { var req = _apiRequestFactory.GetApiDiagnosticBufferBrowseRequest(language, count, filters); - string response = await SendPostRequestAsync(req); + string response = await SendPostRequestAsync(req, cancellationToken); return JsonConvert.DeserializeObject(response); } /// diff --git a/src/Webserver.API/Services/RequestHandling/IApiRequestHandler.cs b/src/Webserver.API/Services/RequestHandling/IApiRequestHandler.cs index 3fa19c5..52534ae 100644 --- a/src/Webserver.API/Services/RequestHandling/IApiRequestHandler.cs +++ b/src/Webserver.API/Services/RequestHandling/IApiRequestHandler.cs @@ -42,7 +42,7 @@ public interface IApiRequestHandler /// /// an array of ApiResponses /// api Requests to send - Task ApiBulkAsync(IEnumerable apiRequests); + Task ApiBulkAsync(IEnumerable apiRequests, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.Browse Request /// @@ -101,7 +101,7 @@ public interface IApiRequestHandler /// The current password for the user /// The new password for the user /// True if changing password for the user was successful - Task ApiChangePasswordAsync(string username, string currentPassword, string newPassword); + Task ApiChangePasswordAsync(string username, string currentPassword, string newPassword, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.ChangePassword request /// @@ -114,7 +114,7 @@ public interface IApiRequestHandler /// Send an Api.GetCertificateUrl Request /// /// ApiSingleStringResponse that contians the URL to the certificate - Task ApiGetCertificateUrlAsync(); + Task ApiGetCertificateUrlAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.GetPermissions Request /// @@ -125,7 +125,7 @@ public interface IApiRequestHandler /// Send an Api.GetQuantityStructures Request ///
/// A QuantityStructure object - Task ApiGetQuantityStructuresAsync(); + Task ApiGetQuantityStructuresAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.GetQuantityStructures Request /// @@ -138,7 +138,7 @@ public interface IApiRequestHandler /// Password for the user to login with /// Used to determine wether or not a WebApplicationCookie should be included in the Response (Result) /// ApiLoginResponse: contains ApiTokenResult: Token(auth token string) and if requested Web_application_cookie - Task ApiLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null); + Task ApiLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.Logout Request /// @@ -149,12 +149,12 @@ public interface IApiRequestHandler /// Send an Api.Ping Request ///
/// ApiSingleStringResponse - an Id that'll stay the same for the users session - Task ApiPingAsync(); + Task ApiPingAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.Version Request /// /// a double that contains the value for the current ApiVersion - Task ApiVersionAsync(); + Task ApiVersionAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Function to get the ByteArray Requested by a Ticket (e.g. DownloadResource) /// @@ -186,7 +186,7 @@ public interface IApiRequestHandler /// sucht die Variable und liefert eine Liste an Kind-Variablen und Metadaten. /// /// PlcProgramBrowseResponse: An Array of ApiPlcProgramData - Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, string var = null); + Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, string var = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a PlcProgram.Browse Request /// @@ -204,7 +204,7 @@ public interface IApiRequestHandler /// sucht die Variable und liefert eine Liste an Kind-Variablen und Metadaten. /// /// PlcProgramBrowseResponse: An Array of ApiPlcProgramData - Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, ApiPlcProgramData var); + Task PlcProgramBrowseAsync(ApiPlcProgramBrowseMode plcProgramBrowseMode, ApiPlcProgramData var, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a PlcProgram.Read Request /// @@ -221,7 +221,7 @@ public interface IApiRequestHandler /// • "raw": liefert Variablenwerte gemäß der Darstellung "raw" /// in Kapitel "Unterstützte Datentypen" /// ApiPlcProgramReadResponse: object with the value for the variables value to be read - Task> PlcProgramReadAsync(ApiPlcProgramData var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null); + Task> PlcProgramReadAsync(ApiPlcProgramData var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a PlcProgram.Read Request /// @@ -237,7 +237,7 @@ public interface IApiRequestHandler /// • "raw": liefert Variablenwerte gemäß der Darstellung "raw" /// in Kapitel "Unterstützte Datentypen" /// ApiPlcProgramReadResponse: object with the value for the variables value to be read - Task> PlcProgramReadAsync(string var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null); + Task> PlcProgramReadAsync(string var, ApiPlcProgramReadOrWriteMode? plcProgramReadMode = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a PlcProgram.Write Request /// This function will build up the name with quotes from the parents given with the ApiPlcProgramDataand call PlcProgramWrite @@ -248,7 +248,7 @@ public interface IApiRequestHandler /// /// /// true to indicate success - Task PlcProgramWriteAsync(ApiPlcProgramData var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null); + Task PlcProgramWriteAsync(ApiPlcProgramData var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a PlcProgram.Write Request /// @@ -258,19 +258,19 @@ public interface IApiRequestHandler /// /// /// true to indicate success - Task PlcProgramWriteAsync(string var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null); + Task PlcProgramWriteAsync(string var, object valueToBeSet, ApiPlcProgramReadOrWriteMode? plcProgramWriteMode = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.ReadOperatingMode Request /// /// The current Plc OperatingMode - Task PlcReadOperatingModeAsync(); + Task PlcReadOperatingModeAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.RequestChangeOperatingMode Request /// Method to change the plc operating mode /// valid plcOperatingModes are: "run", "stop" - others will lead to an invalid params exception. /// /// valid plcOperatingModes are: "run", "stop" - others will lead to an invalid params exception. - Task PlcRequestChangeOperatingModeAsync(ApiPlcOperatingMode plcOperatingMode); + Task PlcRequestChangeOperatingModeAsync(ApiPlcOperatingMode plcOperatingMode, CancellationToken cancellationToken = default(CancellationToken)); /// /// only use this function if you know how to build up apiRequests on your own! /// @@ -320,7 +320,7 @@ public interface IApiRequestHandler /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// ByteArray that should be sent to the plc Ticketing Endpoint /// Task/void - Task UploadTicketAsync(string ticketId, ByteArrayContent data); + Task UploadTicketAsync(string ticketId, ByteArrayContent data, CancellationToken cancellationToken = default(CancellationToken)); /// /// Function to Read and send the ByteArrayContent for a file with the Ticketing Endpoint Ticket (e.g. CreateResource) /// MediaTypeHeaderValue: application/octet-stream @@ -328,19 +328,19 @@ public interface IApiRequestHandler /// Id of the Ticket - will be used to send the request to the endpoint /api/ticket?id=ticketId /// File Bytes will be Read and saved into ByteArrayContent - then sent to the ticketing Endpoint /// Task/void - Task UploadTicketAsync(string ticketId, string pathToFile); + Task UploadTicketAsync(string ticketId, string pathToFile, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Browse Request /// /// webapp name in case only one is requested /// ApiWebAppBrowseResponse: Containing WebAppBrowseResult: Max_Applications:uint, Applications: Array of ApiWebAppdata - Task WebAppBrowseAsync(string webAppName = null); + Task WebAppBrowseAsync(string webAppName = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Browse Request /// /// webappdata that should be requested /// ApiWebAppBrowseResponse: Containing WebAppBrowseResult: Max_Applications:uint, Applications: Array of ApiWebAppdata containing one element: the webappdata that has been requested - Task WebAppBrowseAsync(ApiWebAppData webAppData); + Task WebAppBrowseAsync(ApiWebAppData webAppData, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.BrowseResources Request /// Will return the Api Response "straight away" @@ -349,7 +349,7 @@ public interface IApiRequestHandler /// WebApp.Name to browse resources of /// If given only that resource will be inside the array (in case it exists) /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint,Resources - Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, string resourceName = null); + Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, string resourceName = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.BrowseResources Request /// Will return the Api Response "straight away" @@ -358,7 +358,7 @@ public interface IApiRequestHandler /// WebApp Name to browse resources of /// resource.Name to browse for /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint,Resources - Task WebAppBrowseResourcesAsync(string webAppName, ApiWebAppResource resource); + Task WebAppBrowseResourcesAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.BrowseResources Request /// Will return the Api Response "straight away" @@ -367,7 +367,7 @@ public interface IApiRequestHandler /// webApp.Name to browse resources of /// resource.Name to browse for /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint,Resources:Array of ApiWebAppResource (only 1 if one is requested) - Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppBrowseResourcesAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.BrowseResources Request /// Will return the Api Response "straight away" @@ -376,20 +376,20 @@ public interface IApiRequestHandler /// WebApp name to browse resources of /// If given only that resource will be inside the array (in case it exists) /// ApiWebAppBrowseResourcesResponse:containing ApiWebAppBrowseResourcesResult: Max_Resources:uint,Resources - Task WebAppBrowseResourcesAsync(string webAppName, string resourceName = null); + Task WebAppBrowseResourcesAsync(string webAppName, string resourceName = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Create Request /// /// containing information about name and state for the app to be created /// true to indicate success - Task WebAppCreateAsync(ApiWebAppData webApp); + Task WebAppCreateAsync(ApiWebAppData webApp, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Create Request /// /// webapp name for the app to be created /// optional parameter: state the webapp should be in /// true to indicate success - Task WebAppCreateAsync(string webAppName, ApiWebAppState? apiWebAppState = null); + Task WebAppCreateAsync(string webAppName, ApiWebAppState? apiWebAppState = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.CreateResource Request /// @@ -401,7 +401,7 @@ public interface IApiRequestHandler /// Visibility: resource visibility (protect your confidential data) /// Etag: you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on - Task WebAppCreateResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppCreateResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.CreateResource Request /// @@ -413,7 +413,7 @@ public interface IApiRequestHandler /// Visibility: resource visibility (protect your confidential data) /// Etag: you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on - Task WebAppCreateResourceAsync(string webAppName, ApiWebAppResource resource); + Task WebAppCreateResourceAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.CreateResource Request /// @@ -424,7 +424,7 @@ public interface IApiRequestHandler /// resource visibility (protect your confidential data) /// you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on - Task WebAppCreateResourceAsync(ApiWebAppData webApp, string resourceName, string media_type, string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null); + Task WebAppCreateResourceAsync(ApiWebAppData webApp, string resourceName, string media_type, string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.CreateResource Request /// @@ -435,75 +435,75 @@ public interface IApiRequestHandler /// resource visibility (protect your confidential data) /// you can provide an etag as identification,... for your resource /// TicketId for the Ticketing Endpoint to perform the Upload on - Task WebAppCreateResourceAsync(string webAppName, string resourceName, string media_type, string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null); + Task WebAppCreateResourceAsync(string webAppName, string resourceName, string media_type, string last_modified, ApiWebAppResourceVisibility? apiWebAppResourceVisibility = null, string etag = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Delete Request /// /// webApp.Name of the webapp to delete /// true to indicate success - Task WebAppDeleteAsync(ApiWebAppData webApp); + Task WebAppDeleteAsync(ApiWebAppData webApp, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Delete Request /// /// Name of the webapp to delete /// true to indicate success - Task WebAppDeleteAsync(string webAppName); + Task WebAppDeleteAsync(string webAppName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DeleteRespource Request /// /// webApp.Name of the webapp that contains the resource /// resource.Name of the resource to delete /// true to indicate success - Task WebAppDeleteResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppDeleteResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DeleteRespource Request /// /// Name of the webapp that contains the resource /// resource.Name of the resource to delete /// true to indicate success - Task WebAppDeleteResourceAsync(string webAppName, ApiWebAppResource resource); + Task WebAppDeleteResourceAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DeleteRespource Request /// /// webapp.Name of the webapp that contains the resource /// Name of the resource to delete /// true to indicate success - Task WebAppDeleteResourceAsync(ApiWebAppData webApp, string resourceName); + Task WebAppDeleteResourceAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DeleteRespource Request /// /// Name of the webapp that contains the resource /// Name of the resource to delete /// true to indicate success - Task WebAppDeleteResourceAsync(string webAppName, string resourceName); + Task WebAppDeleteResourceAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DownloadResource Request /// /// webApp.Name of the webapp that contains the resource /// resource.Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - Task WebAppDownloadResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppDownloadResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DownloadResource Request /// /// Name of the webapp that contains the resource /// resource.Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - Task WebAppDownloadResourceAsync(string webAppName, ApiWebAppResource resource); + Task WebAppDownloadResourceAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DownloadResource Request /// /// webApp.Name of the webapp that contains the resource /// Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - Task WebAppDownloadResourceAsync(ApiWebAppData webApp, string resourceName); + Task WebAppDownloadResourceAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.DownloadResource Request /// /// Name of the webapp that contains the resource /// Name of the resource to download /// Ticket id for Ticketing Endpoint to trigger the download on - Task WebAppDownloadResourceAsync(string webAppName, string resourceName); + Task WebAppDownloadResourceAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Rename Request /// @@ -511,7 +511,7 @@ public interface IApiRequestHandler /// New name for the WebApp /// This function will return the TrueOnSuccessResponse and a copy of the given WebApp that has the change: /// name which equals the newname - Task WebAppRenameAsync(ApiWebAppData webApp, string newWebAppName); + Task WebAppRenameAsync(ApiWebAppData webApp, string newWebAppName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.Rename Request /// @@ -519,7 +519,7 @@ public interface IApiRequestHandler /// New name for the WebApp /// This function will return the TrueOnSuccessResponse and a WebApp that only has the information: /// name which equals the newname - Task WebAppRenameAsync(string webAppName, string newWebAppName); + Task WebAppRenameAsync(string webAppName, string newWebAppName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.RenameResource Request /// @@ -528,7 +528,7 @@ public interface IApiRequestHandler /// New name for the resource /// This function will return the TrueOnSuccessResponse and a copy of the Resource given that has the following change: /// name which equals the newname - Task WebAppRenameResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newResourceName); + Task WebAppRenameResourceAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newResourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.RenameResource Request /// @@ -537,7 +537,7 @@ public interface IApiRequestHandler /// New name for the resource /// This function will return the TrueOnSuccessResponse and a copy of the Resource given that has the following change: /// name which equals the newname - Task WebAppRenameResourceAsync(string webAppName, ApiWebAppResource resource, string newResourceName); + Task WebAppRenameResourceAsync(string webAppName, ApiWebAppResource resource, string newResourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.RenameResource Request /// @@ -546,7 +546,7 @@ public interface IApiRequestHandler /// New name for the resource /// This function will return the TrueOnSuccessResponse and a Resource that only has the information: /// name which equals the newname - Task WebAppRenameResourceAsync(ApiWebAppData webApp, string resourceName, string newResourceName); + Task WebAppRenameResourceAsync(ApiWebAppData webApp, string resourceName, string newResourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.RenameResource Request /// @@ -555,7 +555,7 @@ public interface IApiRequestHandler /// New name for the resource /// This function will return the TrueOnSuccessResponse and a Resource that only has the information: /// name which equals the newname - Task WebAppRenameResourceAsync(string webAppName, string resourceName, string newResourceName); + Task WebAppRenameResourceAsync(string webAppName, string resourceName, string newResourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetDefaultPage Request /// @@ -564,7 +564,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Default_Page: which equals the resource.Name /// - Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetDefaultPage Request /// @@ -574,7 +574,7 @@ public interface IApiRequestHandler /// Name: which equals the webAppName /// Default_Page: which equals the resourceName /// - Task WebAppSetDefaultPageAsync(string webAppName, ApiWebAppResource resource); + Task WebAppSetDefaultPageAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetDefaultPage Request /// @@ -583,7 +583,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Default_Page: which equals the resourceName /// - Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, string resourceName); + Task WebAppSetDefaultPageAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetDefaultPage Request /// @@ -593,7 +593,7 @@ public interface IApiRequestHandler /// Name: which equals the webAppName /// Default_Page: which equals the resourceName /// - Task WebAppSetDefaultPageAsync(string webAppName, string resourceName); + Task WebAppSetDefaultPageAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotAuthorizedPage Request /// @@ -602,7 +602,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_authorized_page: which equals the resourceName /// - Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotAuthorizedPage Request /// @@ -612,7 +612,7 @@ public interface IApiRequestHandler /// Name: which equals webAppName /// Not_authorized_page: which equals the resource.Name /// - Task WebAppSetNotAuthorizedPageAsync(string webAppName, ApiWebAppResource resource); + Task WebAppSetNotAuthorizedPageAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotAuthorizedPage Request /// @@ -621,7 +621,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_authorized_page: which equals the resourceName /// - Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, string resourceName); + Task WebAppSetNotAuthorizedPageAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotAuthorizedPage Request /// @@ -631,7 +631,7 @@ public interface IApiRequestHandler /// Name: which equals webAppName /// Not_authorized_page: which equals the resourceName /// - Task WebAppSetNotAuthorizedPageAsync(string webAppName, string resourceName); + Task WebAppSetNotAuthorizedPageAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotFoundPage Request /// @@ -640,7 +640,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_found_page: which equals the resource.Name /// - Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, ApiWebAppResource resource); + Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotFoundPage Request /// @@ -650,7 +650,7 @@ public interface IApiRequestHandler /// Name: which equals the webAppName /// Not_found_page: which equals the resource.Name /// - Task WebAppSetNotFoundPageAsync(string webAppName, ApiWebAppResource resource); + Task WebAppSetNotFoundPageAsync(string webAppName, ApiWebAppResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotFoundPage Request /// @@ -659,7 +659,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// Not_found_page: which equals the resourceName /// - Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, string resourceName); + Task WebAppSetNotFoundPageAsync(ApiWebAppData webApp, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetNotFoundPage Request /// @@ -669,7 +669,7 @@ public interface IApiRequestHandler /// Name: which equals the webAppName /// Not_found_page: which equals the resourceName /// - Task WebAppSetNotFoundPageAsync(string webAppName, string resourceName); + Task WebAppSetNotFoundPageAsync(string webAppName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceETag Request /// @@ -680,7 +680,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Etag: which equals the newEtagValue /// - Task WebAppSetResourceETagAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newETagValue); + Task WebAppSetResourceETagAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newETagValue, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceETag Request /// @@ -691,7 +691,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Etag: which equals the newEtagValue /// - Task WebAppSetResourceETagAsync(string webAppName, ApiWebAppResource resource, string newETagValue); + Task WebAppSetResourceETagAsync(string webAppName, ApiWebAppResource resource, string newETagValue, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceETag Request /// @@ -703,7 +703,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Etag: which equals the newEtagValue /// - Task WebAppSetResourceETagAsync(ApiWebAppData webApp, string resourceName, string newETagValue); + Task WebAppSetResourceETagAsync(ApiWebAppData webApp, string resourceName, string newETagValue, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceETag Request /// @@ -715,7 +715,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Etag: which equals the newEtagValue /// - Task WebAppSetResourceETagAsync(string webAppName, string resourceName, string newETagValue); + Task WebAppSetResourceETagAsync(string webAppName, string resourceName, string newETagValue, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceMediaType Request /// @@ -725,7 +725,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// MediaType: which equals the newMediaType /// - Task WebAppSetResourceMediaTypeAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newMediaType); + Task WebAppSetResourceMediaTypeAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newMediaType, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceMediaType Request /// @@ -735,7 +735,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// MediaType: which equals the newMediaType /// - Task WebAppSetResourceMediaTypeAsync(string webAppName, ApiWebAppResource resource, string newMediaType); + Task WebAppSetResourceMediaTypeAsync(string webAppName, ApiWebAppResource resource, string newMediaType, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceMediaType Request /// @@ -746,7 +746,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// MediaType: which equals the newMediaType /// - Task WebAppSetResourceMediaTypeAsync(ApiWebAppData webApp, string resourceName, string newMediaType); + Task WebAppSetResourceMediaTypeAsync(ApiWebAppData webApp, string resourceName, string newMediaType, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceMediaType Request /// @@ -757,7 +757,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// MediaType: which equals the newMediaType /// - Task WebAppSetResourceMediaTypeAsync(string webAppName, string resourceName, string newMediaType); + Task WebAppSetResourceMediaTypeAsync(string webAppName, string resourceName, string newMediaType, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -767,7 +767,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newModificationTime); + Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, ApiWebAppResource resource, string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -777,7 +777,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(string webAppName, ApiWebAppResource resource, string newModificationTime); + Task WebAppSetResourceModificationTimeAsync(string webAppName, ApiWebAppResource resource, string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -788,7 +788,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, string resourceName, string newModificationTime); + Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, string resourceName, string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -799,7 +799,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(string webAppName, string resourceName, string newModificationTime); + Task WebAppSetResourceModificationTimeAsync(string webAppName, string resourceName, string newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -810,7 +810,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(string webAppName, string resourceName, DateTime newModificationTime); + Task WebAppSetResourceModificationTimeAsync(string webAppName, string resourceName, DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -820,7 +820,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(string webAppName, ApiWebAppResource resource, DateTime newModificationTime); + Task WebAppSetResourceModificationTimeAsync(string webAppName, ApiWebAppResource resource, DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -831,7 +831,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, string resourceName, DateTime newModificationTime); + Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, string resourceName, DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceModificationTime Request /// @@ -841,7 +841,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Last_Modified: which equals the newModificationTime /// - Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, ApiWebAppResource resource, DateTime newModificationTime); + Task WebAppSetResourceModificationTimeAsync(ApiWebAppData webApp, ApiWebAppResource resource, DateTime newModificationTime, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceVisibility Request /// @@ -851,7 +851,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Visibility: which equals the newResourceVisibility /// - Task WebAppSetResourceVisibilityAsync(ApiWebAppData webApp, ApiWebAppResource resource, ApiWebAppResourceVisibility newResourceVisibility); + Task WebAppSetResourceVisibilityAsync(ApiWebAppData webApp, ApiWebAppResource resource, ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceVisibility Request /// @@ -861,7 +861,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the resource given containing only the change: /// Visibility: which equals the newResourceVisibility /// - Task WebAppSetResourceVisibilityAsync(string webAppName, ApiWebAppResource resource, ApiWebAppResourceVisibility newResourceVisibility); + Task WebAppSetResourceVisibilityAsync(string webAppName, ApiWebAppResource resource, ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceVisibility Request /// @@ -872,7 +872,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Visibility: which equals the newResourceVisibility /// - Task WebAppSetResourceVisibilityAsync(ApiWebAppData webApp, string resourceName, ApiWebAppResourceVisibility newResourceVisibility); + Task WebAppSetResourceVisibilityAsync(ApiWebAppData webApp, string resourceName, ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetResourceVisibility Request /// @@ -883,7 +883,7 @@ public interface IApiRequestHandler /// Name: which equals the resourceName /// Visibility: which equals the newVisibility /// - Task WebAppSetResourceVisibilityAsync(string webAppName, string resourceName, ApiWebAppResourceVisibility newResourceVisibility); + Task WebAppSetResourceVisibilityAsync(string webAppName, string resourceName, ApiWebAppResourceVisibility newResourceVisibility, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetState Request /// @@ -892,7 +892,7 @@ public interface IApiRequestHandler /// This function will return the TrueOnSuccessResponse and a copy of the webapp given containing only the change: /// State: which equals the state /// - Task WebAppSetStateAsync(ApiWebAppData webApp, ApiWebAppState apiWebAppState); + Task WebAppSetStateAsync(ApiWebAppData webApp, ApiWebAppState apiWebAppState, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebApp.SetState Request @@ -903,7 +903,7 @@ public interface IApiRequestHandler /// Name: which equals the webAppName /// State: which equals the state /// - Task WebAppSetStateAsync(string webAppName, ApiWebAppState apiWebAppState); + Task WebAppSetStateAsync(string webAppName, ApiWebAppState apiWebAppState, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebServer.ReadDefaultPage request @@ -915,14 +915,14 @@ public interface IApiRequestHandler /// Send a WebServer.ReadDefaultPage request /// /// Returns an ApiWebServerGetReadDefaultPageResponse object - Task WebServerGetReadDefaultPageAsync(); + Task WebServerGetReadDefaultPageAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebServer.SetDefaultPage request /// /// Name of the default page /// Returns a TrueOnSuccessResponse - Task WebServerSetDefaultPageAsync(string defaultPage); + Task WebServerSetDefaultPageAsync(string defaultPage, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a WebServer.SetDefaultPage request @@ -998,7 +998,7 @@ public interface IApiRequestHandler /// Send a Project.ReadLanguages Request /// /// Languages Response containing a list of languages - Task ProjectReadLanguagesAsync(); + Task ProjectReadLanguagesAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Project.ReadLanguages Request /// @@ -1009,7 +1009,7 @@ public interface IApiRequestHandler /// /// The HWID of a node (module) for which a service data file can be downloaded /// Ticket to use for downloading the service data - Task ModulesDownloadServiceDataAsync(ApiPlcHwId hwid); + Task ModulesDownloadServiceDataAsync(ApiPlcHwId hwid, CancellationToken cancellationToken = default(CancellationToken)); /// /// Perform a service data download on the corresponding module with hwid /// @@ -1151,7 +1151,7 @@ public interface IApiRequestHandler /// /// In an R/H system, a PLC with ID 1 (primary) or 2 (backup). For standard PLCs, enum value 0 (StandardPLC) is required. /// Mode Selector state - Task PlcReadModeSelectorStateAsync(ApiPlcRedundancyId rhid); + Task PlcReadModeSelectorStateAsync(ApiPlcRedundancyId rhid, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.ReadModeSelectorState request /// @@ -1753,7 +1753,7 @@ public interface IApiRequestHandler /// Send a Plc.ReadSystemTime Request /// /// Current Plc Utc System Time - Task PlcReadSystemTimeAsync(); + Task PlcReadSystemTimeAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.ReadSystemTime Request @@ -1766,7 +1766,7 @@ public interface IApiRequestHandler /// /// The timestamp of the system time to be set /// True if time was set successfully - Task PlcSetSystemTimeAsync(DateTime timestamp); + Task PlcSetSystemTimeAsync(DateTime timestamp, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Plc.SetSystemTime Request /// @@ -1778,7 +1778,7 @@ public interface IApiRequestHandler /// Send a Plc.ReadTimeSettings Request /// /// Current Plc Time Settings - Task PlcReadTimeSettingsAsync(); + Task PlcReadTimeSettingsAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.ReadTimeSettings Request @@ -1791,7 +1791,7 @@ public interface IApiRequestHandler /// The time zone offset from the UTC time in hours /// (Optional) Represents the settings for daylight-savings. If there is no daylight-savings rule configured, the utcOffset is applied to calculate the local time /// True if the settings are applied successfully - Task PlcSetTimeSettingsAsync(TimeSpan utcOffset, DaylightSavingsRule daylightSavings = null); + Task PlcSetTimeSettingsAsync(TimeSpan utcOffset, DaylightSavingsRule daylightSavings = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.SetTimeSettings Request with parameters /// @@ -1805,7 +1805,7 @@ public interface IApiRequestHandler /// Path of the directory or file relative to the memory card root to fetch the entry list. /// The resource name must start with a "/". The parameter may be omitted.In that case, it will default to "/". /// Browsed resources (files/dir/...) - Task FilesBrowseAsync(string resource = null); + Task FilesBrowseAsync(string resource = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.Browse Request @@ -1820,7 +1820,7 @@ public interface IApiRequestHandler /// /// resource to browse. /// Browsed resources (files/dir/...) - Task FilesBrowseAsync(ApiFileResource resource); + Task FilesBrowseAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.Browse Request @@ -1834,7 +1834,7 @@ public interface IApiRequestHandler /// /// Path of the file relative to the memory card root. /// Ticket ID - Task FilesDownloadAsync(string resource); + Task FilesDownloadAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -1849,7 +1849,7 @@ public interface IApiRequestHandler /// /// Path of the file relative to the memory card root. /// Ticket ID - Task FilesCreateAsync(string resource); + Task FilesCreateAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.Create Request @@ -1864,7 +1864,7 @@ public interface IApiRequestHandler /// /// FileInfo for informations about the file to the memory card root. /// Ticket ID - Task FilesCreateAsync(FileInfo resource); + Task FilesCreateAsync(FileInfo resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.Create Request @@ -1879,7 +1879,7 @@ public interface IApiRequestHandler /// Current path of file/folder /// New path of file/folder /// True if the file or folder is renamed successfully - Task FilesRenameAsync(string resource, string new_resource); + Task FilesRenameAsync(string resource, string new_resource, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -1895,7 +1895,7 @@ public interface IApiRequestHandler /// /// Path of the file relative to the memory card root. /// True if the file is deleted successfully - Task FilesDeleteAsync(string resource); + Task FilesDeleteAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.Delete Request @@ -1909,7 +1909,7 @@ public interface IApiRequestHandler /// /// the resource that shall be deleted. /// True if the file is deleted successfully - Task FilesDeleteAsync(ApiFileResource resource); + Task FilesDeleteAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.Delete Request @@ -1923,7 +1923,7 @@ public interface IApiRequestHandler /// /// Path of the file relative to the memory card root. /// True if the directory is created successfully - Task FilesCreateDirectoryAsync(string resource); + Task FilesCreateDirectoryAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -1939,7 +1939,7 @@ public interface IApiRequestHandler /// /// Path of the file relative to the memory card root. /// True if the directory is created successfully - Task FilesCreateDirectoryAsync(DirectoryInfo resource); + Task FilesCreateDirectoryAsync(DirectoryInfo resource, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -1954,7 +1954,7 @@ public interface IApiRequestHandler /// /// The resource to create /// True if the directory is created successfully - Task FilesCreateDirectoryAsync(ApiFileResource resource); + Task FilesCreateDirectoryAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -1969,7 +1969,7 @@ public interface IApiRequestHandler /// /// Path of the file relative to the memory card root. /// True if the directory is deleted successfully - Task FilesDeleteDirectoryAsync(string resource); + Task FilesDeleteDirectoryAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.DeleteDirectory Request @@ -1983,7 +1983,7 @@ public interface IApiRequestHandler /// /// the directory to delete. /// True if the directory is deleted successfully - Task FilesDeleteDirectoryAsync(ApiFileResource resource); + Task FilesDeleteDirectoryAsync(ApiFileResource resource, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Files.DeleteDirectory Request @@ -1997,7 +1997,7 @@ public interface IApiRequestHandler /// /// Resource name of data log to retrieve, including the path. /// True if the resource is downloaded and deleted successfully - Task DatalogsDownloadAndClearAsync(string resource); + Task DatalogsDownloadAndClearAsync(string resource, CancellationToken cancellationToken = default(CancellationToken)); /// @@ -2011,7 +2011,7 @@ public interface IApiRequestHandler /// Send a Plc.CreateBackup request /// /// ticket id - Task PlcCreateBackupAsync(); + Task PlcCreateBackupAsync(CancellationToken cancellationToken = default(CancellationToken)); /// @@ -2024,7 +2024,7 @@ public interface IApiRequestHandler /// Send a Plc.RestoreBackup request /// /// ticket id - Task PlcRestoreBackupAsync(string password = ""); + Task PlcRestoreBackupAsync(string password = "", CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Plc.RestoreBackup request @@ -2035,7 +2035,7 @@ public interface IApiRequestHandler /// /// Re-login to the plc, set the header again in the connected service (e.g.HttpClient)! /// - Task ReLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null); + Task ReLoginAsync(string userName, string password, bool? includeWebApplicationCookie = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Re-login to the plc, set the header again in the connected service (e.g.HttpClient)! @@ -2047,7 +2047,7 @@ public interface IApiRequestHandler /// /// The hardware identifier from which the parameters shall be read /// Response with Failsafe parameters - Task FailsafeReadParametersAsync(uint hwid); + Task FailsafeReadParametersAsync(uint hwid, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Failsafe.ReadParameters request @@ -2060,7 +2060,7 @@ public interface IApiRequestHandler /// Send a Failsafe.ReadRuntimeGroups request /// /// Response with Runtime Groups - Task FailsafeReadRuntimeGroupsAsync(); + Task FailsafeReadRuntimeGroupsAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Failsafe.ReadRuntimeGroups request @@ -2071,7 +2071,7 @@ public interface IApiRequestHandler /// Send an Api.GetPasswordPolicy request /// /// ApiGetPasswordPolicy response - Task ApiGetPasswordPolicyAsync(); + Task ApiGetPasswordPolicyAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.GetPasswordPolicy request @@ -2083,7 +2083,7 @@ public interface IApiRequestHandler /// Send an Api.GetAuthenticationMode request /// /// A response containing the authentication modes - Task ApiGetAuthenticationModeAsync(); + Task ApiGetAuthenticationModeAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Send an Api.GetAuthenticationMode request @@ -2101,7 +2101,7 @@ public interface IApiRequestHandler /// Optionally allows the user to provide the id of an entry as a starting point for the returned entries array.
/// This allows the user to traverse through the syslog buffer using multiple API calls. /// ApiSyslogBrowseResponse - Task ApiSyslogBrowseAsync(ApiPlcRedundancyId? redundancy_id = null, uint? count = null, uint? first = null); + Task ApiSyslogBrowseAsync(ApiPlcRedundancyId? redundancy_id = null, uint? count = null, uint? first = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// This API method allows the user to read content of the PLC-internal syslog ring buffer. @@ -2122,7 +2122,7 @@ public interface IApiRequestHandler /// The Acknowledgement ID of the alarm which shall be acknowledged.
/// The acknowledgement ID can be found in the alarm object that was returned by method Alarms.Browse. /// ApiTrueOnSuccessResponse - Task AlarmsAcknowledgeAsync(string id); + Task AlarmsAcknowledgeAsync(string id, CancellationToken cancellationToken = default(CancellationToken)); /// /// This method allows the user to acknowledge a single alarm.
@@ -2146,7 +2146,7 @@ public interface IApiRequestHandler /// /// (optional) The CPU alarm ID for which the user wants to return the data. If this is provided, no other parameters can be provided as filter. /// (optional) Optional object that contains parameters to filter the response. - Task ApiAlarmsBrowseAsync(CultureInfo language, int? count = null, string alarm_id = null, ApiAlarms_RequestFilters filters = null); + Task ApiAlarmsBrowseAsync(CultureInfo language, int? count = null, string alarm_id = null, ApiAlarms_RequestFilters filters = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a Alarms.Browse request @@ -2172,7 +2172,8 @@ public interface IApiRequestHandler /// ApiDiagnosticBufferBrowseResponse Task ApiDiagnosticBufferBrowseAsync(CultureInfo language, uint? count = null, - ApiDiagnosticBuffer_RequestFilters filters = null); + ApiDiagnosticBuffer_RequestFilters filters = null, + CancellationToken cancellationToken = default(CancellationToken)); /// /// Send a DiagnosticBuffer.Browse request ///