Skip to content
This repository has been archived by the owner on Oct 14, 2018. It is now read-only.

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnderGoig committed Jan 21, 2018
1 parent 7305e87 commit dd826fd
Show file tree
Hide file tree
Showing 56 changed files with 1,568 additions and 143 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -57,6 +57,7 @@
- [x] Secure access token storing, thanks to [keychain-swift](https://github.com/evgenyneu/keychain-swift).
- [x] Client-Side authentication.
- [x] 100% documented code.
- [x] Use of Swift 4 Decodable.
- [x] Up-to-date with the latest Apple technologies (Swift 4, Xcode 9, etc).

### [Upcoming features](https://github.com/AnderGoig/SwiftInstagram/projects/1)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Instagram.swift
Expand Up @@ -110,10 +110,12 @@ public class Instagram {

// MARK: - Access Token

/// Store your own authenticated access token so you don't have to use the included login authentication.
public func storeAccessToken(_ accessToken: String) -> Bool {
return keychain.set(accessToken, forKey: Keychain.accessTokenKey)
}

/// Returns the current access token.
public func retrieveAccessToken() -> String? {
return keychain.get(Keychain.accessTokenKey)
}
Expand Down
10 changes: 10 additions & 0 deletions Sources/Models/InstagramError.swift
Expand Up @@ -8,9 +8,19 @@

/// A type representing an error value that can be thrown.
public enum InstagramError: Error {

/// Error 400 on login
case badRequest

/// Error decoding JSON
case decoding(message: String)

/// Invalid API request
case invalidRequest(message: String)

/// Keychain error
case keychainError(code: OSStatus)

/// The client id or the redirect URI is missing inside the Info.plist file
case missingClientIdOrRedirectURI
}
1 change: 1 addition & 0 deletions Sources/Models/InstagramResponse.swift
Expand Up @@ -39,4 +39,5 @@ struct InstagramResponse<T: Decodable>: Decodable {
}
}

/// Dummy struct used for empty Instagram API data responses
public struct InstagramEmptyResponse: Decodable { }
12 changes: 10 additions & 2 deletions docs/API.html
Expand Up @@ -22,7 +22,7 @@
<a class="header-link" href="index.html">
SwiftInstagram Docs
</a>
(93% documented)
(100% documented)
</p>

<p class="header-col--secondary">
Expand Down Expand Up @@ -113,7 +113,15 @@
<a class="nav-group-name-link" href="Errors.html">Errors</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Errors.html#/s:14SwiftInstagram0B5ErrorO">InstagramError</a>
<a class="nav-group-task-link" href="Enums/InstagramError.html">InstagramError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Other Structs.html">Other Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Other Structs.html#/s:14SwiftInstagram0B13EmptyResponseV">InstagramEmptyResponse</a>
</li>
</ul>
</li>
Expand Down
12 changes: 10 additions & 2 deletions docs/Authentication.html
Expand Up @@ -22,7 +22,7 @@
<a class="header-link" href="index.html">
SwiftInstagram Docs
</a>
(93% documented)
(100% documented)
</p>

<p class="header-col--secondary">
Expand Down Expand Up @@ -113,7 +113,15 @@
<a class="nav-group-name-link" href="Errors.html">Errors</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Errors.html#/s:14SwiftInstagram0B5ErrorO">InstagramError</a>
<a class="nav-group-task-link" href="Enums/InstagramError.html">InstagramError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Other Structs.html">Other Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Other Structs.html#/s:14SwiftInstagram0B13EmptyResponseV">InstagramEmptyResponse</a>
</li>
</ul>
</li>
Expand Down
77 changes: 75 additions & 2 deletions docs/Classes/Instagram.html
Expand Up @@ -23,7 +23,7 @@
<a class="header-link" href="../index.html">
SwiftInstagram Docs
</a>
(93% documented)
(100% documented)
</p>

<p class="header-col--secondary">
Expand Down Expand Up @@ -114,7 +114,15 @@
<a class="nav-group-name-link" href="../Errors.html">Errors</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Errors.html#/s:14SwiftInstagram0B5ErrorO">InstagramError</a>
<a class="nav-group-task-link" href="../Enums/InstagramError.html">InstagramError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Other Structs.html">Other Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Other Structs.html#/s:14SwiftInstagram0B13EmptyResponseV">InstagramEmptyResponse</a>
</li>
</ul>
</li>
Expand Down Expand Up @@ -332,6 +340,71 @@ <h4>Declaration</h4>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Access%20Token"></a>
<a name="//apple_ref/swift/Section/Access Token" class="dashAnchor"></a>
<a href="#/Access%20Token">
<h3 class="section-name">Access Token</h3>
</a>
</div>
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:14SwiftInstagram0B0C16storeAccessTokenSbSSF"></a>
<a name="//apple_ref/swift/Method/storeAccessToken(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:14SwiftInstagram0B0C16storeAccessTokenSbSSF">storeAccessToken(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Store your own authenticated access token so you don&rsquo;t have to use the included login authentication.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">storeAccessToken</span><span class="p">(</span><span class="n">_</span> <span class="nv">accessToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:14SwiftInstagram0B0C19retrieveAccessTokenSSSgyF"></a>
<a name="//apple_ref/swift/Method/retrieveAccessToken()" class="dashAnchor"></a>
<a class="token" href="#/s:14SwiftInstagram0B0C19retrieveAccessTokenSSSgyF">retrieveAccessToken()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the current access token.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">retrieveAccessToken</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">String</span><span class="p">?</span></code></pre>

</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Comment%20Endpoints"></a>
Expand Down

0 comments on commit dd826fd

Please sign in to comment.