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

CloudCode Functions? #65

Open
srsgores opened this issue Apr 26, 2015 · 6 comments
Open

CloudCode Functions? #65

srsgores opened this issue Apr 26, 2015 · 6 comments

Comments

@srsgores
Copy link

Is there a way to get cloudcode functions working? I want to be able to query a certain model with a POST request, passing in geolocation data.

POST http://api.parse.com/1/functions/proximity

with

{
lat: 51.0453738,
lon: -114.0566039,
limit: 20, radius: 10,
parseClass: "Event",
distance: 2
}

Is this possible yet? If not, how can it be implemented?

@joshfester
Copy link

I accomplished this by editing the pathForType function in addon/adapters/application.js. Add a case for "functions". Then I use this code to make a function call:

Adapter.ajax(Adapter.buildURL("function", "someCloudFunction"), "POST", {
        data: {
          foo: bar
        }
      });

@quantuminformation
Copy link

@joshfester nice one!

@srsgores
Copy link
Author

@JoshFoster, would you have to use a model of type function in that case? What would ember data integration look like?

@joshfester
Copy link

In my app it ended up being easiest to just put the functions on the application route since I only use a handful of cloud functions.

To me it would make the most sense if every model could have "functions" the same way that controllers have "actions". Then you could call someModel.cloudFunction(data)

@srsgores
Copy link
Author

@joshfester, can you provide an example? In my case, I'm simply looking to query a set of data based on the user's current location, so I don't quite follow how I would set a route's model to the result.

Perhaps you could add an example to the dummy app?

@joshfester
Copy link

@srsgores sorry I should have clarified. My suggestion was a feature request to solve this issue via the adapter. In your case I'd suggest using my quick fix until support gets added to the adapter.

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

4 participants