Skip to content

Get URL for method #249

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

Closed
kentcdodds opened this issue Nov 25, 2014 · 9 comments
Closed

Get URL for method #249

kentcdodds opened this issue Nov 25, 2014 · 9 comments
Assignees

Comments

@kentcdodds
Copy link
Contributor

I have a use case where I need to get the findAll URL for a resource. Is there an easy way to do this?

@jmdobry
Copy link
Member

jmdobry commented Nov 25, 2014

The API does not provide an easy way to do this.

@kentcdodds
Copy link
Contributor Author

Would it be a great deal of effort to do this?

@kentcdodds
Copy link
Contributor Author

Could we not expose DSUtils and do what is done on this line

@kentcdodds
Copy link
Contributor Author

Or, rather than expose DSUtils, expose a function that does what that line does:

DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.getEndpoint(null, options)),

@jmdobry
Copy link
Member

jmdobry commented Nov 25, 2014

I'll think about it.

@kentcdodds
Copy link
Contributor Author

I would love an api like this:

var foo = DS.defineResource('foo');
var fooUrl = foo.findAll.getUrl(params, options);

So we'd just add a getUrl function to the findAll function. And the findAll function could just use the getUrl function.

This is incidentally what I'm doing for the instance and class methods that I was telling you about yesterday. So far, it's working really well.

jmdobry added a commit that referenced this issue Dec 1, 2014
Stable Version 1.5.0.
@jmdobry jmdobry self-assigned this Dec 1, 2014
@jmdobry jmdobry added the 1.0 label Dec 1, 2014
@jmdobry
Copy link
Member

jmdobry commented Dec 1, 2014

Added DSHttpAdapter.getPath(method, resourceConfig, id|attrs|params[, options]) and DSLocalStorageAdapter.getPath(method, resourceConfig, id|attrs|params[, options])

Example:

var User = DS.defineResource('user');

DSHttpAdapter.getPath('find', User, 1);

@jmdobry jmdobry closed this as completed Dec 1, 2014
@kentcdodds
Copy link
Contributor Author

Huzzah! Thanks!

@jmdobry
Copy link
Member

jmdobry commented Dec 1, 2014

It hasn't made it into js-data yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants