@@ -63,45 +63,6 @@ public static function setApiVersion($apiVersion)
63
63
self ::$ apiVersion = $ apiVersion ;
64
64
}
65
65
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
-
105
66
/**
106
67
* Get a user
107
68
* @param array $params An associative array of parameters:
@@ -135,42 +96,60 @@ public static function updateUser(array $params)
135
96
list ($ response , $ request ) = $ request ->send ($ path , $ attributes , 'post ' );
136
97
return $ response ;
137
98
}
138
-
139
99
140
100
/**
141
- * Enroll Authenticators
101
+ * Delete a user
142
102
* @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
145
104
* @return Array The authsignal response
146
105
*/
147
- public static function enrollVerifiedAuthenticator (array $ params )
106
+ public static function deleteUser (array $ params )
148
107
{
149
108
$ request = new AuthsignalClient ();
150
109
$ 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 ' );
154
112
return $ response ;
155
113
}
156
114
115
+
157
116
/**
158
- * Delete a user
117
+ * Get Authenticators
159
118
* @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
161
139
* @return Array The authsignal response
162
140
*/
163
- public static function deleteUser (array $ params )
141
+ public static function enrollVerifiedAuthenticator (array $ params )
164
142
{
165
143
$ request = new AuthsignalClient ();
166
144
$ 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
+
169
148
return $ response ;
170
149
}
171
150
172
151
/**
173
- * Delete a user authenticator
152
+ * Delete an authenticator
174
153
* @param array $params An associative array of parameters:
175
154
* - string 'userId': The userId of the user
176
155
* - string 'userAuthenticatorId': The userAuthenticatorId of the authenticator
@@ -199,6 +178,26 @@ public static function deleteAuthenticator(array $params) {
199
178
}
200
179
}
201
180
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
+
202
201
/**
203
202
* Validate Challenge
204
203
* @param array $params An associative array of parameters:
@@ -226,6 +225,25 @@ public static function validateChallenge(array $params)
226
225
return $ response ;
227
226
}
228
227
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
+
229
247
/**
230
248
* Update Action
231
249
* @param array $params An associative array of parameters:
@@ -243,22 +261,4 @@ public static function updateAction(array $params)
243
261
list ($ response , $ request ) = $ request ->send ($ path , $ params ['attributes ' ], 'patch ' );
244
262
return $ response ;
245
263
}
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
-
264
264
}
0 commit comments