Coder Social home page Coder Social logo

surfdude-csharp's People

Contributors

dependabot[bot] avatar lukepuplett avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

surfdude-csharp's Issues

Support multiple methods per relation

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

  • Design above forces deletes to be done by getting the resource first, use ifmatch in control or from last response

Exception when submitting raw string payload.

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)

Horrible argument null ex when link is malformed

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.