Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions wp_api/src/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ impl WpApiDetails {
.is_ok_and(|parsed_url| is_local_dev_environment_url(&parsed_url))
}

/// Returns the site home URL as a string.
pub fn home_url_string(&self) -> String {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be worthwhile to have a ParsedUrl variant of this that's guaranteed to be a valid URL?

Not a blocker, just for your consideration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay both ways. For the specific case of how I plan to use the new API in the app, I don't plan to parse it: the original value is stored and they will be parsed at different places where it's used.

self.home.clone()
}

/// Returns the site GMT offset.
pub fn gmt_offset(&self) -> Option<f64> {
self.gmt_offset
}

/// Returns `true` if the site has routes matching the given namespace.
pub fn has_namespace(&self, namespace: String) -> bool {
self.namespaces.contains(&namespace)
Expand Down