Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes repetition from method attributes and fixes failing specs #40

Merged
merged 7 commits into from
Jun 26, 2014

Conversation

alexandru-calinoiu
Copy link
Contributor

Now on master:

    public interface IDummyHttpApi
    {
        [Get("/foo/bar/{id}")]
        Task<string> FetchSomeStuff(int id);

        [Get("/foo/bar/{id}?baz=bamf")]
        Task<string> FetchSomeStuffWithHardcodedQueryParameter(int id);
    }

With this pull request

    public interface IDummyHttpApi
    {
        [Get("/bar/{id}")]
        Task<string> FetchSomeStuff(int id);

        [Get("/bar/{id}?baz=bamf")]
        Task<string> FetchSomeStuffWithHardcodedQueryParameter(int id);
    }

    RestService.For<IDummyHttpApi>("http://api.com/foo")

It will spare you from writting /api/v1 on all your endpoints, making it easier to update to a new api version.

@anaisbetts
Copy link
Member

Hey @Balauru, it's hard to see what's changed because your editor changed the style - can you fix this up? Here's a motivating example:

public void FooBar() 
{
    try {
        if (foo == "bar") {
            baz();
        } else {
            bamf()
        }
    } catch (Exception ohNoes) {
        Console.WriteLine(ohNoes);
    }
}

You don't need to close and resubmit or anything, just push another commit and it will show up here

@alexandru-calinoiu
Copy link
Contributor Author

Done @paulcbetts

Any reference to the code style you are using here, looks a lot like java instead of the usual .net developer use.

@alexandru-calinoiu
Copy link
Contributor Author

The change is in the RequestBuilderImplementation class I've update the 2 factory methods to receive a basePath param, the rest of the change are cosmetic and tests

@carl-berg
Copy link
Contributor

This seems to be the same issue as #34 ...

@alexandru-calinoiu
Copy link
Contributor Author

Yes, this is my proposed solution.

@carl-berg
Copy link
Contributor

I like it 👍
In my case we have a rest api that is hosted as a localhost site in development and as a virtual app under a root site in production and with the current refit implementation we can't simply use different base addresses but would have to have two different api-interfaces. This would solve it.

@anaisbetts
Copy link
Member

Looks good, I like it! Thanks @Balauru!

anaisbetts pushed a commit that referenced this pull request Jun 26, 2014
Removes repetition from method attributes and fixes failing specs
@anaisbetts anaisbetts merged commit c69c63c into reactiveui:master Jun 26, 2014
@alexandru-calinoiu alexandru-calinoiu deleted the full_host_url branch June 26, 2014 09:34
@lock lock bot locked and limited conversation to collaborators Jun 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants