Merge pull request #30 from writefreely/update-readme-with-docs

Update README with docs
This commit is contained in:
Angelo Stavrow 2021-05-27 16:20:34 -04:00 committed by GitHub
commit 4557b4dbc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 2398 additions and 880 deletions

View File

@ -1,5 +1,8 @@
# WriteFreely
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fwritefreely%2Fwritefreely-swift%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/writefreely/writefreely-swift)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fwritefreely%2Fwritefreely-swift%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/writefreely/writefreely-swift)
A Swift package that wraps the [WriteFreely](https://writefreely.org) API, for use in your Swift projects.
## Getting Started
@ -13,8 +16,7 @@ You'll need Xcode 11.5 / Swift 5.2 installed along with the command line tools t
Additionally, documentation is generated by [SwiftDoc](https://github.com/SwiftDocOrg/swift-doc). After making any changes to the package's public API, you'll need to regenerate the docs; to do so, run the following commands in the terminal from the root directory of the package:
```bash
$ rm -rf .build/documentation
$ swift doc generate Sources --module-name WriteFreely
$ swift doc generate Sources --module-name WriteFreely --format html --output ./docs
```
### Installing
@ -24,7 +26,12 @@ $ swift doc generate Sources --module-name WriteFreely
## Running the tests
TK
Run the tests from the command line:
```bash
$ swift build
$ swift test
```
## Deployment
@ -42,21 +49,20 @@ Once you've done that, just import the library into whichever files should consu
Use public methods on the `WFClient` to send and receive data from the server. The methods leverage completion blocks and the `Result` type, so you'd call them like so:
```swift
func loginHandler(result: (Result<WFUser, Error>)) {
do {
let user = try result.get()
print("Hello, \(user.username)!")
} catch {
print(error)
}
}
guard let instanceURL = URL(string: "https://your.writefreely.host/") else { fatalError() }
let client = WFClient(for: instanceURL)
client.login(username: "username", password: "password", completion: loginHandler)
client.login(username: "username", password: "password", completion: { result in
switch(result) {
case .success():
// Do something with the returned WFUser
case .failure():
// Do something with the returned WFError
}
})
```
See [the API documentation](https://developers.write.as/docs/api/?swift) for more details. Xcode-specific documentation is also available [here](https://writefreely.github.io/writefreely-swift/).
## Contributing
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

View File

@ -1,18 +0,0 @@
# Types
- [WFClient](/WFClient)
- [WFError](/WFError)
- [WFCollection](/WFCollection)
- [WFPost](/WFPost)
- [WFUser](/WFUser)
# Protocols
- [URLSessionProtocol](/URLSessionProtocol):
Define requirements for `URLSession`s here for dependency-injection purposes (specifically, for testing).
- [URLSessionDataTaskProtocol](/URLSessionDataTaskProtocol):
Define requirements for `URLSessionDataTask`s here for dependency-injection purposes (specifically, for testing).
# Extensions
- [URLSession](/URLSession)

View File

@ -1,12 +0,0 @@
# Extensions on URLSession
## Methods
### `dataTask(with:completionHandler:)`
``` swift
public func dataTask(
with request: URLRequest,
completionHandler: @escaping DataTaskResult
) -> URLSessionDataTaskProtocol
```

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - URLSession</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#methods">Methods</a><ul><li class="function"><a href="#urlsession.datatask(with:completionhandler:)">dataTask(with:completionHandler:)</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Extensions on</small>
<code class="name">URLSession</code>
</h1>
<section id="methods">
<h2>Methods</h2>
<div role="article" class="function" id="urlsession.datatask(with:completionhandler:)">
<h3>
<code>dataTask(with:completionHandler:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">func</span> <span class="function">dataTask</span>(
<span class="variable">with</span> <span class="variable">request</span>: <span class="type">URLRequest</span>,
<span class="variable">completionHandler</span>: <span class="attribute">@</span><span class="attribute">escaping</span> <span class="type">DataTaskResult</span>
) -&gt; <span class="type">URLSessionDataTaskProtocol</span> </code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:27-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1,15 +0,0 @@
# URLSessionDataTaskProtocol
Define requirements for `URLSessionDataTask`s here for dependency-injection purposes (specifically, for testing).
``` swift
public protocol URLSessionDataTaskProtocol
```
## Requirements
### resume()
``` swift
func resume()
```

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - URLSessionDataTaskProtocol</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#requirements">Requirements</a><ul><li class="function"><a href="#urlsessiondatataskprotocol.resume()">resume()</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Protocol</small>
<code class="name">URLSessionDataTaskProtocol</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">protocol</span> <span class="type">URLSessionDataTaskProtocol</span> </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Define requirements for <code>URLSessionDataTask</code>s here for dependency-injection purposes (specifically, for testing).</p>
</div>
<section id="requirements">
<h2>Requirements</h2>
<div role="article" class="function" id="urlsessiondatataskprotocol.resume()">
<h3>
<code>resume()</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">func</span> <span class="function">resume</span>()</code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:27-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1,21 +0,0 @@
# URLSessionProtocol
Define requirements for `URLSession`s here for dependency-injection purposes (specifically, for testing).
``` swift
public protocol URLSessionProtocol
```
## Requirements
### DataTaskResult
``` swift
typealias DataTaskResult = (Data?, URLResponse?, Error?) -> Void
```
### dataTask(with:completionHandler:)
``` swift
func dataTask(with request: URLRequest, completionHandler: @escaping DataTaskResult) -> URLSessionDataTaskProtocol
```

View File

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - URLSessionProtocol</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#requirements">Requirements</a><ul><li class="typealias"><a href="#urlsessionprotocol.datataskresult">DataTaskResult</a></li><li class="function"><a href="#urlsessionprotocol.datatask(with:completionhandler:)">dataTask(with:completionHandler:)</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Protocol</small>
<code class="name">URLSessionProtocol</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">protocol</span> <span class="type">URLSessionProtocol</span> </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Define requirements for <code>URLSession</code>s here for dependency-injection purposes (specifically, for testing).</p>
</div>
<section id="requirements">
<h2>Requirements</h2>
<div role="article" class="typealias" id="urlsessionprotocol.datataskresult">
<h3>
<code>DataTaskResult</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">typealias</span> <span class="variable">DataTaskResult</span> = (<span class="type">Data</span>?, <span class="type">URLResponse</span>?, <span class="type">Error</span>?) -&gt; <span class="type">Void</span></code></pre>
</div>
</div>
<div role="article" class="function" id="urlsessionprotocol.datatask(with:completionhandler:)">
<h3>
<code>dataTask(with:completionHandler:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">func</span> <span class="function">dataTask</span>(<span class="variable">with</span> <span class="variable">request</span>: <span class="type">URLRequest</span>, <span class="variable">completionHandler</span>: <span class="attribute">@</span><span class="attribute">escaping</span> <span class="type">DataTaskResult</span>) -&gt; <span class="type">URLSessionDataTaskProtocol</span></code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:27-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1,373 +0,0 @@
# WFClient
``` swift
public class WFClient
```
## Initializers
### `init(for:with:)`
Initializes the WriteFreely client.
``` swift
public init(for instanceURL: URL, with session: URLSessionProtocol = URLSession.shared)
```
Required for connecting to the API endpoints of a WriteFreely instance.
#### Parameters
- instanceURL: The URL for the WriteFreely instance to which we're connecting, including the protocol.
- session: The URL session to use for connections; defaults to `URLSession.shared`.
## Properties
### `requestURL`
``` swift
public var requestURL: URL
```
### `user`
``` swift
public var user: WFUser?
```
## Methods
### `createCollection(token:withTitle:alias:completion:)`
Creates a new collection.
``` swift
public func createCollection(
token: String? = nil,
withTitle title: String,
alias: String? = nil,
completion: @escaping (Result<WFCollection, Error>) -> Void
)
```
If only a `title` is given, the server will generate and return an alias; in this case, clients should store
the returned `alias` for future operations.
#### Parameters
- token: The access token for the user creating the collection.
- title: The title of the new collection.
- alias: The alias of the collection.
- completion: A handler for the returned `WFCollection` on success, or `Error` on failure.
### `getCollection(token:withAlias:completion:)`
Retrieves a collection's metadata.
``` swift
public func getCollection(
token: String? = nil,
withAlias alias: String,
completion: @escaping (Result<WFCollection, Error>) -> Void
)
```
Collections can be retrieved without authentication. However, authentication is required for retrieving a
private collection or one with scheduled posts.
#### Parameters
- token: The access token for the user retrieving the collection.
- alias: The alias for the collection to be retrieved.
- completion: A handler for the returned `WFCollection` on success, or `Error` on failure.
### `deleteCollection(token:withAlias:completion:)`
Permanently deletes a collection.
``` swift
public func deleteCollection(
token: String? = nil,
withAlias alias: String,
completion: @escaping (Result<Bool, Error>) -> Void
)
```
Any posts in the collection are not deleted; rather, they are made anonymous.
#### Parameters
- token: The access token for the user deleting the collection.
- alias: The alias for the collection to be deleted.
- completion: A hander for the returned `Bool` on success, or `Error` on failure.
### `getPosts(token:in:completion:)`
Retrieves an array of posts.
``` swift
public func getPosts(
token: String? = nil,
in collectionAlias: String? = nil,
completion: @escaping (Result<[WFPost], Error>) -> Void
)
```
If the `collectionAlias` argument is provided, an array of all posts in that collection is retrieved; if
omitted, an array of all posts created by the user whose access token is provided is retrieved.
Collection posts can be retrieved without authentication; however, authentication is required for retrieving a
private collection or one with scheduled posts.
#### Parameters
- token: The access token for the user retrieving the posts.
- collectionAlias: The alias for the collection whose posts are to be retrieved.
- completion: A handler for the returned `[WFPost]` on success, or `Error` on failure.
### `movePost(token:postId:with:to:completion:)`
Moves a post to a collection.
``` swift
public func movePost(
token: String? = nil,
postId: String,
with modifyToken: String? = nil,
to collectionAlias: String?,
completion: @escaping (Result<Bool, Error>) -> Void
)
```
>
#### Parameters
- token: The access token for the user moving the post to a collection.
- postId: The ID of the post to add to the collection.
- modifyToken: The post's modify token; required if the post doesn't belong to the requesting user. If `collectionAlias` is `nil`, do not include a `modifyToken`.
- collectionAlias: The alias of the collection to which the post should be added; if `nil`, this removes the post from any collection.
- completion: A handler for the returned `Bool` on success, or `Error` on failure.
### `pinPost(token:postId:at:in:completion:)`
Pins a post to a collection.
``` swift
public func pinPost(
token: String? = nil,
postId: String,
at position: Int? = nil,
in collectionAlias: String,
completion: @escaping (Result<Bool, Error>) -> Void
)
```
Pinning a post to a collection adds it as a navigation item in the collection/blog home page header, rather
than on the blog itself. While the API endpoint can take an array of posts, this function only accepts a single
post.
#### Parameters
- token: The access token of the user pinning the post to the collection.
- postId: The ID of the post to be pinned.
- position: The numeric position in which to pin the post; if `nil`, will pin at the end of the list.
- collectionAlias: The alias of the collection to which the post should be pinned.
- completion: A handler for the `Bool` returned on success, or `Error` on failure.
### `unpinPost(token:postId:from:completion:)`
Unpins a post from a collection.
``` swift
public func unpinPost(
token: String? = nil,
postId: String,
from collectionAlias: String,
completion: @escaping (Result<Bool, Error>) -> Void
)
```
Removes the post from a navigation item and puts it back on the blog itself. While the API endpoint can take an
array of posts, this function only accepts a single post.
#### Parameters
- token: The access token of the user un-pinning the post from the collection.
- postId: The ID of the post to be un-pinned.
- collectionAlias: The alias of the collection to which the post should be un-pinned.
- completion: A handler for the `Bool` returned on success, or `Error` on failure.
### `createPost(token:post:in:completion:)`
Creates a new post.
``` swift
public func createPost(
token: String? = nil,
post: WFPost,
in collectionAlias: String? = nil,
completion: @escaping (Result<WFPost, Error>) -> Void
)
```
Creates a new post. If a `collectionAlias` is provided, the post is published to that collection; otherwise, it
is posted to the user's Drafts.
#### Parameters
- token: The access token of the user creating the post.
- post: The `WFPost` object to be published.
- collectionAlias: The collection to which the post should be published.
- completion: A handler for the `WFPost` object returned on success, or `Error` on failure.
### `getPost(token:byId:completion:)`
Retrieves a post.
``` swift
public func getPost(
token: String? = nil,
byId postId: String,
completion: @escaping (Result<WFPost, Error>) -> Void
)
```
The `WFPost` object returned may include additional data, including page views and extracted tags.
#### Parameters
- token: The access token of the user retrieving the post.
- postId: The ID of the post to be retrieved.
- completion: A handler for the `WFPost` object returned on success, or `Error` on failure.
### `getPost(token:bySlug:from:completion:)`
Retrieves a post from a collection.
``` swift
public func getPost(
token: String? = nil,
bySlug slug: String,
from collectionAlias: String,
completion: @escaping (Result<WFPost, Error>) -> Void
)
```
Collection posts can be retrieved without authentication. However, authentication is required for retrieving a
post from a private collection.
The `WFPost` object returned may include additional data, including page views and extracted tags.
#### Parameters
- token: The access token of the user retrieving the post.
- slug: The slug of the post to be retrieved.
- collectionAlias: The alias of the collection from which the post should be retrieved.
- completion: A handler for the `WFPost` object returned on success, or `Error` on failure.
### `updatePost(token:postId:updatedPost:with:completion:)`
Updates an existing post.
``` swift
public func updatePost(
token: String? = nil,
postId: String,
updatedPost: WFPost,
with modifyToken: String? = nil,
completion: @escaping (Result<WFPost, Error>) -> Void
)
```
Note that if the `updatedPost` object is provided without a title, the original post's title will be removed.
>
#### Parameters
- token: The access token for the user updating the post.
- postId: The ID of the post to be updated.
- updatedPost: The `WFPost` object with which to update the existing post.
- modifyToken: The post's modify token; required if the post doesn't belong to the requesting user.
- completion: A handler for the `WFPost` object returned on success, or `Error` on failure.
### `deletePost(token:postId:with:completion:)`
Deletes an existing post.
``` swift
public func deletePost(
token: String? = nil,
postId: String,
with modifyToken: String? = nil,
completion: @escaping (Result<Bool, Error>) -> Void
)
```
>
#### Parameters
- token: The access token for the user deleting the post.
- postId: The ID of the post to be deleted.
- modifyToken: The post's modify token; required if the post doesn't belong to the requesting user.
- completion: A handler for the `Bool` object returned on success, or `Error` on failure.
### `login(username:password:completion:)`
Logs the user in to their account on the WriteFreely instance.
``` swift
public func login(username: String, password: String, completion: @escaping (Result<WFUser, Error>) -> Void)
```
On successful login, the `WFClient`'s `user` property is set to the returned `WFUser` object; this allows
authenticated requests to be made without having to provide an access token.
It is otherwise not necessary to login the user if their access token is provided to the calling function.
#### Parameters
- username: The user's username.
- password: The user's password.
- completion: A handler for the `WFUser` object returned on success, or `Error` on failure.
### `logout(token:completion:)`
Invalidates the user's access token.
``` swift
public func logout(token: String? = nil, completion: @escaping (Result<Bool, Error>) -> Void)
```
#### Parameters
- token: The token to invalidate.
- completion: A handler for the `Bool` object returned on success, or `Error` on failure.
### `getUserData(token:completion:)`
Retrieves a user's basic data.
``` swift
public func getUserData(token: String? = nil, completion: @escaping (Result<Data, Error>) -> Void)
```
#### Parameters
- token: The access token for the user to fetch.
- completion: A handler for the `Data` object returned on success, or `Error` on failure.
### `getUserCollections(token:completion:)`
Retrieves a user's collections.
``` swift
public func getUserCollections(token: String? = nil, completion: @escaping (Result<[WFCollection], Error>) -> Void)
```
#### Parameters
- token: The access token for the user whose collections are to be retrieved.
- completion: A handler for the `[WFCollection]` object returned on success, or `Error` on failure.

1003
docs/WFClient/index.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,97 +0,0 @@
# WFCollection
``` swift
public struct WFCollection
```
## Inheritance
`Decodable`
## Initializers
### `init(title:alias:)`
Creates a basic `WFCollection` object.
``` swift
public init(title: String, alias: String?)
```
This initializer creates a bare-minimum `WFCollection` object for sending to the server; use the decoder-based
initializer to populate its other properties from the server response.
If no `alias` parameter is provided, one will be generated by the server.
#### Parameters
- title: The title to give the Collection.
- alias: The alias for the Collection.
### `init(from:)`
Creates a `WFCollection` object from the server response.
``` swift
public init(from decoder: Decoder) throws
```
Primarily used by the `WFClient` to create a `WFCollection` object from the JSON returned by the server.
#### Parameters
- decoder: The decoder to use for translating the server response to a Swift object.
#### Throws
Error thrown by the `try` attempt when decoding any given property.
## Properties
### `alias`
``` swift
public var alias: String?
```
### `title`
``` swift
public var title: String
```
### `description`
``` swift
public var description: String?
```
### `styleSheet`
``` swift
public var styleSheet: String?
```
### `isPublic`
``` swift
public var isPublic: Bool?
```
### `views`
``` swift
public var views: Int?
```
### `email`
``` swift
public var email: String?
```
### `url`
``` swift
public var url: String?
```

View File

@ -0,0 +1,254 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - WFCollection</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#relationships">Relationships</a><ul><li><a href="#relationships">Conforms To</a></li></ul></li><li><a href="#initializers">Initializers</a><ul><li class="initializer"><a href="#wfcollection.init(title:alias:)">init(title:alias:)</a></li><li class="initializer"><a href="#wfcollection.init(from:)">init(from:)</a></li></ul></li><li><a href="#properties">Properties</a><ul><li class="variable"><a href="#wfcollection.alias">alias</a></li><li class="variable"><a href="#wfcollection.title">title</a></li><li class="variable"><a href="#wfcollection.description">description</a></li><li class="variable"><a href="#wfcollection.stylesheet">styleSheet</a></li><li class="variable"><a href="#wfcollection.ispublic">isPublic</a></li><li class="variable"><a href="#wfcollection.views">views</a></li><li class="variable"><a href="#wfcollection.email">email</a></li><li class="variable"><a href="#wfcollection.url">url</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Structure</small>
<code class="name">WFCollection</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">struct</span> <span class="type">WFCollection</span> </code></pre>
</div>
<section id="relationships">
<h2 hidden>Relationships</h2>
<figure>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.47.1 (20210417.1919)
-->
<!-- Pages: 1 -->
<svg width="872pt" height="116pt"
viewBox="0.00 0.00 872.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 868,-112 868,4 -4,4"/>
<!-- WFCollection -->
<g id="node1" class="node structure current">
<title>WFCollection</title>
<g id="a_node1"><a xlink:href="/WFCollection" xlink:title="WFCollection">
<path fill="none" stroke="black" stroke-width="3" d="M528,-108C528,-108 336,-108 336,-108 330,-108 324,-102 324,-96 324,-96 324,-84 324,-84 324,-78 330,-72 336,-72 336,-72 528,-72 528,-72 534,-72 540,-78 540,-84 540,-84 540,-96 540,-96 540,-102 534,-108 528,-108"/>
<text text-anchor="middle" x="432" y="-86.3" font-family="Menlo" font-size="14.00">WFCollection</text>
</a>
</g>
</g>
<!-- Decodable -->
<g id="node2" class="node unknown">
<title>Decodable</title>
<path fill="none" stroke="black" d="M528,-36C528,-36 336,-36 336,-36 330,-36 324,-30 324,-24 324,-24 324,-12 324,-12 324,-6 330,0 336,0 336,0 528,0 528,0 534,0 540,-6 540,-12 540,-12 540,-24 540,-24 540,-30 534,-36 528,-36"/>
<text text-anchor="middle" x="432" y="-14.3" font-family="Menlo" font-size="14.00">Decodable</text>
</g>
<!-- WFCollection&#45;&gt;Decodable -->
<g id="edge1" class="edge conformsTo">
<title>WFCollection&#45;&gt;Decodable</title>
<path fill="none" stroke="black" d="M432,-71.7C432,-63.98 432,-54.71 432,-46.11"/>
<polygon fill="black" stroke="black" points="435.5,-46.1 432,-36.1 428.5,-46.1 435.5,-46.1"/>
</g>
</g>
</svg>
<figcaption hidden>Inheritance graph for WFCollection.</figcaption>
</figure>
<h3>Conforms To</h3>
<dl>
<dt class="unknown"><code>Decodable</code></dt>
</dl>
</section>
<section id="initializers">
<h2>Initializers</h2>
<div role="article" class="initializer" id="wfcollection.init(title:alias:)">
<h3>
<code>init(title:alias:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">init</span>(<span class="variable">title</span>: <span class="type">String</span>, <span class="variable">alias</span>: <span class="type">String</span>?) </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Creates a basic <code>WFCollection</code> object.</p>
</div>
<div class="discussion">
<p>This initializer creates a bare-minimum <code>WFCollection</code> object for sending to the server; use the decoder-based
initializer to populate its other properties from the server response.</p>
<p>If no <code>alias</code> parameter is provided, one will be generated by the server.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>title</th>
<td><code class="type">String</code></td>
<td><p>The title to give the Collection.</p>
</td>
</tr>
<tr>
<th>alias</th>
<td><code class="type">String?</code></td>
<td><p>The alias for the Collection.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div role="article" class="initializer" id="wfcollection.init(from:)">
<h3>
<code>init(from:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">init</span>(<span class="variable">from</span> <span class="variable">decoder</span>: <span class="type">Decoder</span>) <span class="keyword">throws</span> </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Creates a <code>WFCollection</code> object from the server response.</p>
</div>
<div class="discussion">
<p>Primarily used by the <code>WFClient</code> to create a <code>WFCollection</code> object from the JSON returned by the server.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>decoder</th>
<td><code class="type">Decoder</code></td>
<td><p>The decoder to use for translating the server response to a Swift object.</p>
</td>
</tr>
</tbody>
</table>
<h4>Throws</h4>
<p>Error thrown by the <code>try</code> attempt when decoding any given property.</p>
</div>
</section>
<section id="properties">
<h2>Properties</h2>
<div role="article" class="variable" id="wfcollection.alias">
<h3>
<code>alias</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">alias</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.title">
<h3>
<code>title</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">title</span>: <span class="type">String</span></code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.description">
<h3>
<code>description</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">description</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.stylesheet">
<h3>
<code>styleSheet</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">styleSheet</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.ispublic">
<h3>
<code>isPublic</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">isPublic</span>: <span class="type">Bool</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.views">
<h3>
<code>views</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">views</span>: <span class="type">Int</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.email">
<h3>
<code>email</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">email</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfcollection.url">
<h3>
<code>url</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">url</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:29-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1,101 +0,0 @@
# WFError
``` swift
public enum WFError: Int, Error
```
## Inheritance
`Error`, `Int`
## Enumeration Cases
### `badRequest`
``` swift
case badRequest = 400
```
### `unauthorized`
``` swift
case unauthorized = 401
```
### `forbidden`
``` swift
case forbidden = 403
```
### `notFound`
``` swift
case notFound = 404
```
### `methodNotAllowed`
``` swift
case methodNotAllowed = 405
```
### `gone`
``` swift
case gone = 410
```
### `preconditionFailed`
``` swift
case preconditionFailed = 412
```
### `tooManyRequests`
``` swift
case tooManyRequests = 429
```
### `internalServerError`
``` swift
case internalServerError = 500
```
### `badGateway`
``` swift
case badGateway = 502
```
### `serviceUnavailable`
``` swift
case serviceUnavailable = 503
```
### `unknownError`
``` swift
case unknownError = -1
```
### `couldNotComplete`
``` swift
case couldNotComplete = -2
```
### `invalidResponse`
``` swift
case invalidResponse = -3
```
### `invalidData`
``` swift
case invalidData = -4
```

237
docs/WFError/index.html Normal file
View File

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - WFError</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#relationships">Relationships</a><ul><li><a href="#relationships">Conforms To</a></li></ul></li><li><a href="#enumeration cases">Enumeration Cases</a><ul><li class="case"><a href="#wferror.badrequest">badRequest</a></li><li class="case"><a href="#wferror.unauthorized">unauthorized</a></li><li class="case"><a href="#wferror.forbidden">forbidden</a></li><li class="case"><a href="#wferror.notfound">notFound</a></li><li class="case"><a href="#wferror.methodnotallowed">methodNotAllowed</a></li><li class="case"><a href="#wferror.gone">gone</a></li><li class="case"><a href="#wferror.preconditionfailed">preconditionFailed</a></li><li class="case"><a href="#wferror.toomanyrequests">tooManyRequests</a></li><li class="case"><a href="#wferror.internalservererror">internalServerError</a></li><li class="case"><a href="#wferror.badgateway">badGateway</a></li><li class="case"><a href="#wferror.serviceunavailable">serviceUnavailable</a></li><li class="case"><a href="#wferror.unknownerror">unknownError</a></li><li class="case"><a href="#wferror.couldnotcomplete">couldNotComplete</a></li><li class="case"><a href="#wferror.invalidresponse">invalidResponse</a></li><li class="case"><a href="#wferror.invaliddata">invalidData</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Enumeration</small>
<code class="name">WFError</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">enum</span> <span class="type">WFError</span>: <span class="type">Int</span>, <span class="type">Error</span> </code></pre>
</div>
<section id="relationships">
<h2 hidden>Relationships</h2>
<figure>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.47.1 (20210417.1919)
-->
<!-- Pages: 1 -->
<svg width="872pt" height="116pt"
viewBox="0.00 0.00 872.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 868,-112 868,4 -4,4"/>
<!-- WFError -->
<g id="node1" class="node enumeration current">
<title>WFError</title>
<g id="a_node1"><a xlink:href="/WFError" xlink:title="WFError">
<path fill="none" stroke="black" stroke-width="3" d="M528,-108C528,-108 336,-108 336,-108 330,-108 324,-102 324,-96 324,-96 324,-84 324,-84 324,-78 330,-72 336,-72 336,-72 528,-72 528,-72 534,-72 540,-78 540,-84 540,-84 540,-96 540,-96 540,-102 534,-108 528,-108"/>
<text text-anchor="middle" x="432" y="-86.3" font-family="Menlo" font-size="14.00">WFError</text>
</a>
</g>
</g>
<!-- Error -->
<g id="node2" class="node unknown">
<title>Error</title>
<path fill="none" stroke="black" d="M303,-36C303,-36 111,-36 111,-36 105,-36 99,-30 99,-24 99,-24 99,-12 99,-12 99,-6 105,0 111,0 111,0 303,0 303,0 309,0 315,-6 315,-12 315,-12 315,-24 315,-24 315,-30 309,-36 303,-36"/>
<text text-anchor="middle" x="207" y="-14.3" font-family="Menlo" font-size="14.00">Error</text>
</g>
<!-- WFError&#45;&gt;Error -->
<g id="edge2" class="edge conformsTo">
<title>WFError&#45;&gt;Error</title>
<path fill="none" stroke="black" d="M377.25,-71.97C345.4,-62.06 305.08,-49.51 271.67,-39.12"/>
<polygon fill="black" stroke="black" points="272.59,-35.74 262,-36.11 270.51,-42.42 272.59,-35.74"/>
</g>
<!-- Int -->
<g id="node3" class="node unknown">
<title>Int</title>
<path fill="none" stroke="black" d="M753,-36C753,-36 561,-36 561,-36 555,-36 549,-30 549,-24 549,-24 549,-12 549,-12 549,-6 555,0 561,0 561,0 753,0 753,0 759,0 765,-6 765,-12 765,-12 765,-24 765,-24 765,-30 759,-36 753,-36"/>
<text text-anchor="middle" x="657" y="-14.3" font-family="Menlo" font-size="14.00">Int</text>
</g>
<!-- WFError&#45;&gt;Int -->
<g id="edge1" class="edge conformsTo">
<title>WFError&#45;&gt;Int</title>
<path fill="none" stroke="black" d="M486.75,-71.97C518.6,-62.06 558.92,-49.51 592.33,-39.12"/>
<polygon fill="black" stroke="black" points="593.49,-42.42 602,-36.11 591.41,-35.74 593.49,-42.42"/>
</g>
</g>
</svg>
<figcaption hidden>Inheritance graph for WFError.</figcaption>
</figure>
<h3>Conforms To</h3>
<dl>
<dt class="unknown"><code>Error</code></dt>
<dt class="unknown"><code>Int</code></dt>
</dl>
</section>
<section id="enumeration cases">
<h2>Enumeration Cases</h2>
<div role="article" class="case" id="wferror.badrequest">
<h3>
<code>badRequest</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">badRequest</span> = <span class="number literal">400</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.unauthorized">
<h3>
<code>unauthorized</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">unauthorized</span> = <span class="number literal">401</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.forbidden">
<h3>
<code>forbidden</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">forbidden</span> = <span class="number literal">403</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.notfound">
<h3>
<code>notFound</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">notFound</span> = <span class="number literal">404</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.methodnotallowed">
<h3>
<code>methodNotAllowed</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">methodNotAllowed</span> = <span class="number literal">405</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.gone">
<h3>
<code>gone</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">gone</span> = <span class="number literal">410</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.preconditionfailed">
<h3>
<code>preconditionFailed</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">preconditionFailed</span> = <span class="number literal">412</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.toomanyrequests">
<h3>
<code>tooManyRequests</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">tooManyRequests</span> = <span class="number literal">429</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.internalservererror">
<h3>
<code>internalServerError</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">internalServerError</span> = <span class="number literal">500</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.badgateway">
<h3>
<code>badGateway</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">badGateway</span> = <span class="number literal">502</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.serviceunavailable">
<h3>
<code>serviceUnavailable</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">serviceUnavailable</span> = <span class="number literal">503</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.unknownerror">
<h3>
<code>unknownError</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">unknownError</span> = -<span class="number literal">1</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.couldnotcomplete">
<h3>
<code>couldNotComplete</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">couldNotComplete</span> = -<span class="number literal">2</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.invalidresponse">
<h3>
<code>invalidResponse</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">invalidResponse</span> = -<span class="number literal">3</span></code></pre>
</div>
</div>
<div role="article" class="case" id="wferror.invaliddata">
<h3>
<code>invalidData</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">case</span> <span class="variable">invalidData</span> = -<span class="number literal">4</span></code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:29-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1,133 +0,0 @@
# WFPost
``` swift
public struct WFPost
```
## Inheritance
`Decodable`
## Initializers
### `init(body:title:appearance:language:rtl:createdDate:)`
Creates a basic `WFPost` object.
``` swift
public init(
body: String,
title: String? = nil,
appearance: String? = nil,
language: String? = nil,
rtl: Bool? = nil,
createdDate: Date? = nil
)
```
This initializer creates a bare-minimum `WFPost` object for sending to the server; use the decoder-based
initializer to populate its other properties from the server response.
Only the `body` parameter is required. If other properties are not provided, they will be generated by
the server.
#### Parameters
- body: The body text for the post.
- title: The title for the post.
- appearance: The appearance for the post; one of `sans`, `serif`/`norm`, `wrap`, `mono`, or `code`. Defaults to `serif`.
- language: An ISO 639-1 language code.
- rtl: Set to `true` to show content right-to-left.
- createdDate: The published date for the post.
### `init(from:)`
Creates a `WFPost` object from the server response.
``` swift
public init(from decoder: Decoder) throws
```
Primarily used by the `WFClient` to create a `WFPost` object from the JSON returned by the server.
#### Parameters
- decoder: The decoder to use for translating the server response to a Swift object.
#### Throws
Error thrown by the `try` attempt when decoding any given property.
## Properties
### `postId`
``` swift
public var postId: String?
```
### `slug`
``` swift
public var slug: String?
```
### `appearance`
``` swift
public var appearance: String?
```
### `language`
``` swift
public var language: String?
```
### `rtl`
``` swift
public var rtl: Bool?
```
### `createdDate`
``` swift
public var createdDate: Date?
```
### `updatedDate`
``` swift
public var updatedDate: Date?
```
### `title`
``` swift
public var title: String?
```
### `body`
``` swift
public var body: String
```
### `tags`
``` swift
public var tags: [String]?
```
### `views`
``` swift
public var views: Int?
```
### `collectionAlias`
``` swift
public var collectionAlias: String?
```

318
docs/WFPost/index.html Normal file
View File

@ -0,0 +1,318 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - WFPost</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#relationships">Relationships</a><ul><li><a href="#relationships">Conforms To</a></li></ul></li><li><a href="#initializers">Initializers</a><ul><li class="initializer"><a href="#wfpost.init(body:title:appearance:language:rtl:createddate:)">init(body:title:appearance:language:rtl:createdDate:)</a></li><li class="initializer"><a href="#wfpost.init(from:)">init(from:)</a></li></ul></li><li><a href="#properties">Properties</a><ul><li class="variable"><a href="#wfpost.postid">postId</a></li><li class="variable"><a href="#wfpost.slug">slug</a></li><li class="variable"><a href="#wfpost.appearance">appearance</a></li><li class="variable"><a href="#wfpost.language">language</a></li><li class="variable"><a href="#wfpost.rtl">rtl</a></li><li class="variable"><a href="#wfpost.createddate">createdDate</a></li><li class="variable"><a href="#wfpost.updateddate">updatedDate</a></li><li class="variable"><a href="#wfpost.title">title</a></li><li class="variable"><a href="#wfpost.body">body</a></li><li class="variable"><a href="#wfpost.tags">tags</a></li><li class="variable"><a href="#wfpost.views">views</a></li><li class="variable"><a href="#wfpost.collectionalias">collectionAlias</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Structure</small>
<code class="name">WFPost</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">struct</span> <span class="type">WFPost</span> </code></pre>
</div>
<section id="relationships">
<h2 hidden>Relationships</h2>
<figure>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.47.1 (20210417.1919)
-->
<!-- Pages: 1 -->
<svg width="872pt" height="116pt"
viewBox="0.00 0.00 872.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 868,-112 868,4 -4,4"/>
<!-- WFPost -->
<g id="node1" class="node structure current">
<title>WFPost</title>
<g id="a_node1"><a xlink:href="/WFPost" xlink:title="WFPost">
<path fill="none" stroke="black" stroke-width="3" d="M528,-108C528,-108 336,-108 336,-108 330,-108 324,-102 324,-96 324,-96 324,-84 324,-84 324,-78 330,-72 336,-72 336,-72 528,-72 528,-72 534,-72 540,-78 540,-84 540,-84 540,-96 540,-96 540,-102 534,-108 528,-108"/>
<text text-anchor="middle" x="432" y="-86.3" font-family="Menlo" font-size="14.00">WFPost</text>
</a>
</g>
</g>
<!-- Decodable -->
<g id="node2" class="node unknown">
<title>Decodable</title>
<path fill="none" stroke="black" d="M528,-36C528,-36 336,-36 336,-36 330,-36 324,-30 324,-24 324,-24 324,-12 324,-12 324,-6 330,0 336,0 336,0 528,0 528,0 534,0 540,-6 540,-12 540,-12 540,-24 540,-24 540,-30 534,-36 528,-36"/>
<text text-anchor="middle" x="432" y="-14.3" font-family="Menlo" font-size="14.00">Decodable</text>
</g>
<!-- WFPost&#45;&gt;Decodable -->
<g id="edge1" class="edge conformsTo">
<title>WFPost&#45;&gt;Decodable</title>
<path fill="none" stroke="black" d="M432,-71.7C432,-63.98 432,-54.71 432,-46.11"/>
<polygon fill="black" stroke="black" points="435.5,-46.1 432,-36.1 428.5,-46.1 435.5,-46.1"/>
</g>
</g>
</svg>
<figcaption hidden>Inheritance graph for WFPost.</figcaption>
</figure>
<h3>Conforms To</h3>
<dl>
<dt class="unknown"><code>Decodable</code></dt>
</dl>
</section>
<section id="initializers">
<h2>Initializers</h2>
<div role="article" class="initializer" id="wfpost.init(body:title:appearance:language:rtl:createddate:)">
<h3>
<code>init(body:title:appearance:language:rtl:createdDate:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">init</span>(
<span class="variable">body</span>: <span class="type">String</span>,
<span class="variable">title</span>: <span class="type">String</span>? = <span class="keyword">nil</span>,
<span class="variable">appearance</span>: <span class="type">String</span>? = <span class="keyword">nil</span>,
<span class="variable">language</span>: <span class="type">String</span>? = <span class="keyword">nil</span>,
<span class="variable">rtl</span>: <span class="type">Bool</span>? = <span class="keyword">nil</span>,
<span class="variable">createdDate</span>: <span class="type">Date</span>? = <span class="keyword">nil</span>
) </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Creates a basic <code>WFPost</code> object.</p>
</div>
<div class="discussion">
<p>This initializer creates a bare-minimum <code>WFPost</code> object for sending to the server; use the decoder-based
initializer to populate its other properties from the server response.</p>
<p>Only the <code>body</code> parameter is required. If other properties are not provided, they will be generated by
the server.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>body</th>
<td><code class="type">String</code></td>
<td><p>The body text for the post.</p>
</td>
</tr>
<tr>
<th>title</th>
<td><code class="type">String?</code></td>
<td><p>The title for the post.</p>
</td>
</tr>
<tr>
<th>appearance</th>
<td><code class="type">String?</code></td>
<td><p>The appearance for the post; one of <code>sans</code>, <code>serif</code>/<code>norm</code>, <code>wrap</code>, <code>mono</code>, or <code>code</code>. Defaults to <code>serif</code>.</p>
</td>
</tr>
<tr>
<th>language</th>
<td><code class="type">String?</code></td>
<td><p>An ISO 639-1 language code.</p>
</td>
</tr>
<tr>
<th>rtl</th>
<td><code class="type">Bool?</code></td>
<td><p>Set to <code>true</code> to show content right-to-left.</p>
</td>
</tr>
<tr>
<th>createdDate</th>
<td><code class="type">Date?</code></td>
<td><p>The published date for the post.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div role="article" class="initializer" id="wfpost.init(from:)">
<h3>
<code>init(from:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">init</span>(<span class="variable">from</span> <span class="variable">decoder</span>: <span class="type">Decoder</span>) <span class="keyword">throws</span> </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Creates a <code>WFPost</code> object from the server response.</p>
</div>
<div class="discussion">
<p>Primarily used by the <code>WFClient</code> to create a <code>WFPost</code> object from the JSON returned by the server.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>decoder</th>
<td><code class="type">Decoder</code></td>
<td><p>The decoder to use for translating the server response to a Swift object.</p>
</td>
</tr>
</tbody>
</table>
<h4>Throws</h4>
<p>Error thrown by the <code>try</code> attempt when decoding any given property.</p>
</div>
</section>
<section id="properties">
<h2>Properties</h2>
<div role="article" class="variable" id="wfpost.postid">
<h3>
<code>postId</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">postId</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.slug">
<h3>
<code>slug</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">slug</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.appearance">
<h3>
<code>appearance</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">appearance</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.language">
<h3>
<code>language</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">language</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.rtl">
<h3>
<code>rtl</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">rtl</span>: <span class="type">Bool</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.createddate">
<h3>
<code>createdDate</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">createdDate</span>: <span class="type">Date</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.updateddate">
<h3>
<code>updatedDate</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">updatedDate</span>: <span class="type">Date</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.title">
<h3>
<code>title</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">title</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.body">
<h3>
<code>body</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">body</span>: <span class="type">String</span></code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.tags">
<h3>
<code>tags</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">tags</span>: [<span class="type">String</span>]?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.views">
<h3>
<code>views</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">views</span>: <span class="type">Int</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfpost.collectionalias">
<h3>
<code>collectionAlias</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">collectionAlias</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:29-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1,70 +0,0 @@
# WFUser
``` swift
public struct WFUser
```
## Inheritance
`Decodable`
## Initializers
### `init(token:username:)`
Creates a minimum `WFUser` object from a stored token.
``` swift
public init(token: String, username: String?)
```
Use this when the client has already logged in a user and only needs to reconstruct the type from saved properties.
#### Parameters
- token: The user's access token
- username: The user's username (optional)
### `init(from:)`
Creates a `WFUser` object from the server response.
``` swift
public init(from decoder: Decoder) throws
```
Primarily used by the `WFClient` to create a `WFUser` object from the JSON returned by the server.
#### Parameters
- decoder: The decoder to use for translating the server response to a Swift object.
#### Throws
Error thrown by the `try` attempt when decoding any given property.
## Properties
### `token`
``` swift
public var token: String
```
### `username`
``` swift
public var username: String?
```
### `email`
``` swift
public var email: String?
```
### `createdDate`
``` swift
public var createdDate: Date?
```

219
docs/WFUser/index.html Normal file
View File

@ -0,0 +1,219 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - WFUser</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#relationships">Relationships</a><ul><li><a href="#relationships">Conforms To</a></li></ul></li><li><a href="#initializers">Initializers</a><ul><li class="initializer"><a href="#wfuser.init(token:username:)">init(token:username:)</a></li><li class="initializer"><a href="#wfuser.init(from:)">init(from:)</a></li></ul></li><li><a href="#properties">Properties</a><ul><li class="variable"><a href="#wfuser.token">token</a></li><li class="variable"><a href="#wfuser.username">username</a></li><li class="variable"><a href="#wfuser.email">email</a></li><li class="variable"><a href="#wfuser.createddate">createdDate</a></li></ul></li></ol>
</div>
</nav>
<main>
<article>
<h1>
<small>Structure</small>
<code class="name">WFUser</code>
</h1>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">struct</span> <span class="type">WFUser</span> </code></pre>
</div>
<section id="relationships">
<h2 hidden>Relationships</h2>
<figure>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.47.1 (20210417.1919)
-->
<!-- Pages: 1 -->
<svg width="872pt" height="116pt"
viewBox="0.00 0.00 872.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 868,-112 868,4 -4,4"/>
<!-- WFUser -->
<g id="node1" class="node structure current">
<title>WFUser</title>
<g id="a_node1"><a xlink:href="/WFUser" xlink:title="WFUser">
<path fill="none" stroke="black" stroke-width="3" d="M528,-108C528,-108 336,-108 336,-108 330,-108 324,-102 324,-96 324,-96 324,-84 324,-84 324,-78 330,-72 336,-72 336,-72 528,-72 528,-72 534,-72 540,-78 540,-84 540,-84 540,-96 540,-96 540,-102 534,-108 528,-108"/>
<text text-anchor="middle" x="432" y="-86.3" font-family="Menlo" font-size="14.00">WFUser</text>
</a>
</g>
</g>
<!-- Decodable -->
<g id="node2" class="node unknown">
<title>Decodable</title>
<path fill="none" stroke="black" d="M528,-36C528,-36 336,-36 336,-36 330,-36 324,-30 324,-24 324,-24 324,-12 324,-12 324,-6 330,0 336,0 336,0 528,0 528,0 534,0 540,-6 540,-12 540,-12 540,-24 540,-24 540,-30 534,-36 528,-36"/>
<text text-anchor="middle" x="432" y="-14.3" font-family="Menlo" font-size="14.00">Decodable</text>
</g>
<!-- WFUser&#45;&gt;Decodable -->
<g id="edge1" class="edge conformsTo">
<title>WFUser&#45;&gt;Decodable</title>
<path fill="none" stroke="black" d="M432,-71.7C432,-63.98 432,-54.71 432,-46.11"/>
<polygon fill="black" stroke="black" points="435.5,-46.1 432,-36.1 428.5,-46.1 435.5,-46.1"/>
</g>
</g>
</svg>
<figcaption hidden>Inheritance graph for WFUser.</figcaption>
</figure>
<h3>Conforms To</h3>
<dl>
<dt class="unknown"><code>Decodable</code></dt>
</dl>
</section>
<section id="initializers">
<h2>Initializers</h2>
<div role="article" class="initializer" id="wfuser.init(token:username:)">
<h3>
<code>init(token:username:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">init</span>(<span class="variable">token</span>: <span class="type">String</span>, <span class="variable">username</span>: <span class="type">String</span>?) </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Creates a minimum <code>WFUser</code> object from a stored token.</p>
</div>
<div class="discussion">
<p>Use this when the client has already logged in a user and only needs to reconstruct the type from saved properties.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>token</th>
<td><code class="type">String</code></td>
<td><p>The user's access token</p>
</td>
</tr>
<tr>
<th>username</th>
<td><code class="type">String?</code></td>
<td><p>The user's username (optional)</p>
</td>
</tr>
</tbody>
</table>
</div>
<div role="article" class="initializer" id="wfuser.init(from:)">
<h3>
<code>init(from:)</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">init</span>(<span class="variable">from</span> <span class="variable">decoder</span>: <span class="type">Decoder</span>) <span class="keyword">throws</span> </code></pre>
</div>
<div class="summary" role="doc-abstract">
<p>Creates a <code>WFUser</code> object from the server response.</p>
</div>
<div class="discussion">
<p>Primarily used by the <code>WFClient</code> to create a <code>WFUser</code> object from the JSON returned by the server.</p>
</div>
<h4>Parameters</h4>
<table class="parameters">
<thead hidden>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th>decoder</th>
<td><code class="type">Decoder</code></td>
<td><p>The decoder to use for translating the server response to a Swift object.</p>
</td>
</tr>
</tbody>
</table>
<h4>Throws</h4>
<p>Error thrown by the <code>try</code> attempt when decoding any given property.</p>
</div>
</section>
<section id="properties">
<h2>Properties</h2>
<div role="article" class="variable" id="wfuser.token">
<h3>
<code>token</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">token</span>: <span class="type">String</span></code></pre>
</div>
</div>
<div role="article" class="variable" id="wfuser.username">
<h3>
<code>username</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">username</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfuser.email">
<h3>
<code>email</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">email</span>: <span class="type">String</span>?</code></pre>
</div>
</div>
<div role="article" class="variable" id="wfuser.createddate">
<h3>
<code>createdDate</code>
</h3>
<div class="declaration">
<pre class="highlight"><code><span class="keyword">public</span> <span class="keyword">var</span> <span class="variable">createdDate</span>: <span class="type">Date</span>?</code></pre>
</div>
</div>
</section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:29-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>

View File

@ -1 +0,0 @@
Generated at 2021-05-20T16:27:37-0400 using [swift-doc](https://github.com/SwiftDocOrg/swift-doc) 1.0.0-beta.6.

View File

@ -1,25 +0,0 @@
<details>
<summary>Types</summary>
- [WFClient](/WFClient)
- [WFCollection](/WFCollection)
- [WFError](/WFError)
- [WFPost](/WFPost)
- [WFUser](/WFUser)
</details>
<details>
<summary>Protocols</summary>
- [URLSessionDataTaskProtocol](/URLSessionDataTaskProtocol)
- [URLSessionProtocol](/URLSessionProtocol)
</details>
<details>
<summary>Extensions</summary>
- [URLSession](/URLSession)
</details>

1
docs/all.css Normal file

File diff suppressed because one or more lines are too long

131
docs/index.html Normal file
View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WriteFreely - WriteFreely</title>
<link rel="stylesheet" type="text/css" href="/all.css" media="all" />
</head>
<body>
<header>
<a href="/">
<strong>
WriteFreely
</strong>
<span>Documentation</span>
</a>
<sup>Beta</sup>
</header>
<!--
<form class="search">
<input type="search" placeholder="Search" />
</form>
-->
<nav>
<div class="wrapper">
<h2>On This Page</h2>
<ol><li><a href="#classes">Classes</a></li><li><a href="#structures">Structures</a></li><li><a href="#enumerations">Enumerations</a></li><li><a href="#protocols">Protocols</a></li><li><a href="#extensions">Extensions</a></li></ol>
</div>
</nav>
<main>
<article>
<section id="classes">
<h2>Classes</h2>
<dl>
<dt class="class">
<a href="/WFClient" title="class - WFClient">
WFClient
</a>
</dt>
<dd>
</dd>
</dl>
</section>
<section id="structures">
<h2>Structures</h2>
<dl>
<dt class="structure">
<a href="/WFCollection" title="structure - WFCollection">
WFCollection
</a>
</dt>
<dd>
</dd>
<dt class="structure">
<a href="/WFPost" title="structure - WFPost">
WFPost
</a>
</dt>
<dd>
</dd>
<dt class="structure">
<a href="/WFUser" title="structure - WFUser">
WFUser
</a>
</dt>
<dd>
</dd>
</dl>
</section>
<section id="enumerations">
<h2>Enumerations</h2>
<dl>
<dt class="enumeration">
<a href="/WFError" title="enumeration - WFError">
WFError
</a>
</dt>
<dd>
</dd>
</dl>
</section>
<section id="protocols">
<h2>Protocols</h2>
<dl>
<dt class="protocol">
<a href="/URLSessionProtocol" title="protocol - URLSessionProtocol">
URLSessionProtocol
</a>
</dt>
<dd>
<p>Define requirements for <code>URLSession</code>s here for dependency-injection purposes (specifically, for testing).</p>
</dd>
<dt class="protocol">
<a href="/URLSessionDataTaskProtocol" title="protocol - URLSessionDataTaskProtocol">
URLSessionDataTaskProtocol
</a>
</dt>
<dd>
<p>Define requirements for <code>URLSessionDataTask</code>s here for dependency-injection purposes (specifically, for testing).</p>
</dd>
</dl>
</section>
<section id="extensions">
<h2>Extensions</h2>
<dl>
<dt class="extension">
<a href="/URLSession">URLSession</a>
</dt>
<dd></dd>
</dl>
<section>
</article>
</main>
<footer>
<p>
Generated on <time datetime="2021-05-27T16:04:27-0400">May 27, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-beta.6</span>.
</p>
</footer>
</body>
</html>