Class ApiRoutes.Auth
Routes for Auth API (/api/auth)
public static class ApiRoutes.Auth
- Inheritance
-
ApiRoutes.Auth
- Inherited Members
Fields
BasePath
Represents the base path for API endpoints, composed of the base URL and controller segment.
public const string BasePath = "api/auth"
Field Value
Remarks
Use this constant to construct endpoint URLs consistently throughout the
application. The value is formed by combining the Base and Controller segments.
ById
Represents the route segment used to identify a resource by its unique identifier in HTTP GET requests.
public const string ById = "{id}"
Field Value
Remarks
This constant is typically used in route templates to specify endpoints that operate on a single resource, such as retrieving an entity by its ID.
ByUsername
Represents the route template for accessing a resource by username.
public const string ByUsername = "by-username/{username}"
Field Value
Remarks
The template includes a {username} placeholder, which should be
replaced with the actual username when constructing the route.
ChangePassword
Represents the action name for changing a user's password.
public const string ChangePassword = "change-password"
Field Value
Remarks
This constant can be used to identify or reference the "change-password" operation in authentication workflows, routing, or authorization policies.
Controller
Specifies the route segment for authentication-related controllers.
public const string Controller = "auth"
Field Value
Remarks
Use this constant to reference the "auth" route segment when defining controller routes or endpoints related to authentication functionality. This helps ensure consistency across the application.
Register
Specifies the action name for user registration requests.
public const string Register = "register"
Field Value
Remarks
Use this constant to identify or reference the "register" action in authentication workflows or API calls, ensuring consistency across the application.
Search
Represents the string value used to identify the "search" operation.
public const string Search = "search"
Field Value
Validate
Represents the action name for validation operations.
public const string Validate = "validate"
Field Value
Remarks
Use this constant to specify the "validate" action when interacting with APIs or components that require an action identifier for validation.
Methods
ChangeUserPassword()
Gets the relative URL path for the user password change endpoint.
public static string ChangeUserPassword()
Returns
- string
A string containing the relative path to the change password API endpoint.
GetAll()
Gets the full API endpoint path for retrieving all resources.
public static string GetAll()
Returns
- string
A string containing the full path to the API endpoint used to fetch all items.
GetById(Guid)
Returns the resource path corresponding to the specified unique identifier.
public static string GetById(Guid id)
Parameters
Returns
- string
A string containing the resource path for the specified
id.
GetByUsername(string)
Returns the API endpoint URL for retrieving a resource by the specified username.
public static string GetByUsername(string username)
Parameters
usernamestringThe username to include in the endpoint URL. Cannot be
nullor empty.
Returns
- string
A string containing the full API endpoint URL with the username safely encoded.
LockAccount(string)
Generates the API endpoint URL to lock the specified user account.
public static string LockAccount(string username)
Parameters
usernamestringThe username of the account to be locked. Must not be null or empty.
Returns
- string
A string containing the relative URL for the lock operation on the specified user account.
RegisterCredentials()
Gets the relative URL path for the user registration endpoint.
public static string RegisterCredentials()
Returns
- string
A string containing the relative path to the registration endpoint.
SearchByQuery(string)
Constructs a search URL using the specified query string.
public static string SearchByQuery(string query)
Parameters
Returns
- string
A string containing the search URL with the query parameter properly URL-encoded.
UnlockAccount(string)
Generates the API endpoint URL to unlock the account associated with the specified username.
public static string UnlockAccount(string username)
Parameters
usernamestringThe username of the account to unlock. Must not be
nullor empty.
Returns
- string
A string containing the relative URL for the unlock account API endpoint for the specified user.
ValidateCredentials()
Returns the endpoint URL for validating user credentials.
public static string ValidateCredentials()
Returns
- string
A string containing the full URL to the credentials validation endpoint.