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
184 changes: 10 additions & 174 deletions .editorconfig

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .github/scripts/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

dotnet jb inspectcode Notion.sln -f="Text" --no-build --include="**.cs" -o=".lint/CodeWarningResults.txt"

totalLines=$(file .lint/CodeWarningResults.txt | nl | wc -l)

if [[ "$totalLines" -gt 1 ]]; then
echo "There are few linter warnings - please fix them before running the pipeline"
cat .lint/CodeWarningResults.txt
exit 1
fi
14 changes: 7 additions & 7 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- name: Restore dependencies
run: dotnet restore

# Format the output of dotnet format
- name: Add dotnet-format problem matcher
uses: xt0rted/dotnet-format-problem-matcher@v1

# Install dotnet format as a global tool
- name: Install dotnet format
- name: Install dotnet tools
run: dotnet tool restore

- name: Run Linter
run: |
dotnet tool install --global dotnet-format
dotnet format --verify-no-changes --verbosity diagnostic
sudo chmod +x ./.github/scripts/check.sh
./.github/scripts/check.sh
shell: bash

- name: Build
run: dotnet build --no-restore
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,9 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Resharper linter
.lint/

# Rider
.idea/
5 changes: 5 additions & 0 deletions Notion.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PDF/@EntryIndexedValue">PDF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JSON/@EntryIndexedValue">JSON</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URL/@EntryIndexedValue">URL</s:String></wpf:ResourceDictionary>
17 changes: 6 additions & 11 deletions Src/Notion.Client/Api/ApiEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ public static string Retrieve(string databaseId)
return $"/v1/databases/{databaseId}";
}

public static string List()
{
return "/v1/databases";
}

public static string Query(string databaseId)
{
return $"/v1/databases/{databaseId}/query";
Expand All @@ -40,9 +35,9 @@ public static string List()
}

/// <summary>
/// Get the <see cref="uri string" /> for retrieve your token's bot user.
/// Get the Uri <see cref="string" /> for retrieve your token's bot user.
/// </summary>
/// <returns>Returns a <see cref="uri string" /> retrieve your token's bot user.</returns>
/// <returns>Returns a Uri <see cref="string" /> retrieve your token's bot user.</returns>
public static string Me()
{
return "/v1/users/me";
Expand All @@ -62,10 +57,10 @@ public static string Update(string blockId)
}

/// <summary>
/// Get the <see cref="uri string" /> for deleting a block.
/// Get the Uri <see cref="string" /> for deleting a block.
/// </summary>
/// <param name="blockId">Identifier for a Notion block</param>
/// <returns>Returns a <see cref="uri string" /> for deleting a block.</returns>
/// <returns>Returns a Uri <see cref="string" /> for deleting a block.</returns>
public static string Delete(string blockId)
{
return $"/v1/blocks/{blockId}";
Expand Down Expand Up @@ -105,11 +100,11 @@ public static string UpdateProperties(string pageId)
}

/// <summary>
/// Get the <see cref="uri string" /> for retrieve page property item
/// Get the Uri <see cref="string" /> for retrieve page property item
/// </summary>
/// <param name="pageId">Identifier for a Notion Page</param>
/// <param name="propertyId">Identifier for a Notion Property</param>
/// <returns></returns>
/// <returns>Returns a Uri <see cref="string" /> for Retrieve page property item</returns>
public static string RetrievePropertyItem(string pageId, string propertyId)
{
return $"/v1/pages/{pageId}/properties/{propertyId}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class AudioUpdateBlock : UpdateBlock, IUpdateBlock
public class AudioUpdateBlock : UpdateBlock
{
[JsonProperty("audio")]
public IFileObjectInput Audio { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class BulletedListItemUpdateBlock : UpdateBlock, IUpdateBlock
public class BulletedListItemUpdateBlock : UpdateBlock
{
[JsonProperty("bulleted_list_item")]
public Info BulletedListItem { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class CalloutUpdateBlock : UpdateBlock, IUpdateBlock
public class CalloutUpdateBlock : UpdateBlock
{
[JsonProperty("callout")]
public Info Callout { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class CodeUpdateBlock : UpdateBlock, IUpdateBlock
public class CodeUpdateBlock : UpdateBlock
{
[JsonProperty("code")]
public Info Code { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class EmbedUpdateBlock : UpdateBlock, IUpdateBlock
public class EmbedUpdateBlock : UpdateBlock
{
[JsonProperty("embed")]
public Info Embed { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class EquationUpdateBlock : UpdateBlock, IUpdateBlock
public class EquationUpdateBlock : UpdateBlock
{
[JsonProperty("equation")]
public Info Equation { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class FileUpdateBlock : UpdateBlock, IUpdateBlock
public class FileUpdateBlock : UpdateBlock
{
[JsonProperty("file")]
public IFileObjectInput File { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;

namespace Notion.Client
{
public class HeadingOneUpdateBlock : UpdateBlock, IUpdateBlock
public class HeadingOneUpdateBlock : UpdateBlock
{
[JsonProperty("heading_1")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public Info Heading_1 { get; set; }

public class Info
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;

namespace Notion.Client
{
public class HeadingThreeeUpdateBlock : UpdateBlock, IUpdateBlock
public class HeadingThreeeUpdateBlock : UpdateBlock
{
[JsonProperty("heading_3")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public Info Heading_3 { get; set; }

public class Info
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;

namespace Notion.Client
{
public class HeadingTwoUpdateBlock : UpdateBlock, IUpdateBlock
public class HeadingTwoUpdateBlock : UpdateBlock
{
[JsonProperty("heading_2")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public Info Heading_2 { get; set; }

public class Info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class ImageUpdateBlock : UpdateBlock, IUpdateBlock
public class ImageUpdateBlock : UpdateBlock
{
[JsonProperty("image")]
public IFileObjectInput Image { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class LinkToPageUpdateBlock : UpdateBlock, IUpdateBlock
public class LinkToPageUpdateBlock : UpdateBlock
{
[JsonProperty("link_to_page")]
public IPageParentInput LinkToPage { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class NumberedListItemUpdateBlock : UpdateBlock, IUpdateBlock
public class NumberedListItemUpdateBlock : UpdateBlock
{
[JsonProperty("numbered_list_item")]
public Info NumberedListItem { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Newtonsoft.Json;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;

namespace Notion.Client
{
public class PDFUpdateBlock : UpdateBlock, IUpdateBlock
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class PDFUpdateBlock : UpdateBlock
{
[JsonProperty("pdf")]
public IFileObjectInput PDF { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class ParagraphUpdateBlock : UpdateBlock, IUpdateBlock
public class ParagraphUpdateBlock : UpdateBlock
{
[JsonProperty("paragraph")]
public Info Paragraph { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class QuoteUpdateBlock : UpdateBlock, IUpdateBlock
public class QuoteUpdateBlock : UpdateBlock
{
[JsonProperty("quote")]
public Info Quote { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class SyncedBlockUpdateBlock : UpdateBlock, IUpdateBlock
public class SyncedBlockUpdateBlock : UpdateBlock
{
[JsonProperty("synced_block")]
public Info SyncedBlock { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class TableRowUpdateBlock : UpdateBlock, IUpdateBlock
public class TableRowUpdateBlock : UpdateBlock
{
[JsonProperty("table_row")]
public Info TableRow { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class TableUpdateBlock : UpdateBlock, IUpdateBlock
public class TableUpdateBlock : UpdateBlock
{
[JsonProperty("table")]
public Info Table { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class TemplateUpdateBlock : UpdateBlock, IUpdateBlock
public class TemplateUpdateBlock : UpdateBlock
{
[JsonProperty("template")]
public Info Template { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class ToDoUpdateBlock : UpdateBlock, IUpdateBlock
public class ToDoUpdateBlock : UpdateBlock
{
[JsonProperty("to_do")]
public Info ToDo { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Notion.Client
{
public class ToggleUpdateBlock : UpdateBlock, IUpdateBlock
public class ToggleUpdateBlock : UpdateBlock
{
[JsonProperty("toggle")]
public Info Toggle { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class VideoUpdateBlock : UpdateBlock, IUpdateBlock
public class VideoUpdateBlock : UpdateBlock
{
[JsonProperty("video")]
public IFileObjectInput Video { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Notion.Client
using System.Diagnostics.CodeAnalysis;

namespace Notion.Client
{
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class CreateCommentResponse : Comment
{
}
Expand Down
9 changes: 0 additions & 9 deletions Src/Notion.Client/Api/Comments/ICommentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ namespace Notion.Client
{
public interface ICommentsClient
{
/// <summary>
/// Retrieves a list of un-resolved Comment objects from a page or block.
/// </summary>
/// <param name="retrieveCommentsParameters">Retrieve comments parameters</param>
/// <returns>
/// <see cref="RetrieveCommentsResponse" />
/// </returns>
Task<RetrieveCommentsResponse> Retrieve(RetrieveCommentsParameters retrieveCommentsParameters);

Task<CreateCommentResponse> Create(CreateCommentParameters createCommentParameters);
}
}
2 changes: 2 additions & 0 deletions Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

namespace Notion.Client
{
public partial class CommentsClient
{
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public async Task<RetrieveCommentsResponse> Retrieve(RetrieveCommentsParameters parameters)
{
var qp = (IRetrieveCommentsQueryParameters)parameters;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Notion.Client
using System.Diagnostics.CodeAnalysis;

namespace Notion.Client
{
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class RetrieveCommentsParameters : IRetrieveCommentsQueryParameters
{
public string BlockId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Notion.Client
using System.Diagnostics.CodeAnalysis;

namespace Notion.Client
{
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class MultiSelectOptionSchema : SelectOptionSchema
{
}
Expand Down

This file was deleted.

Loading