Skip to content

Commit

Permalink
Change order of functions to match Node SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenclouston committed Dec 1, 2024
1 parent 32b154b commit eef447b
Showing 1 changed file with 71 additions and 71 deletions.
142 changes: 71 additions & 71 deletions lib/Authsignal/Authsignal.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,45 +63,6 @@ public static function setApiVersion($apiVersion)
self::$apiVersion = $apiVersion;
}

/**
* Track an action
*
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you are tracking the action for
* - string 'action': The action code that you are tracking
* - array 'attributes': An array of attributes to track
* @return array The authsignal response
*/
public static function track(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$action = urlencode($params['action']);
$attributes = $params['attributes'];
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}", $attributes, 'post');

return $response;
}

/**
* Get an action
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you are tracking the action for
* - string 'action': The action code that you are tracking
* - string 'idempotencyKey': The idempotency key for the action
* @return Array The authsignal response
*/
public static function getAction(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$action = urlencode($params['action']);
$idempotencyKey = urlencode($params['idempotencyKey']);
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}/{$idempotencyKey}", array(), 'get');

return $response;
}

/**
* Get a user
* @param array $params An associative array of parameters:
Expand Down Expand Up @@ -135,42 +96,60 @@ public static function updateUser(array $params)
list($response, $request) = $request->send($path, $attributes, 'post');
return $response;
}


/**
* Enroll Authenticators
* Delete a user
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you are tracking the action for
* - array 'authenticator': The authenticator object
* - string 'userId': The userId of the user you want to delete
* @return Array The authsignal response
*/
public static function enrollVerifiedAuthenticator(array $params)
public static function deleteUser(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$authenticator = $params['authenticator'];
list($response, $request) = $request->send("/users/{$userId}/authenticators", $authenticator, 'post');

$path = "/users/{$userId}";
list($response, $request) = $request->send($path, null, 'delete');
return $response;
}


/**
* Delete a user
* Get Authenticators
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you want to delete
* - string 'userId': The userId of the user whose authenticators you want to retrieve
* @return array The list of user authenticators
* @throws AuthsignalApiException if the request fails
*/
public static function getAuthenticators(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$path = "/users/{$userId}/authenticators";

list($response, $request) = $request->send($path, null, 'get');
return $response;
}


/**
* Enroll Authenticators
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you are tracking the action for
* - array 'authenticator': The authenticator object
* @return Array The authsignal response
*/
public static function deleteUser(array $params)
public static function enrollVerifiedAuthenticator(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$path = "/users/{$userId}";
list($response, $request) = $request->send($path, null, 'delete');
$authenticator = $params['authenticator'];
list($response, $request) = $request->send("/users/{$userId}/authenticators", $authenticator, 'post');

return $response;
}

/**
* Delete a user authenticator
* Delete an authenticator
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user
* - string 'userAuthenticatorId': The userAuthenticatorId of the authenticator
Expand Down Expand Up @@ -199,6 +178,26 @@ public static function deleteAuthenticator(array $params) {
}
}

/**
* Track an action
*
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you are tracking the action for
* - string 'action': The action code that you are tracking
* - array 'attributes': An array of attributes to track
* @return array The authsignal response
*/
public static function track(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$action = urlencode($params['action']);
$attributes = $params['attributes'];
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}", $attributes, 'post');

return $response;
}

/**
* Validate Challenge
* @param array $params An associative array of parameters:
Expand Down Expand Up @@ -226,6 +225,25 @@ public static function validateChallenge(array $params)
return $response;
}

/**
* Get an action
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user you are tracking the action for
* - string 'action': The action code that you are tracking
* - string 'idempotencyKey': The idempotency key for the action
* @return Array The authsignal response
*/
public static function getAction(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$action = urlencode($params['action']);
$idempotencyKey = urlencode($params['idempotencyKey']);
list($response, $request) = $request->send("/users/{$userId}/actions/{$action}/{$idempotencyKey}", array(), 'get');

return $response;
}

/**
* Update Action
* @param array $params An associative array of parameters:
Expand All @@ -243,22 +261,4 @@ public static function updateAction(array $params)
list($response, $request) = $request->send($path, $params['attributes'], 'patch');
return $response;
}

/**
* Get Authenticators
* @param array $params An associative array of parameters:
* - string 'userId': The userId of the user whose authenticators you want to retrieve
* @return array The list of user authenticators
* @throws AuthsignalApiException if the request fails
*/
public static function getAuthenticators(array $params)
{
$request = new AuthsignalClient();
$userId = urlencode($params['userId']);
$path = "/users/{$userId}/authenticators";

list($response, $request) = $request->send($path, null, 'get');
return $response;
}

}

0 comments on commit eef447b

Please sign in to comment.