sidebar fixed; syntax highlighting for code; social links;

This commit is contained in:
2013-07-13 00:04:35 +02:00
parent b7c84f7711
commit 207b13c4da
5 changed files with 85 additions and 84 deletions
@@ -7,4 +7,6 @@ $lightColor: #f4f8f8;
$midColor: #d9dcdc;
$textColor: white;
$textColor: white;
$secondaryColor: #f5b64c;
@@ -4,6 +4,7 @@
{
width: 280px;
float: left;
position: fixed;
h1
{
@@ -26,4 +27,23 @@
padding: 10px 20px;
font-size: 12px;
}
}
.app-social
{
margin-top: 30px;
a
{
width: 40px;
height: 40px;
font-size: 2em;
margin-right: 10px;
color: lighten($darkColor, 15%);
&:hover
{
color: $secondaryColor;
}
}
}
+3 -3
View File
@@ -703,9 +703,9 @@
//.entypo-cc-remix:before {
// content:"\e7af"
//}
//.entypo-github:before {
// content:"\f300"
//}
.entypo-github:before {
content:"\f300"
}
//.entypo-github-circled:before {
// content:"\f301"
//}
+7 -6
View File
@@ -6,13 +6,13 @@
code[class*="language-"],
pre[class*="language-"] {
color: black;
text-shadow: 0 1px white;
color: white;
font-family: Consolas, Monaco, 'Andale Mono', monospace;
direction: ltr;
text-align: left;
white-space: pre;
//white-space: pre;
word-spacing: normal;
white-space: pre-wrap;
-moz-tab-size: 4;
-o-tab-size: 4;
@@ -22,6 +22,8 @@ pre[class*="language-"] {
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
border-radius: 4px;
font-size: 0.9em;
}
@media print {
@@ -40,7 +42,7 @@ pre[class*="language-"] {
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
background: lighten(#1f2424, 3%);
}
/* Inline code */
@@ -68,7 +70,7 @@ pre[class*="language-"] {
.token.tag,
.token.boolean,
.token.number {
color: #905;
color: lighten(#905, 10%);
}
.token.selector,
@@ -83,7 +85,6 @@ pre[class*="language-"] {
.language-css .token.string,
.style .token.string {
color: #a67f59;
background: hsla(0,0%,100%,.5);
}
.token.atrule,
+52 -74
View File
@@ -37,48 +37,41 @@
<div class="app-nuget">
<code>Install-Package PocketSharp</code>
</div>
<div class="app-social">
<a href="https://github.com/ceee/PocketSharp"><i class="entypo-github"></i></a>
<a href="https://twitter.com/artistandsocial"><i class="entypo-twitter"></i></a>
</div>
</aside>
<div class="app-main">
<nav class="app-nav">
<a href="/" class="is-active">Getting Started</a>
<a href="/methods.html">Methods</a>
<a href="https://github.com/ceee/PocketSharp">Github</a>
<a href="#gettingstarted" class="is-active">Getting Started</a>
<a href="#authentication">Authentication</a>
<a href="#retrieve">Retrieve</a>
<a href="#add">Add</a>
<a href="#modify">Modify</a>
</nav>
<article class="article">
<p>PocketSharp and consists of 4 parts:</p>
<ul>
<li>Authentication</li>
<li>Retrieve</li>
<li>Modify</li>
<li>Add</li>
</ul>
<hr />
<p><em>If you don't know <a href="http://getpocket.com">Pocket</a>, be sure to check it out. It's an awesome service that lets you save articles, videos, ... in the cloud and access it from all your devices.</em></p>
<hr />
<h2>Usage Example</h2>
<h2 id="gettingstarted">Getting Started</h2>
<p>Request a <a href="http://getpocket.com/developer/apps/">Consumer Key on Pocket.</a></p>
<p>Include the PocketSharp namespace and it's associated models (you will need them later):</p>
<p>
<code>csharp
using PocketSharp;
using PocketSharp.Models;</code>
<pre class="language-clike"><code>using PocketSharp;
using PocketSharp.Models;</code></pre>
</p>
<p>Initialize PocketClient with:</p>
<p>
<code>csharp
PocketClient _client = new PocketClient(&quot;[YOUR_CONSUMER_KEY]&quot;, &quot;[YOUR_ACCESS_CODE]&quot;);</code>
<pre class="language-clike"><code>PocketClient _client = new PocketClient(&quot;[YOUR_CONSUMER_KEY]&quot;, &quot;[YOUR_ACCESS_CODE]&quot;);</code></pre>
</p>
<p>Do a simple request - e.g. a search for <code>CSS</code>:</p>
<p>
<code>csharp
_client.Search(&quot;css&quot;).ForEach(
<pre class="language-clike"><code>_client.Search(&quot;css&quot;).ForEach(
item =&gt; Console.WriteLine(item.ID + &quot; | &quot; + item.Title)
);</code>
);</code></pre>
</p>
<p>Which will output:</p>
<pre><code>330361896 | CSS Front-end Frameworks with comparison : By usabli.ca
<pre class="language-markup"><code>330361896 | CSS Front-end Frameworks with comparison : By usabli.ca
345541438 | Editr - HTML, CSS, JavaScript playground
251743431 | CSS Architecture
343693149 | CSS3 Transitions - Thank God We Have A Specification!
@@ -88,8 +81,7 @@ _client.Search(&quot;css&quot;).ForEach(
<h2>Create an instance</h2>
<p>Constructor:</p>
<p>
<code>csharp
PocketClient(string consumerKey, string accessCode = null, Uri callbackUri = null)</code>
<pre class="language-clike"><code>PocketClient(string consumerKey, string accessCode = null, Uri callbackUri = null)</code></pre>
</p>
<p>
<code>consumerKey</code>: The API key
@@ -100,34 +92,31 @@ PocketClient(string consumerKey, string accessCode = null, Uri callbackUri = nul
</p>
<p>Example:</p>
<p>
<code>csharp
PocketClient _client = new PocketClient(
<pre class="language-clike"><code>PocketClient _client = new PocketClient(
consumerKey: &quot;123498237423498723498723&quot;,
callbackUri: new Uri(&quot;http://ceecore.com&quot;),
callbackUri: new Uri(&quot;http:&frasl;&frasl;ceecore.com&quot;),
accessCode: &quot;097809-oi987-izi8-jk98-oiuu89&quot;
);</code>
);</code></pre>
</p>
<p>You can change the <em>Access Code</em> after initialization:</p>
<p>
<code>csharp
_client.AccessCode = &quot;[YOU_ACCESS_CODE]&quot;;</code>
<pre class="language-clike"><code>_client.AccessCode = &quot;[YOU_ACCESS_CODE]&quot;;</code></pre>
</p>
<p>
<strong>Before authentication</strong> you will need to provide the <code>callbackUri</code> for authentication requests.
<br>
<strong>After authentication</strong> you will need to provide the <code>accessCode</code>.
</p>
<h2>Authentication</h2>
<h2 id="authentication">Authentication</h2>
<p>In order to communicate with a Pocket User, you will need a consumer key (which is generated by <a href="http://getpocket.com/developer/apps/">creating a new application on Pocket</a>) and an <strong>Access Code</strong>.</p>
<p>The authentication is a 3-step process:</p>
<h4>1) Generate authentication URI</h4>
<p>Receive the <strong>request code</strong> and <strong>authentication URI</strong> from the library by calling <code>string GetRequestCode()</code>:</p>
<p>
<code>csharp
string requestCode = _client.GetRequestCode();
<pre class="language-clike"><code>string requestCode = _client.GetRequestCode();
// 0f453f2d-1605-8584-28fd-39af8e
Uri authenticationUri = _client.GenerateAuthenticationUri();
// https://getpocket.com/auth/authorize?request_token=0f453f2d-1605-8584-28fd-39af8e&amp;redirect_uri=http%253a%252f%252fceecore.com</code>
// https://getpocket.com/auth/authorize?request_token=0f453f2d-1605-8584-28fd-39af8e&amp;redirect_uri=http%253a%252f%252fceecore.com</code></pre>
</p>
<p>The <em>request code</em> is stored internally, but you can also provide it as param in <code>GenerateAuthenticationUri(string requestCode = null)</code>.</p>
<h4>2) Redirect to Pocket</h4>
@@ -137,9 +126,8 @@ Uri authenticationUri = _client.GenerateAuthenticationUri();
<h4>3) Get Access Code</h4>
<p>Call <code>string GetAccessCode(string requestCode = null)</code></p>
<p>
<code>csharp
string accessCode = _client.GetAccessCode();
// fa8bfc16-69b3-4d22-7db7-84a58d</code>
<pre class="language-clike"><code>string accessCode = _client.GetAccessCode();
// fa8bfc16-69b3-4d22-7db7-84a58d</code></pre>
</p>
<p>
Again, the received <em>access code</em> is stored internally.
@@ -151,37 +139,32 @@ Note that <code>GetAccessCode</code> can only be called with an existing <em>req
<br>
Without it you would always have to redo the authentication process.
</p>
<h2>Retrieve</h2>
<h2 id="retrieve">Retrieve</h2>
<p>Get list of all items:</p>
<p>
<code>csharp
List&lt;PocketItem&gt; items = _client.Retrieve();
// equivalent to: _client.Retrieve(RetrieveFilter.All)</code>
<pre class="language-clike"><code>List&lt;PocketItem&gt; items = _client.Retrieve();
// equivalent to: _client.Retrieve(RetrieveFilter.All)</code></pre>
</p>
<p>Find items by a tag:</p>
<p>
<code>csharp
List&lt;PocketItem&gt; items = _client.SearchByTag(&quot;tutorial&quot;);</code>
<pre class="language-clike"><code>List&lt;PocketItem&gt; items = _client.SearchByTag(&quot;tutorial&quot;);</code></pre>
</p>
<p>Find items by a search string:</p>
<p>
<code>csharp
List&lt;PocketItem&gt; items = _client.Search(&quot;css&quot;);</code>
<pre class="language-clike"><code>List&lt;PocketItem&gt; items = _client.Search(&quot;css&quot;);</code></pre>
</p>
<p>Find items by a filter:</p>
<p>
<code>csharp
List&lt;PocketItem&gt; items = _client.Retrieve(RetrieveFilter.Favorite); // only favorites</code>
<pre class="language-clike"><code>List&lt;PocketItem&gt; items = _client.Retrieve(RetrieveFilter.Favorite); // only favorites</code></pre>
</p>
<p>The RetrieveFilter Enum is specified as follows:</p>
<p>
<code>csharp
enum RetrieveFilter { All, Unread, Archive, Favorite, Article, Video, Image }</code>
<pre class="language-clike"><code>enum RetrieveFilter { All, Unread, Archive, Favorite, Article, Video, Image }</code></pre>
</p>
<h4>Custom Parameters</h4>
<p>You can create a completely custom parameter list for retrieval with the POCO <code>RetrieveParameters</code>:</p>
<p>
```csharp
<pre class="language-clike"><code>
var parameters = new RetrieveParameters()
{
Count = 50,
@@ -189,72 +172,67 @@ var parameters = new RetrieveParameters()
Sort = SortEnum.oldest
...
};
List<pocketitem> items = _client.Retrieve(parameters);
</code></pre>
</p>
<p>
List<pocketitem>
items = _client.Retrieve(parameters);
```
</p>
<h2>Add</h2>
<h2 id="add">Add</h2>
<p>
Adds a new item to your pocket list.
Accepts four parameters, with <code>uri</code> being required.
</p>
<p>
<code>csharp
PocketItem Add(Uri uri, string[] tags = null, string title = null, string tweetID = null)</code>
<pre class="language-clike"><code>PocketItem Add(Uri uri, string[] tags = null, string title = null, string tweetID = null)</code></pre>
</p>
<p>Example:</p>
<p>
<code>csharp
PocketItem newItem = _client.Add(
new Uri(&quot;http://www.neowin.net/news/full-build-2013-conference-sessions-listing-revealed&quot;),
<pre class="language-clike"><code>PocketItem newItem = _client.Add(
new Uri(&quot;http:&frasl;&frasl;www.neowin.net/news/full-build-2013-conference-sessions-listing-revealed&quot;),
new string[] { &quot;microsoft&quot;, &quot;neowin&quot;, &quot;build&quot; }
);</code>
);</code></pre>
</p>
<p>The title can be included for cases where an item does not have a title, which is typical for image or PDF URLs. If Pocket detects a title from the content of the page, this parameter will be ignored.</p>
<p>If you are adding Pocket support to a Twitter client, please send along a reference to the tweet status id (with the tweetID). This allows Pocket to show the original tweet alongside the article.</p>
<h2>Modify</h2>
<h2 id="modify">Modify</h2>
<p>All Modify methods accept either the itemID (as int) or a <code>PocketItem</code> as parameter.</p>
<p>Archive the specified item:</p>
<pre><code>bool isSuccess = _client.Archive(myPocketItem);
<pre class="language-clike"><code>bool isSuccess = _client.Archive(myPocketItem);
</code></pre>
<p>Un-archive the specified item:</p>
<pre><code>bool isSuccess = _client.Unarchive(myPocketItem);
<pre class="language-clike"><code>bool isSuccess = _client.Unarchive(myPocketItem);
</code></pre>
<p>Favorites the specified item:</p>
<pre><code>bool isSuccess = _client.Favorite(myPocketItem);
<pre class="language-clike"><code>bool isSuccess = _client.Favorite(myPocketItem);
</code></pre>
<p>Un-favorites the specified item:</p>
<pre><code>bool isSuccess = _client.Unfavorite(myPocketItem);
<pre class="language-clike"><code>bool isSuccess = _client.Unfavorite(myPocketItem);
</code></pre>
<p>Deletes the specified item:</p>
<pre><code>bool isSuccess = _client.Delete(myPocketItem);
<pre class="language-clike"><code>bool isSuccess = _client.Delete(myPocketItem);
</code></pre>
<h4>Modify tags</h4>
<p>Add tags to the specified item:</p>
<pre><code>bool isSuccess = _client.AddTags(myPocketItem, new string[] { &quot;css&quot;, &quot;2013&quot; });
<pre class="language-clike"><code>bool isSuccess = _client.AddTags(myPocketItem, new string[] { &quot;css&quot;, &quot;2013&quot; });
</code></pre>
<p>Remove tags from the specified item:</p>
<pre><code>bool isSuccess = _client.RemoveTags(myPocketItem, new string[] { &quot;css&quot;, &quot;2013&quot; });
<pre class="language-clike"><code>bool isSuccess = _client.RemoveTags(myPocketItem, new string[] { &quot;css&quot;, &quot;2013&quot; });
</code></pre>
<p>Remove all tags from the specified item:</p>
<pre><code>bool isSuccess = _client.RemoveTags(myPocketItem);
<pre class="language-clike"><code>bool isSuccess = _client.RemoveTags(myPocketItem);
</code></pre>
<p>Replaces all existing tags with new ones for the specified item:</p>
<pre><code>bool isSuccess = _client.ReplaceTags(myPocketItem, new string[] { &quot;css&quot;, &quot;2013&quot; });
<pre class="language-clike"><code>bool isSuccess = _client.ReplaceTags(myPocketItem, new string[] { &quot;css&quot;, &quot;2013&quot; });
</code></pre>
<p>Renames a tag for the specified item:</p>
<pre><code>bool isSuccess = _client.RenameTag(myPocketItem, &quot;oldTagName&quot;, &quot;newTagName&quot;);
<pre class="language-clike"><code>bool isSuccess = _client.RenameTag(myPocketItem, &quot;oldTagName&quot;, &quot;newTagName&quot;);
</code></pre>
<hr />