lukepuplett / surfdude-csharp Goto Github PK
View Code? Open in Web Editor NEWA smart hypermedia client for RESTful APIs
A smart hypermedia client for RESTful APIs
A self
or item
link may support more than one action upon it, therefore we need to use the method and relation as a composite unique key.
The following things may need considering.
Offer .Replace(object model)
and .Delete()
steps with no parameters to act upon the current resource but checks whether the current resource has these links.
Some actions after deleting a resource make no sense. For example, deleting an entire subset may return an empty set, plus links, so To and Submit might be the only rational next steps. Consider this when designing the return type from a .Delete()
.
Because submitting on a simple read can feel odd, add .To("orders", new { skip = 10, take = 10 })
which submits with a Get. This bakes in a link between the step name To and the HTTP method name Get. Submit should continue to use/choose most appropriate HTTP method from the controls on offer.
Throw when cannot work out the most appropriate method to use for the step and rel.
To = GET, POST
ToItem = GET
Submit = GET, POST, PUT, match in that order on first with compatible inputs
Replace = PUT + payload
Delete = DELETE
The client should report when a link it traverses is marked for sunsetting.
Exception when submitting raw string payload.
.ThenSubmit("xml-in", someXmlAsString);
Unhandled Exception: System.Reflection.TargetParameterCountException: Parameter count mismatch.
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
at Evoq.Surfdude.SendDictionary.CreateDictionaryFrom(Object sendModel)
at Evoq.Surfdude.SendDictionary..ctor(Object sendModel)
at Evoq.Surfdude.Hypertext.Http.SubmitStep.ExecuteStepRequestAsync(HttpStep previous, CancellationToken cancellationToken)
at Evoq.Surfdude.Hypertext.Http.HttpStep.ExecuteAsync(IStep previous, CancellationToken cancellationToken)
at Evoq.Surfdude.WaveBuilder.Evoq.Surfdude.IWaveSteps.GoAsync(CancellationToken cancellationToken)
Url templating and appending of extraneous inputs as query params.
Flow ILogFactory
down
Enforce checks on input values to support this.
"options": [ "a", "b", "c" ]
Can we branch a journey?
SelectRoot().If<TResourceModel>(predicate, branchJourney)
Or perhaps
SelectRoot().If<TResourceModel>(predicate).Branch(j => j.Submit(...)).Else().Follow(...)
Template argument is null when link has only a rel
.
Offending link.
"links":
[
{
"rel": "set"
}
]
Client code.
SurfReport report = await Surf.Wave(apiRootUrl)
.FromRoot()
.Then("account")
.Then("services")
.ThenSubmit("set", new
{
something = true
})
.GoAsync();
Dump.
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: template
at UriTemplate.Core.UriTemplate..ctor(String template)
at Evoq.Surfdude.Hypertext.SimpleJson.SimpleJsonResourceReaderWriter.PrepareUri(IDictionary`2 sendPairs, IHypertextControl hypertextControl)
at Evoq.Surfdude.Hypertext.SimpleJson.SimpleJsonResourceReaderWriter.CreateRequestWithOptionalBody(IDictionary`2 sendPairs, IHypertextControl hypertextControl)
at Evoq.Surfdude.Hypertext.SimpleJson.SimpleJsonResourceReaderWriter.BuildRequest(IDictionary`2 sendPairs, IHypertextControl hypertextControl)
at Evoq.Surfdude.Hypertext.Http.SubmitStep.ExecuteStepRequestAsync(HttpStep previous, CancellationToken cancellationToken)
at Evoq.Surfdude.Hypertext.Http.HttpStep.ExecuteAsync(IStep previous, CancellationToken cancellationToken)
at Evoq.Surfdude.WaveBuilder.Evoq.Surfdude.IWaveSteps.GoAsync(CancellationToken cancellationToken)
Hoist ifmatch control data into header
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.