Skip to content

Commit eef447b

Browse files
Change order of functions to match Node SDK
1 parent 32b154b commit eef447b

File tree

1 file changed

+71
-71
lines changed

1 file changed

+71
-71
lines changed

lib/Authsignal/Authsignal.php

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -63,45 +63,6 @@ public static function setApiVersion($apiVersion)
6363
self::$apiVersion = $apiVersion;
6464
}
6565

66-
/**
67-
* Track an action
68-
*
69-
* @param array $params An associative array of parameters:
70-
* - string 'userId': The userId of the user you are tracking the action for
71-
* - string 'action': The action code that you are tracking
72-
* - array 'attributes': An array of attributes to track
73-
* @return array The authsignal response
74-
*/
75-
public static function track(array $params)
76-
{
77-
$request = new AuthsignalClient();
78-
$userId = urlencode($params['userId']);
79-
$action = urlencode($params['action']);
80-
$attributes = $params['attributes'];
81-
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}", $attributes, 'post');
82-
83-
return $response;
84-
}
85-
86-
/**
87-
* Get an action
88-
* @param array $params An associative array of parameters:
89-
* - string 'userId': The userId of the user you are tracking the action for
90-
* - string 'action': The action code that you are tracking
91-
* - string 'idempotencyKey': The idempotency key for the action
92-
* @return Array The authsignal response
93-
*/
94-
public static function getAction(array $params)
95-
{
96-
$request = new AuthsignalClient();
97-
$userId = urlencode($params['userId']);
98-
$action = urlencode($params['action']);
99-
$idempotencyKey = urlencode($params['idempotencyKey']);
100-
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}/{$idempotencyKey}", array(), 'get');
101-
102-
return $response;
103-
}
104-
10566
/**
10667
* Get a user
10768
* @param array $params An associative array of parameters:
@@ -135,42 +96,60 @@ public static function updateUser(array $params)
13596
list($response, $request) = $request->send($path, $attributes, 'post');
13697
return $response;
13798
}
138-
13999

140100
/**
141-
* Enroll Authenticators
101+
* Delete a user
142102
* @param array $params An associative array of parameters:
143-
* - string 'userId': The userId of the user you are tracking the action for
144-
* - array 'authenticator': The authenticator object
103+
* - string 'userId': The userId of the user you want to delete
145104
* @return Array The authsignal response
146105
*/
147-
public static function enrollVerifiedAuthenticator(array $params)
106+
public static function deleteUser(array $params)
148107
{
149108
$request = new AuthsignalClient();
150109
$userId = urlencode($params['userId']);
151-
$authenticator = $params['authenticator'];
152-
list($response, $request) = $request->send("/users/{$userId}/authenticators", $authenticator, 'post');
153-
110+
$path = "/users/{$userId}";
111+
list($response, $request) = $request->send($path, null, 'delete');
154112
return $response;
155113
}
156114

115+
157116
/**
158-
* Delete a user
117+
* Get Authenticators
159118
* @param array $params An associative array of parameters:
160-
* - string 'userId': The userId of the user you want to delete
119+
* - string 'userId': The userId of the user whose authenticators you want to retrieve
120+
* @return array The list of user authenticators
121+
* @throws AuthsignalApiException if the request fails
122+
*/
123+
public static function getAuthenticators(array $params)
124+
{
125+
$request = new AuthsignalClient();
126+
$userId = urlencode($params['userId']);
127+
$path = "/users/{$userId}/authenticators";
128+
129+
list($response, $request) = $request->send($path, null, 'get');
130+
return $response;
131+
}
132+
133+
134+
/**
135+
* Enroll Authenticators
136+
* @param array $params An associative array of parameters:
137+
* - string 'userId': The userId of the user you are tracking the action for
138+
* - array 'authenticator': The authenticator object
161139
* @return Array The authsignal response
162140
*/
163-
public static function deleteUser(array $params)
141+
public static function enrollVerifiedAuthenticator(array $params)
164142
{
165143
$request = new AuthsignalClient();
166144
$userId = urlencode($params['userId']);
167-
$path = "/users/{$userId}";
168-
list($response, $request) = $request->send($path, null, 'delete');
145+
$authenticator = $params['authenticator'];
146+
list($response, $request) = $request->send("/users/{$userId}/authenticators", $authenticator, 'post');
147+
169148
return $response;
170149
}
171150

172151
/**
173-
* Delete a user authenticator
152+
* Delete an authenticator
174153
* @param array $params An associative array of parameters:
175154
* - string 'userId': The userId of the user
176155
* - string 'userAuthenticatorId': The userAuthenticatorId of the authenticator
@@ -199,6 +178,26 @@ public static function deleteAuthenticator(array $params) {
199178
}
200179
}
201180

181+
/**
182+
* Track an action
183+
*
184+
* @param array $params An associative array of parameters:
185+
* - string 'userId': The userId of the user you are tracking the action for
186+
* - string 'action': The action code that you are tracking
187+
* - array 'attributes': An array of attributes to track
188+
* @return array The authsignal response
189+
*/
190+
public static function track(array $params)
191+
{
192+
$request = new AuthsignalClient();
193+
$userId = urlencode($params['userId']);
194+
$action = urlencode($params['action']);
195+
$attributes = $params['attributes'];
196+
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}", $attributes, 'post');
197+
198+
return $response;
199+
}
200+
202201
/**
203202
* Validate Challenge
204203
* @param array $params An associative array of parameters:
@@ -226,6 +225,25 @@ public static function validateChallenge(array $params)
226225
return $response;
227226
}
228227

228+
/**
229+
* Get an action
230+
* @param array $params An associative array of parameters:
231+
* - string 'userId': The userId of the user you are tracking the action for
232+
* - string 'action': The action code that you are tracking
233+
* - string 'idempotencyKey': The idempotency key for the action
234+
* @return Array The authsignal response
235+
*/
236+
public static function getAction(array $params)
237+
{
238+
$request = new AuthsignalClient();
239+
$userId = urlencode($params['userId']);
240+
$action = urlencode($params['action']);
241+
$idempotencyKey = urlencode($params['idempotencyKey']);
242+
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}/{$idempotencyKey}", array(), 'get');
243+
244+
return $response;
245+
}
246+
229247
/**
230248
* Update Action
231249
* @param array $params An associative array of parameters:
@@ -243,22 +261,4 @@ public static function updateAction(array $params)
243261
list($response, $request) = $request->send($path, $params['attributes'], 'patch');
244262
return $response;
245263
}
246-
247-
/**
248-
* Get Authenticators
249-
* @param array $params An associative array of parameters:
250-
* - string 'userId': The userId of the user whose authenticators you want to retrieve
251-
* @return array The list of user authenticators
252-
* @throws AuthsignalApiException if the request fails
253-
*/
254-
public static function getAuthenticators(array $params)
255-
{
256-
$request = new AuthsignalClient();
257-
$userId = urlencode($params['userId']);
258-
$path = "/users/{$userId}/authenticators";
259-
260-
list($response, $request) = $request->send($path, null, 'get');
261-
return $response;
262-
}
263-
264264
}

0 commit comments

Comments
 (0)