Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions Sources/WriteFreely/WFUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ extension WFUser: Decodable {
case createdDate = "created"
}

/// Creates a minimum `WFUser` object from a stored token.
///
/// Use this when the client has already logged in a user and only needs to reconstruct the type from saved properties.
///
/// - Parameter token: The user's access token
/// - Parameter username: The user's username (optional)
public init(token: String, username: String?) {
self.token = token
if let username = username {
self.username = username
}
}

/// Creates a `WFUser` object from the server response.
///
/// Primarily used by the `WFClient` to create a `WFUser` object from the JSON returned by the server.
Expand Down
1 change: 1 addition & 0 deletions docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

- [WFClient](/WFClient)
- [WFCollection](/WFCollection)
- [WFError](/WFError)
- [WFPost](/WFPost)
- [WFUser](/WFUser)
77 changes: 77 additions & 0 deletions docs/WFError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# WFError

``` swift
public enum WFError
```

## Inheritance

`Error`, `Int`

## Enumeration Cases

### `badRequest`

``` swift
case badRequest
```

### `unauthorized`

``` swift
case unauthorized
```

### `forbidden`

``` swift
case forbidden
```

### `notFound`

``` swift
case notFound
```

### `methodNotAllowed`

``` swift
case methodNotAllowed
```

### `gone`

``` swift
case gone
```

### `preconditionFailed`

``` swift
case preconditionFailed
```

### `tooManyRequests`

``` swift
case tooManyRequests
```

### `internalServerError`

``` swift
case internalServerError
```

### `badGateway`

``` swift
case badGateway
```

### `serviceUnavailable`

``` swift
case serviceUnavailable
```
15 changes: 15 additions & 0 deletions docs/WFUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ public struct WFUser

## 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: - token: The user's access token
- username: - username: The user's username (optional)

### `init(from:)`

Creates a `WFUser` object from the server response.
Expand Down
2 changes: 1 addition & 1 deletion docs/_Footer.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Generated at 2020-08-17T10:42:50-0400 using [swift-doc](https://github.com/SwiftDocOrg/swift-doc) 1.0.0-beta.3.
Generated at 2020-08-31T10:27:33-0400 using [swift-doc](https://github.com/SwiftDocOrg/swift-doc) 1.0.0-beta.3.
1 change: 1 addition & 0 deletions docs/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

- [WFClient](/WFClient)
- [WFCollection](/WFCollection)
- [WFError](/WFError)
- [WFPost](/WFPost)
- [WFUser](/WFUser)

Expand Down