Class WPSiteInfo
java.lang.Object
net.ygbstudio.powerwp4j.models.entities.WPSiteInfo
Holds the site information required to interact with a WordPress site.
Stores the WordPress base URI and application-password credentials.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionWPSiteInfo(@NotNull URI wpURI, @NotNull String wpUser, @NotNull String wpAppPass) Creates site info from a WordPress base URI and credentials. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringReturns the base URL of the WordPress REST API.booleanstatic @NotNull WPSiteInfofromConfigResource(String fileName) Loads site info from a configuration resource properties file.static @NotNull WPSiteInfofromEnv()Loads site info from environment variables defined inEnvironmentScope.inthashCode()toString()Returns the WordPress application password.wpURI()Returns the WordPress base URI.wpUser()Returns the WordPress username.
-
Constructor Details
-
WPSiteInfo
public WPSiteInfo(@NotNull @NotNull URI wpURI, @NotNull @NotNull String wpUser, @NotNull @NotNull String wpAppPass) Creates site info from a WordPress base URI and credentials.- Parameters:
wpURI- URI of the WordPress site (host, scheme and port are extracted)wpUser- username for the WordPress sitewpAppPass- application password for the WordPress site
-
-
Method Details
-
apiBaseUrl
Returns the base URL of the WordPress REST API.- Returns:
- the base URL of the WordPress REST API
-
fromConfigResource
Loads site info from a configuration resource properties file.- Parameters:
fileName- name of the resource file to load properties from- Returns:
- site info loaded from the resource
- Throws:
LocalConfigurationException- if the resource is missing or required properties are absent
-
fromEnv
Loads site info from environment variables defined inEnvironmentScope.- Returns:
- site info loaded from the environment
- Throws:
LocalConfigurationException- if any required environment variable is unset
-
wpURI
Returns the WordPress base URI.- Returns:
- base URI of the WordPress site
-
wpUser
Returns the WordPress username.- Returns:
- application username
-
wpAppPass
Returns the WordPress application password.- Returns:
- application password
-
equals
-
hashCode
public int hashCode() -
toString
-