///Get all incoming invoices GET /api/v1.0/incoming_invoices.xml public IEnumerable <IncomingInvoice> GetAll() { var incomingInvoiceWrappers = api.Get <IncomingInvoiceWrapper[]>("incoming_invoices." + extension); var incomingInvoices = incomingInvoiceWrappers.Select(w => w.IncomingInvoice); return(incomingInvoices.ToArray()); }
private void SetupMockEndpointWithRenamedMetadata() { _mockEndpointClient .Get(Arg.Any <GetTypesMetadata>()) .Returns(new MetadataTypes { Operations = new List <MetadataOperationType> { new MetadataOperationType { Request = new MetadataType { Name = typeof(RenamedServerGetRequest).Name, Routes = new List <MetadataRoute> { new MetadataRoute { Path = KnownRoute } } } } } }); }
private void SetupMockToReturnApiVersion(string apiVersion) { _mockServiceClient .Get(Arg.Any <AquariusSystemDetector.GetVersion>()) .ReturnsForAnyArgs(new AquariusSystemDetector.VersionResponse { ApiVersion = apiVersion }); }
public void Does_SGSendSyncInternal() { var response = client.Get(new SGSendSyncGetInternal { Value = "GET CLIENT" }); Assert.That(response.Value, Is.EqualTo("GET CLIENT> GET SGSendSyncGetInternal> GET SGSyncGetInternal")); }
private int ChangeVisitsAtLocation(LocationInfo locationInfo) { var siteVisitLocation = GetSiteVisitLocation(locationInfo); var targetApprovalLevel = GetTargetApprovalLevel(siteVisitLocation.Id); var visits = _siteVisit.Get(new GetLocationVisits { Id = siteVisitLocation.Id, StartTime = Context.VisitsAfter?.UtcDateTime, EndTime = Context.VisitsBefore?.UtcDateTime }) .Where(v => v.ApprovalLevelId != targetApprovalLevel.Id) .OrderBy(v => v.StartDate) .ToList(); if (!visits.Any()) { Log.Info($"No field visits to change in location '{locationInfo.Identifier}'."); return(0); } InspectedFieldVisits += visits.Count; var visitQuantity = $"{"field visit".ToQuantity(visits.Count)} at location '{locationInfo.Identifier}'"; var startDate = visits.First().StartDate; var endDate = visits.Last().EndDate; var visitSummary = $"{visitQuantity} from {startDate} to {endDate}"; if (!ConfirmAction( $"change of {visitQuantity}", $"change {visitQuantity}", () => visitSummary, $"the identifier of the location", locationInfo.Identifier)) { return(0); } foreach (var visit in visits) { _siteVisit.Put(new PutVisitApprovalLevel { Id = visit.Id, ApprovalLevelId = targetApprovalLevel.Id }); Log.Info($"Changed '{locationInfo.Identifier}' visit Start={visit.StartDate} End={visit.EndDate} to approval level {targetApprovalLevel.Level} ({targetApprovalLevel.Name})"); } Log.Info($"Changed approval level on {visitSummary} successfully."); return(visits.Count); }
private void SetupMockClient() { _mockServiceClient .Get(Arg.Any <SamplesClient.GetStatus>()) .Returns(new SamplesClient.StatusResponse { ReleaseName = "0.0" }); }
private void SetupMockClient() { _mockServiceClient .Get(Arg.Any <GetStatus>()) .Returns(new Status { ReleaseName = "0.0" }); _mockServiceClient .Get(Arg.Any <SamplesClient.GetUserTokens>()) .Returns(_fixture.Create <SamplesClient.UserTokensResponse>()); }
public IResponse <TResponse> Get <TResponse>(Uri uri) where TResponse : class { var cacheKey = string.Format(_baseCacheKey, "Get", typeof(TResponse).Name, uri.PathAndQuery); return(_cachingProvider.Retrieve(cacheKey, _defaultAbsoluteExpiration, () => _serviceClient.Get <TResponse>(uri))); }
private void FetchEndpointMetadataOnce(IServiceClient client) { lock (_syncLock) { if (RequestsByRoute != null) { return; } RequestsByRoute = new ConcurrentDictionary <string, MetadataType>(StringComparer.InvariantCultureIgnoreCase); try { var response = client.Get(new GetTypesMetadata()); foreach (var operation in response.Operations) { foreach (var route in operation.Request.Routes) { RequestsByRoute[route.Path] = operation.Request; } } } catch (WebServiceException) { // The endpoint may be private and not have metadata exposed. // So all we can do is hope that the client request name still matches the server name } } }
public IActionResult EbObjectList(EbObjectType type) { ViewBag.EbObjectType = (int)type; IServiceClient client = this.ServiceClient; var resultlist = client.Get <EbObjectListResponse>(new EbObjectListRequest { EbObjectType = (int)type }); var rlist = resultlist.Data; Dictionary <int, EbObjectWrapper> ObjList = new Dictionary <int, EbObjectWrapper>(); foreach (var element in rlist) { if (element.EbObjectType == type) { ObjList[element.Id] = element; } } ViewBag.Objlist = ObjList; if (ViewBag.isAjaxCall) { return(PartialView()); } else { return(View()); } }
//Jith Builder related private string GetHtml2Render(BuilderType type, string objid) { IServiceClient client = this.ServiceClient; var resultlist = client.Get <EbObjectLatestCommitedResponse>(new EbObjectLatestCommitedRequest { RefId = objid }); var rlist = resultlist.Data[0]; string _html = string.Empty; EbControlContainer _form = null; if (type == BuilderType.FilterDialog) { _form = EbSerializers.Json_Deserialize <EbFilterDialog>(rlist.Json) as EbControlContainer; } else if (type == BuilderType.WebForm) { _form = EbSerializers.Json_Deserialize <EbWebForm>(rlist.Json) as EbControlContainer; } if (_form != null) { _html += _form.GetHtml(); } return(_html); }
public IActionResult ListApplications() { IServiceClient client = this.ServiceClient; var resultlist = client.Get <GetApplicationResponse>(new GetApplicationRequest()); ViewBag.dict = resultlist.Data; return(View()); }
private List <LocationInfo> ResolveLocationInfo3X(string locationIdentifier) { var locationDescriptions = _publishForLongOperations .Get(new Publish3x.LocationDescriptionListServiceRequest { LocationIdentifier = locationIdentifier }) .LocationDescriptions; return(locationDescriptions .Select(location => new LocationInfo { Identifier = location.Identifier, LocationName = location.Name }) .ToList()); }
public IActionResult TenantAcc() { IServiceClient client = this.ServiceClient; var fr = client.Get <GetAccountResponse>(new GetAccountRequest()); ViewBag.dict = fr.returnlist; return(View()); }
public void Does_add_HttpHeaders_for_Get_Sync() { client.AddHeader("Foo", "Bar"); var response = client.Get(new EchoRequestInfo()); Assert.That(response.Headers["Foo"], Is.EqualTo("Bar")); }
public async Task <IActionResult> Get(string email) { try { var client = await _serviceClient.Get(email); if (client == null || client.Id == Guid.Empty) { return(BadRequest(new FailResponse($"Cliente não encontrado."))); } return(Ok(client)); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, new FailResponse(e.Message, e))); } }
public void Does_only_populate_selected_fields() { QueryResponse <Employee> response; response = client.Get(new QueryEmployees { Fields = "id,departmentid" }); response.PrintDump(); Assert.That(response.Results.All(x => x.Id > 0 && x.Id < 10)); Assert.That(response.Results.All(x => x.DepartmentId >= 10)); response = client.Get(new QueryEmployees { Fields = "departmentid" }); response.PrintDump(); Assert.That(response.Results.All(x => x.Id == 0)); Assert.That(response.Results.All(x => x.DepartmentId >= 10)); }
public static string Login(IServiceClient client, string username, string password) { var publicKey = client.Get(new GetPublicKey()); var encryptedPassword = EncryptPassword(publicKey.Xml, password); return(client.Post(new PostSession { EncryptedPassword = encryptedPassword, Username = username })); }
public IActionResult TenantAccounts() { IServiceClient client = this.ServiceClient; var fr = client.Get <TokenRequiredSelectResponse>(new TokenRequiredSelectRequest { Uid = Convert.ToInt32(ViewBag.UId), Token = ViewBag.token }); ViewBag.dict = fr.returnlist; return(View()); }
public EbObjectWrapper GetFormObj(string objId, int objType) { IServiceClient client = this.ServiceClient; var resultlist = client.Get <EbObjectLatestCommitedResponse>(new EbObjectLatestCommitedRequest { RefId = objId }); var rlist = resultlist.Data[0]; return(rlist); }
public void Can_call_with_JsonServiceClient() { client.Post <Contact>(new CreateContact { Name = "Unit Test", Email = "*****@*****.**", Age = 27 }); Contact contact = client.Get(new GetContact { Id = 1 }); "GetContact: ".Print(); contact.PrintDump(); List <Contact> response = client.Get(new FindContacts { Age = 27 }); "FindContacts: ".Print(); response.PrintDump(); }
public void AAT_ReadProductData() { using (IServiceClient client = GetJsonServiceClient(_serviceUrl)) { ReadProductData request = new ReadProductData { ProductId = 13860428 }; var response = client.Get(request); response.Should().NotBeNull(); response.ProductData.Should().NotBeNull(); } }
public void AfterRedisGetforFilter(RedisClient Redis, IServiceClient client) { try { this.EbFilterDialog = Redis.Get <EbFilterDialog>(this.FilterDialogRefId); if (this.EbFilterDialog == null) { var result = client.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = this.FilterDialogRefId }); this.EbFilterDialog = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbFilterDialog>(this.FilterDialogRefId, this.EbFilterDialog); } } catch (Exception e) { Console.WriteLine("AfterRedisGetforFilter " + e.Message); } }
public override void AfterRedisGet(RedisClient Redis, IServiceClient client) { try { this.FilterDialog = Redis.Get <EbFilterDialog>(this.FilterDialogRefId); if (this.FilterDialog == null && this.FilterDialogRefId != "") { var result = client.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = this.FilterDialogRefId }); this.FilterDialog = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbFilterDialog>(this.FilterDialogRefId, this.FilterDialog); } } catch (Exception e) { Console.WriteLine("Exception:" + e.ToString()); } }
public IActionResult CreateApplication(int itemid) { if (itemid > 0) { IServiceClient client = this.ServiceClient; var resultlist = client.Get <GetApplicationResponse>(new GetApplicationRequest { id = itemid }); ViewBag.applicationname = resultlist.Data["applicationname"]; ViewBag.description = resultlist.Data["description"]; ViewBag.Obj_id = itemid; } else { ViewBag.applicationname = ""; ViewBag.description = ""; ViewBag.Obj_id = ""; } return(View()); }
private List <LocationInfo> ResolveLocationInfo(string locationIdentifierOrGuid) { if (Guid.TryParse(locationIdentifierOrGuid, out var uniqueId)) { return(ResolveLocationInfoByUniqueId(uniqueId)); } return(_publishForLongOperations .Get(new LocationDescriptionListServiceRequest { LocationIdentifier = locationIdentifierOrGuid }) .LocationDescriptions .Select(l => new LocationInfo { Identifier = l.Identifier, LocationName = l.Name, UniqueId = l.UniqueId }) .ToList()); }
private SearchLocation GetSiteVisitLocation(LocationInfo locationInfo) { var searchResults = _siteVisit.Get(new GetSearchLocations { SearchText = locationInfo.Identifier }); if (searchResults.LimitExceeded) { throw new ExpectedException($"Cannot resolve location ID for identifier='{locationInfo.Identifier}'. LimitExceeded=true. Results.Count={searchResults.Results.Count}"); } var location = searchResults.Results .SingleOrDefault(l => l.Identifier == locationInfo.Identifier && l.Name == locationInfo.LocationName); if (location == null) { throw new ExpectedException($"Cannot resolve locationID for unknown identifier='{locationInfo.Identifier}', even with Results.Count={searchResults.Results.Count}"); } return(location); }
public override void AfterRedisGet(RedisClient Redis, IServiceClient client) { try { this.EbDataSource = Redis.Get <EbDataReader>(this.DataSourceRefId); if (this.EbDataSource == null || this.EbDataSource.Sql == null || this.EbDataSource.Sql == string.Empty) { var result = client.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = this.DataSourceRefId }); this.EbDataSource = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbDataReader>(this.DataSourceRefId, this.EbDataSource); } if (this.EbDataSource.FilterDialogRefId != string.Empty) { this.EbDataSource.AfterRedisGet(Redis, client); } } catch (Exception e) { Console.WriteLine("AfterRedisGet " + e.Message); } }
public string GetObjectList(EbObjectType type) { IServiceClient client = this.ServiceClient; var resultlist = client.Get <EbObjectListResponse>(new EbObjectListRequest { EbObjectType = (int)type }); var rlist = resultlist.Data; Dictionary <int, EbObjectWrapper> ObjList = new Dictionary <int, EbObjectWrapper>(); var html = string.Empty; foreach (var element in rlist) { html += @"<a href='../Eb_Object/Index?objid=" + element.Id + @"&objtype=" + (int)type + @"'> <div class='col-md-6 objitems' name='objBox'> <div class='col-md-1 obj-icon'> <div class='obj-ic-cir'> <i class='fa fa-file-text' aria-hidden='true'></i> </div> </div> <div class='col-md-10'> <h4 name='head4' style='color:black;'>" + element.Name + @"</h4> <p class='text-justify'>" + element.Description + @"</p> <a id='labels'> <span name='Version' class='label label-default'>v " + element.VersionNumber + @"</span> <span name='Application' class='label objbox-label'>" + type + @"</span> </a> </div> <div class='col-md-1 objbox-footer'> <input type='button' class='btn fa-input fa-lg' value='' style='font-family: FontAwesome;background: transparent;'> </div> </div></a>"; } return(html); }
public void Can_execute_basic_query() { var response = client.Get(new QueryRockstars()); Assert.That(response.Offset, Is.EqualTo(0)); Assert.That(response.Total, Is.EqualTo(TotalRockstars)); Assert.That(response.Results.Count, Is.EqualTo(TotalRockstars)); }