Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Simplify multiple calls to the same service #11

@d3x7r0

Description

@d3x7r0

Currently if you want to do multiple calls to the same service you can, at most, save the request builder and start from there every time.

RequestBuilder<API> builder = Fetchyfetchy.createRequest("serviceId", API.class)
    .timeout(10);


Object result = builder
    .callable(client -> client.method())
    .execute();

builder
    .runnable(client -> client.method())
    .execute();

My suggestion is have something that allows you to set defaults for a given service and then use the normal fetchy calls on it:

FetchyProxy proxy = fetchy.buildProxy("serviceId", API.class)
    .withTimeout(10)
    .build();


Object result = proxy.call(client -> client.method());

proxy.run(client -> client.method());

proxy.createRequest()
         .runnable(client -> client.method())
         .timeout(10)
         .execute();

I believe, after ending up with similar code abstractions in my own fetchy usage, this may simplify things but would like to hear the opinion of other people.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions