Skip to content

[Swift] simplifications for the API method usage? #2120

Closed
@hideya

Description

@hideya

All the generated APIs return RequestBuilder<T> for further process. I'm wondering what is the motivation for this, which requires extra typing?

I'm wondering why the usage couldn't just be simple like the following (something equivalent to Obj-C version)?

        CoffeeShopClientAPI.CoffeeShopAPI.coffeeShopCreate(data: coffeeShop) {
            output, error in
            // `output` holds the returned model as an instance of CoffeeShop
            ...
        }

instead of:

        CoffeeShopClientAPI.CoffeeShopAPI.coffeeShopCreate(data: coffeeShop).execute {
            response, error in
            let coffeeShop = response!.body
            ...
        }

Could someone share thoughts on this? (@bajtos wanted to keep informed about this too)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions