scarygami / dart_endpoints Goto Github PK
View Code? Open in Web Editor NEWImplementation of Google Cloud Endpoints in Dart.
Home Page: https://dart-endpoints.appspot.com/
License: BSD 3-Clause "New" or "Revised" License
Implementation of Google Cloud Endpoints in Dart.
Home Page: https://dart-endpoints.appspot.com/
License: BSD 3-Clause "New" or "Revised" License
I'm playing with appengine and endpoints. Trying to design the dumbest API. Without local logging and error reporting when calling addApi, it was hard to know that an API was badly defined (I ended up creating a unittest for validating my APIs calling new ApiConfig(new MyApi());
So my useless API was
class Time {
@ApiProperty(description: 'Current time')
DateTime now;
Time([this.now]);
}
@ApiClass(
name: 'time',
version: 'v1',
description: 'Time API'
)
class TimeEndPoint {
@ApiMethod(
path: 'time',
name: 'time.get',
method: 'GET',
description: 'Get the current time'
)
Future<Time> get(VoidMessage _) async {
return new Time(new DateTime.now());
}
}
To note that I had to use a dummy "VoidMessage _" param for my single API. Is this a requirement for appengine or is it something that your validation is enforcing too much?
The idea is to allow reusing models but limiting the writable/returned fields in methods to a certain subset of the available fields.
Currently:
class Score {
int user;
int score;
DateTime timestamp;
}
class ScoreSubmission {
int score;
}
@ApiMethod(...)
Score submit(ScoreSubmission request, ApiUser user) {
Score score = new Score();
score.user = user.id;
score.score = request.score;
score.timestamp = new DateTime.now();
// insert score
return score;
}
Planned:
class Score {
int user;
int score;
DateTime timestamp;
}
@ApiMethod(...
requestFields: const ['score']
)
Score submit(Score score, ApiUser user) {
score.user = user.id;
score.timestamp = new DateTime.now();
// insert score
return score;
}
ListResponse<MyMessage> list(ListRequest<MyMessage> request) {
...
}
Should include limit
, offset
, order
parameters and allow filtering by elements of MyMessage.
Best to be used in combination with datastore models.
Hi and thank you so much for porting endpoints to dart. <3
I m trying to port my python code to dart, and i m getting issues using the TicTacToe demo
I pasted the whole TicTacToe project, and just replaced the client id by mine, but it seems to be not enough for the api explorer.
First i m getting a red ribbon about tls but i think it's normal and the workaround is pretty easy.
But "loading" hangs indefinitely... It just print a Http 500 (internal server error) and a "Uncaught java.lang.NullPointerException" 20 secs later.
Is this related to this, it seem to be fixed, but i cant reach http://localhost:8080/_ah/health => 503 - This request has timed out.
Thank you again! :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.