URL building

Report a typo

Suppose you set up locations this way:

@Location("api/")
class Api {
    @Location("users/")
    class Users {
        @Location("{userId}/")
        data class UserInfo(val parent: Api, val userId: Int) {
        	@Location("photos/{photoName}/")
        	data class PhotoInfo(val parent: UserInfo, val photoName: String)
        }
    }

    @Location("posts/")
    class Posts {
        @Location("{postId}/")
        data class PostInfo(val parent: Api, val postId: Int)
    }
}

And you build the url by the following code:

val href = application.locations.href(
    Api.Users.UserInfo.PhotoInfo(UserInfo(Users(), userId = 10), photoName = "beach")
)

What will the href variable be equal to?

Enter a short text
___

Create a free account to access the full topic