private Task <WorkOrderCreateResponse> CreateWorkOrderInternal(WorkOrderForCreate workOrderForCreate, string accessToken)
        {
            var workOrderCreateRequest = MapperWorkOrder.MapToWorkOrderCreateRequest(workOrderForCreate);

            return(_serviceAgentHttp.PostAsJsonAsync <WorkOrderCreateRequest, WorkOrderCreateResponse>(
                       "v2",
                       workOrderCreateRequest,
                       "AR-JWT", accessToken,
                       WorkOrderServiceExceptionTranslator.EnsureSuccess));
        }
Esempio n. 2
0
        public async Task <string> CreateWorkOrder(WorkOrderForCreate workOrderForCreate)
        {
            var workOrderCreateRequest = MapperWorkOrder.MapToWorkOrderCreateRequest(workOrderForCreate);

            var accessToken = await Login(_httpClient, _workOrderServiceSettings.UserName, _workOrderServiceSettings.Password).ConfigureAwait(false);

            var authenticationHeaderValue = new AuthenticationHeaderValue("AR-JWT", accessToken);

            using var httpResponseMessage = await PostJsonAsync(_httpClient, url : string.Empty, workOrderCreateRequest, authenticationHeaderValue).ConfigureAwait(false);

            var workOrderId = await httpResponseMessage.Content.ReadAsAsync <string>().ConfigureAwait(false);

            await Logout(_httpClient, accessToken).ConfigureAwait(false);

            return(workOrderId);
        }