-
Notifications
You must be signed in to change notification settings - Fork 2
/
GJUsers.hx
44 lines (29 loc) · 1.04 KB
/
GJUsers.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Copyright (c) 2019 Charles Griffiths
*/
package gjCloud;
class GJUsers
{
static var fetchDir:String = "/users/";
static var authDir:String = "/users/auth/";
static public function fetchByUsername( ?name:String=null ):GJTransaction
{
return new GJTransaction( fetchDir ).addGameID().addUserName( name );
}
static public function fetchByUserID( ?id:Int=null ):GJTransaction
{
return new GJTransaction( fetchDir ).addGameID().addUserID( Std.string( id ));
}
static public function fetchByUserIDs( ids:Array<Int> ):GJTransaction
{
if (null == ids || 0 == ids.length) return fetchByUserID();
var idlist = Std.string( ids[0] );
for (index in 1...ids.length)
idlist += "," + Std.string( ids[index] );
return new GJTransaction( fetchDir ).addGameID().addUserID( idlist );
}
static public function auth( ?userName:String=null, ?userToken:String=null )
{
return new GJTransaction( authDir ).addGameID().addUserName( userName ).addUserToken( userToken );
}
}