Пример #1
0
        public void TestUrlEncoding()
        {
            var tx = new TransactionBuilder("https://fhir.sandboxcernerpowerchart.com/may2015/open/d075cf8b-3261-481d-97e5-ba6c48d3b41f");
            tx.Get("https://fhir.sandboxcernerpowerchart.com/may2015/open/d075cf8b-3261-481d-97e5-ba6c48d3b41f/MedicationPrescription?patient=1316024&status=completed%2Cstopped&_count=25&scheduledtiming-bounds-end=<=2014-09-08T18:42:02.000Z&context=14187710&_format=json");
            var b = tx.ToBundle();

            byte[] body;

            var req = b.Entry[0].ToHttpRequest(Prefer.ReturnRepresentation, ResourceFormat.Json, useFormatParameter: true, body: out body);

            Assert.AreEqual("https://fhir.sandboxcernerpowerchart.com/may2015/open/d075cf8b-3261-481d-97e5-ba6c48d3b41f/MedicationPrescription?patient=1316024&status=completed%2Cstopped&_count=25&scheduledtiming-bounds-end=%3C%3D2014-09-08T18%3A42%3A02.000Z&context=14187710&_format=json&_format=json", req.RequestUri.AbsoluteUri);
        }
        /// <summary>
        /// Search for Resources based on criteria specified in a Query resource
        /// </summary>
        /// <param name="q">The Query resource containing the search parameters</param>
        /// <param name="resourceType">The type of resource to filter on (optional). If not specified, will search on all resource types.</param>
        /// <returns>A Bundle with all resources found by the search, or an empty Bundle if none were found.</returns>
        public Bundle Search(SearchParams q, string resourceType = null)
        {
            var tx = new TransactionBuilder(Endpoint).Search(q, resourceType).ToBundle();

            return(execute <Bundle>(tx, HttpStatusCode.OK));
        }
Пример #3
0
        /// <summary>
        /// Search for Resources based on criteria specified in a Query resource
        /// </summary>
        /// <param name="q">The Query resource containing the search parameters</param>
        /// <param name="resourceType">The type of resource to filter on (optional). If not specified, will search on all resource types.</param>
        /// <returns>A Bundle with all resources found by the search, or an empty Bundle if none were found.</returns>
        public Task <Bundle> SearchUsingPostAsync(SearchParams q, string resourceType = null)
        {
            var tx = new TransactionBuilder(Endpoint).SearchUsingPost(q, resourceType).ToBundle();

            return(executeAsync <Bundle>(tx, new[] { HttpStatusCode.OK }));
        }
        public void TestBuild()
        {
            var p = new Patient();
            var b = new TransactionBuilder("http://myserver.org/fhir")
                        .Create(p)
                        .ResourceHistory("Patient","7")
                        .Delete("Patient","8")
                        .Read("Patient","9", ifNoneMatch: "W/bla")
                        .ToBundle();

            Assert.AreEqual(4, b.Entry.Count);
            
            Assert.AreEqual(Bundle.HTTPVerb.POST, b.Entry[0].Request.Method);
            Assert.AreEqual(p, b.Entry[0].Resource);

            Assert.AreEqual(Bundle.HTTPVerb.GET, b.Entry[1].Request.Method);
            Assert.AreEqual("http://myserver.org/fhir/Patient/7/_history", b.Entry[1].Request.Url);

            Assert.AreEqual(Bundle.HTTPVerb.DELETE, b.Entry[2].Request.Method);
            Assert.AreEqual("http://myserver.org/fhir/Patient/8", b.Entry[2].Request.Url);

            Assert.AreEqual(Bundle.HTTPVerb.GET, b.Entry[3].Request.Method);
            Assert.AreEqual("http://myserver.org/fhir/Patient/9", b.Entry[3].Request.Url);
            Assert.AreEqual("W/bla", b.Entry[3].Request.IfNoneMatch);
        }