|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this_program `()(string client_id, string client_secret, |
void|string redirect_uri, |
void|string|array(string)|multiset(string) scope) |
{ |
return Github(client_id, client_secret, redirect_uri, scope); |
} |
|
class Github |
{ |
inherit WebApi.Api : parent; |
|
protected constant AuthClass = Auth.Github; |
|
|
constant API_URI = "https://api.github.com"; |
|
|
|
|
|
|
Any `any() |
{ |
return _any || (_any = Any()); |
} |
|
|
|
|
|
|
|
|
|
|
mapping get(string path, void|ParamsArg params, void|Callback cb) |
{ |
return `any()->get(path, params, cb); |
} |
|
|
|
|
|
|
|
|
|
|
mapping put(string path, void|ParamsArg params, void|Callback cb) |
{ |
return `any()->put(path, params, cb); |
} |
|
|
|
|
|
|
|
|
|
|
|
mapping post(string path, void|ParamsArg params, void|string data, |
void|Callback cb) |
{ |
return `any()->post(path, params, data, cb); |
} |
|
|
|
|
|
|
|
|
|
|
mapping delete(string path, void|ParamsArg params, void|Callback cb) |
{ |
return `any()->delete(path, params, cb); |
} |
|
|
protected class Method |
{ |
inherit WebApi.Api.Method; |
|
|
public mixed get(string s, void|ParamsArg p, void|Callback cb) |
{ |
return parent::get(get_uri(METHOD_PATH + s), p, cb); |
} |
|
|
public mixed put(string s, void|ParamsArg p, void|Callback cb) |
{ |
return parent::put(get_uri(METHOD_PATH + s), p, cb); |
} |
|
|
public mixed post(string s, void|ParamsArg p, void|string data, |
void|Callback cb) |
{ |
return parent::post(get_uri(METHOD_PATH + s), p, data, cb); |
} |
|
|
public mixed delete(string s, void|ParamsArg p, void|Callback cb) |
{ |
return parent::delete(get_uri(METHOD_PATH + s), p, cb); |
} |
} |
|
|
protected class Any |
{ |
inherit Method; |
protected constant METHOD_PATH = "/"; |
} |
|
private Any _any; |
} |
|
|