diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b06e864 --- /dev/null +++ b/.gitignore @@ -0,0 +1,212 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +## TODO: Comment the next line if you want to checkin your +## web deploy settings but do note that will include unencrypted +## passwords +#*.pubxml + +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml diff --git a/Dapplo.Confluence.PCL/Dapplo.Confluence.PCL.csproj b/Dapplo.Confluence.PCL/Dapplo.Confluence.PCL.csproj new file mode 100644 index 0000000..d55d85f --- /dev/null +++ b/Dapplo.Confluence.PCL/Dapplo.Confluence.PCL.csproj @@ -0,0 +1,54 @@ + + + + + 14.0 + Debug + AnyCPU + {437D6408-B03C-4AE2-B736-D7E9763C2B09} + Library + Properties + Dapplo.Confluence + Dapplo.Confluence + en-US + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + v5.0 + + + true + pdbonly + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + + + + + + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.PCL/Properties/AssemblyInfo.cs b/Dapplo.Confluence.PCL/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ad87caf --- /dev/null +++ b/Dapplo.Confluence.PCL/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dapplo.Confluence")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Dapplo")] +[assembly: AssemblyProduct("Dapplo.Confluence.PCL")] +[assembly: AssemblyCopyright("Copyright © Dapplo 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dapplo.Confluence.PCL/project.json b/Dapplo.Confluence.PCL/project.json new file mode 100644 index 0000000..890f9ca --- /dev/null +++ b/Dapplo.Confluence.PCL/project.json @@ -0,0 +1,19 @@ +{ + "supports": { + "net46.app": {}, + "uwp.10.0.app": {}, + "dnxcore50.app": {} + }, + "dependencies": { + "Dapplo.HttpExtensions": "0.4.22", + "Microsoft.NETCore": "5.0.0", + "Microsoft.NETCore.Portable.Compatibility": "1.0.0", + "System.ComponentModel": "4.0.0", + "System.Runtime.Serialization.Primitives": "4.0.10" + }, + "frameworks": { + "dotnet": { + "imports": "portable-net452+win81" + } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/AvatarSizes.cs b/Dapplo.Confluence.Shared/AvatarSizes.cs new file mode 100644 index 0000000..bedaf68 --- /dev/null +++ b/Dapplo.Confluence.Shared/AvatarSizes.cs @@ -0,0 +1,34 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +namespace Dapplo.Confluence +{ + /// + /// Used to specify the size for the avatar + /// + public enum AvatarSizes + { + ExtraLarge, + Small, + Medium, + Large + } +} diff --git a/Dapplo.Confluence.Shared/ConfluenceApi.cs b/Dapplo.Confluence.Shared/ConfluenceApi.cs new file mode 100644 index 0000000..a79ded1 --- /dev/null +++ b/Dapplo.Confluence.Shared/ConfluenceApi.cs @@ -0,0 +1,308 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Dapplo.HttpExtensions; +using Dapplo.Confluence.Entities; + +#endregion + +namespace Dapplo.Confluence +{ + /// + /// Confluence API, using Dapplo.HttpExtensions + /// + public class ConfluenceApi + { + /// + /// Store the specific HttpBehaviour, which contains a IHttpSettings and also some additional logic for making a + /// HttpClient which works with Confluence + /// + private readonly HttpBehaviour _behaviour; + + private string _password; + + private string _user; + + /// + /// Create the ConfluenceApi object, here the HttpClient is configured + /// + /// Base URL, e.g. https://yourConfluenceserver + /// IHttpSettings or null for default + private ConfluenceApi(Uri baseUri, IHttpSettings httpSettings) + { + if (baseUri == null) + { + throw new ArgumentNullException(nameof(baseUri)); + } + ConfluenceBaseUri = baseUri.AppendSegments("rest", "api", "2"); + + _behaviour = new HttpBehaviour + { + HttpSettings = httpSettings, + OnHttpRequestMessageCreated = (httpMessage) => + { + httpMessage?.Headers.TryAddWithoutValidation("X-Atlassian-Token", "nocheck"); + if (!string.IsNullOrEmpty(_user) && _password != null) + { + httpMessage?.SetBasicAuthorization(_user, _password); + } + return httpMessage; + } + }; + } + + /// + /// The base URI for your Confluence server + /// + public Uri ConfluenceBaseUri { get; } + + /// + /// The version of the Confluence server + /// + public string ConfluenceVersion { get; private set; } + + /// + /// The title of the Confluence server + /// + public string ServerTitle { get; private set; } + + /// + /// Set Basic Authentication for the current client + /// + /// username + /// password + public void SetBasicAuthentication(string user, string password) + { + _user = user; + _password = password; + } + + #region write + /// + /// Attach content to the specified issue + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e3035 + /// + /// + /// the content can be anything what Dapplo.HttpExtensions supports + /// CancellationToken + /// Attachment + public async Task AttachAsync(string issueKey, object content, CancellationToken cancellationToken = default(CancellationToken)) + { + _behaviour.MakeCurrent(); + var attachUri = ConfluenceBaseUri.AppendSegments("issue", issueKey, "attachments"); + return await attachUri.PostAsync(content, cancellationToken).ConfigureAwait(false); + } + #endregion + + #region Read + + /// + /// Retrieve the Avatar for the supplied avatarUrls object + /// + /// the type to return the result into. e.g. Bitmap,BitmapSource or MemoryStream + /// AvatarUrls object from User or Myself method, or a project from the projects + /// Use one of the AvatarSizes to specify the size you want to have + /// CancellationToken + /// Bitmap,BitmapSource or MemoryStream (etc) depending on TResponse + public async Task AvatarAsync(AvatarUrls avatarUrls, AvatarSizes avatarSize = AvatarSizes.ExtraLarge, CancellationToken cancellationToken = default(CancellationToken)) + where TResponse : class + { + _behaviour.MakeCurrent(); + switch (avatarSize) + { + case AvatarSizes.Small: + return await avatarUrls.Small.GetAsAsync(cancellationToken).ConfigureAwait(false); + case AvatarSizes.Medium: + return await avatarUrls.Medium.GetAsAsync(cancellationToken).ConfigureAwait(false); + case AvatarSizes.Large: + return await avatarUrls.Large.GetAsAsync(cancellationToken).ConfigureAwait(false); + case AvatarSizes.ExtraLarge: + return await avatarUrls.ExtraLarge.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + throw new ArgumentException($"Unknown avatar size: {avatarSize}", nameof(avatarSize)); + } + + /// + /// Get issue information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e4539 + /// + /// the issue key + /// CancellationToken + /// Issue + public async Task IssueAsync(string issue, CancellationToken cancellationToken = default(CancellationToken)) + { + var issueUri = ConfluenceBaseUri.AppendSegments("issue", issue); + _behaviour.MakeCurrent(); + return await issueUri.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Get currrent user information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e4253 + /// + /// CancellationToken + /// User + public async Task MyselfAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + var myselfUri = ConfluenceBaseUri.AppendSegments("myself"); + _behaviour.MakeCurrent(); + return await myselfUri.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Get projects information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e2779 + /// + /// key of the project + /// CancellationToken + /// ProjectDetails + public async Task ProjectAsync(string projectKey, CancellationToken cancellationToken = default(CancellationToken)) + { + var projectUri = ConfluenceBaseUri.AppendSegments("project", projectKey); + _behaviour.MakeCurrent(); + return await projectUri.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Get all visible projects + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e2779 + /// + /// CancellationToken + /// list of ProjectDigest + public async Task> ProjectsAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + var projectUri = ConfluenceBaseUri.AppendSegments("project"); + _behaviour.MakeCurrent(); + return await projectUri.GetAsAsync>(cancellationToken).ConfigureAwait(false); + } + + /// + /// Search for issues, with a JQL (e.g. from a filter) + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e2713 + /// + /// Confluence Query Language, like SQL, for the search + /// Maximum number of results returned, default is 20 + /// Confluence fields to include, if null a default is taken + /// CancellationToken + /// SearchResult + public async Task SearchAsync(string jql, int maxResults = 20, IList fields = null, CancellationToken cancellationToken = default(CancellationToken)) + { + _behaviour.MakeCurrent(); + var search = new Search + { + Jql = jql, + ValidateQuery = true, + MaxResults = maxResults, + Fields = fields ?? new List { "summary", "status", "assignee", "key", "project"} + }; + var searchUri = ConfluenceBaseUri.AppendSegments("search"); + return await searchUri.PostAsync(search, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get server information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e3828 + /// + /// CancellationToken + /// ServerInfo + public async Task ServerInfoAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + var serverInfoUri = ConfluenceBaseUri.AppendSegments("serverInfo"); + _behaviour.MakeCurrent(); + return await serverInfoUri.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Get user information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e5339 + /// + /// + /// CancellationToken + /// user information + public async Task UserAsync(string username, CancellationToken cancellationToken = default(CancellationToken)) + { + var userUri = ConfluenceBaseUri.AppendSegments("user").ExtendQuery("username", username); + _behaviour.MakeCurrent(); + return await userUri.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + + #endregion + + #region Initializer + + /// + /// Create the ConfluenceApi, and initialize + /// This overload is created to prevent needed a reference to Dapplo.HttpExtensions for the IHttpSettings + /// + /// Base URL, e.g. https://yourConfluenceserver + /// ConfluenceApi (in a Task) + public static async Task CreateAndInitializeAsync(Uri baseUri) + { + return await CreateAndInitializeAsync(baseUri, null); + } + + /// + /// Create the ConfluenceApi, and initialize + /// + /// Base URL, e.g. https://yourConfluenceserver + /// IHttpSettings or null for default + /// ConfluenceApi (in a Task) + public static async Task CreateAndInitializeAsync(Uri baseUri, IHttpSettings httpSettings) + { + var ConfluenceApi = new ConfluenceApi(baseUri, httpSettings); + await ConfluenceApi.InitializeAsync(); + return ConfluenceApi; + } + + /// + /// Get filter favorites + /// See: https://docs.atlassian.com/Confluence/REST/latest/#d2e1388 + /// + /// CancellationToken + /// dynamic (JsonArray) + public async Task FiltersAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + _behaviour.MakeCurrent(); + var filterFavouriteUri = ConfluenceBaseUri.AppendSegments("filter", "favourite"); + return await filterFavouriteUri.GetAsAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// This will just create a connection and retrieve the server title / Confluence version + /// + /// CancellationToken + /// Task + public async Task InitializeAsync(CancellationToken cancellationToken = default(CancellationToken)) + { + var serverInfo = await ServerInfoAsync(cancellationToken); + ServerTitle = serverInfo.ServerTitle; + ConfluenceVersion = serverInfo.Version; + } + + #endregion + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Dapplo.Confluence.Shared.projitems b/Dapplo.Confluence.Shared/Dapplo.Confluence.Shared.projitems new file mode 100644 index 0000000..61f7129 --- /dev/null +++ b/Dapplo.Confluence.Shared/Dapplo.Confluence.Shared.projitems @@ -0,0 +1,39 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 9adc9877-d20c-426d-b82d-dded453d12bd + + + Dapplo.Confluence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Dapplo.Confluence.Shared.shproj b/Dapplo.Confluence.Shared/Dapplo.Confluence.Shared.shproj new file mode 100644 index 0000000..4e6008f --- /dev/null +++ b/Dapplo.Confluence.Shared/Dapplo.Confluence.Shared.shproj @@ -0,0 +1,13 @@ + + + + 9adc9877-d20c-426d-b82d-dded453d12bd + 14.0 + + + + + + + + diff --git a/Dapplo.Confluence.Shared/Entities/Attachment.cs b/Dapplo.Confluence.Shared/Entities/Attachment.cs new file mode 100644 index 0000000..b3848a3 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Attachment.cs @@ -0,0 +1,59 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Attachment information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/attachment + /// + [DataContract] + public class Attachment : BaseProperties + { + [DataMember(Name = "author")] + public User Author { get; set; } + + [DataMember(Name = "content")] + public Uri ContentUri { get; set; } + + [DataMember(Name = "created")] + public DateTimeOffset Created { get; set; } + + [DataMember(Name = "filename")] + public User Filename { get; set; } + + [DataMember(Name = "mimeType")] + public string MimeType { get; set; } + + [DataMember(Name = "size")] + public long Size { get; set; } + + [DataMember(Name = "thumbnail")] + public Uri ThumbnailUri { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/AvatarUrls.cs b/Dapplo.Confluence.Shared/Entities/AvatarUrls.cs new file mode 100644 index 0000000..defedb0 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/AvatarUrls.cs @@ -0,0 +1,50 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Avatar information, has 16x16,24x24,32x32,48x48 Urls + /// See: Confluence project + /// + [DataContract] + public class AvatarUrls + { + [DataMember(Name = "48x48")] + public Uri ExtraLarge { get; set; } + + [DataMember(Name = "16x16")] + public Uri Small { get; set; } + + [DataMember(Name = "32x32")] + public Uri Medium { get; set; } + + [DataMember(Name = "24x24")] + public Uri Large { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/BaseProperties.cs b/Dapplo.Confluence.Shared/Entities/BaseProperties.cs new file mode 100644 index 0000000..2d193b1 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/BaseProperties.cs @@ -0,0 +1,43 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Base fields, used in pretty much every entity + /// + [DataContract] + public class BaseProperties + { + [DataMember(Name = "id")] + public string Id { get; set; } + + [DataMember(Name = "self")] + public Uri Self { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Comment.cs b/Dapplo.Confluence.Shared/Entities/Comment.cs new file mode 100644 index 0000000..a7fcc93 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Comment.cs @@ -0,0 +1,56 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Comment information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/attachment + /// + [DataContract] + public class Comment : BaseProperties + { + [DataMember(Name = "author")] + public User Author { get; set; } + + [DataMember(Name = "body")] + public string Body { get; set; } + + [DataMember(Name = "created")] + public DateTimeOffset Created { get; set; } + + [DataMember(Name = "updateAuthor")] + public User UpdateAuthor { get; set; } + + [DataMember(Name = "updated")] + public DateTimeOffset Updated { get; set; } + + [DataMember(Name = "visibility")] + public Visibility Visibility { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Component.cs b/Dapplo.Confluence.Shared/Entities/Component.cs new file mode 100644 index 0000000..0b405e6 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Component.cs @@ -0,0 +1,70 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Component information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/component + /// + [DataContract] + public class Component + { + [DataMember(Name = "assignee")] + public User Assignee { get; set; } + + [DataMember(Name = "assigneeType")] + public string AssigneeType { get; set; } + + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "id")] + public string Id { get; set; } + + [DataMember(Name = "isAssigneeTypeValid")] + public bool IsAssigneeTypeValid { get; set; } + + [DataMember(Name = "lead")] + public User Lead { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + + [DataMember(Name = "project")] + public string Project { get; set; } + + [DataMember(Name = "projectId")] + public int ProjectId { get; set; } + + [DataMember(Name = "realAssignee")] + public User RealAssignee { get; set; } + + [DataMember(Name = "realAssigneeType")] + public string RealAssigneeType { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Fields.cs b/Dapplo.Confluence.Shared/Entities/Fields.cs new file mode 100644 index 0000000..b892e48 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Fields.cs @@ -0,0 +1,107 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Container for the fields + /// + [DataContract] + public class Fields + { + [DataMember(Name = "aggregatetimespent")] + public long AggregateTimeSpent { get; set; } + + [DataMember(Name = "assignee")] + public User Assignee { get; set; } + + [DataMember(Name = "attachment")] + public IList Attachments { get; set; } + + [DataMember(Name = "comment")] + public IList Comments { get; set; } + + [DataMember(Name = "created")] + public DateTimeOffset Created { get; set; } + + [DataMember(Name = "creator")] + public User Creator { get; set; } + + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "fixVersions")] + public IList FixVersions { get; set; } + + [DataMember(Name = "versions")] + public IList Versions { get; set; } + + [DataMember(Name = "issueType")] + public IssueType IssueType { get; set; } + + [DataMember(Name = "labels")] + public IList Labels { get; set; } + + [DataMember(Name = "lastViewed")] + public DateTimeOffset LastViewed { get; set; } + + [DataMember(Name = "priority")] + public Priority Priority { get; set; } + + [DataMember(Name = "progress")] + public ProgressInfo Progress { get; set; } + + [DataMember(Name = "project")] + public Project Project { get; set; } + + [DataMember(Name = "reporter")] + public User Reporter { get; set; } + + [DataMember(Name = "resolution")] + public Resolution Resolution { get; set; } + + [DataMember(Name = "resolutiondate")] + public DateTimeOffset ResolutionData { get; set; } + + [DataMember(Name = "updated")] + public DateTimeOffset Updated { get; set; } + + [DataMember(Name = "status")] + public Status Status { get; set; } + + [DataMember(Name = "summary")] + public string Summary { get; set; } + + [DataMember(Name = "timespent")] + public long TimeSpent { get; set; } + + [DataMember(Name = "watches")] + public Watches Watches { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Issue.cs b/Dapplo.Confluence.Shared/Entities/Issue.cs new file mode 100644 index 0000000..83ff876 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Issue.cs @@ -0,0 +1,43 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Issue information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/issue + /// + [DataContract] + public class Issue : BaseProperties + { + [DataMember(Name = "fields")] + public Fields Fields { get; set; } + + [DataMember(Name = "key")] + public string Key { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/IssueType.cs b/Dapplo.Confluence.Shared/Entities/IssueType.cs new file mode 100644 index 0000000..8079f7f --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/IssueType.cs @@ -0,0 +1,52 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// IssueType information + /// + [DataContract] + public class IssueType : BaseProperties + { + [DataMember(Name = "avatarId")] + public int AvatarId { get; set; } + + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "iconUrl")] + public Uri IconUri { get; set; } + + [DataMember(Name = "subtask")] + public bool IsSubTask { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Priority.cs b/Dapplo.Confluence.Shared/Entities/Priority.cs new file mode 100644 index 0000000..340e87b --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Priority.cs @@ -0,0 +1,43 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Visibility information + /// + [DataContract] + public class Priority :BaseProperties + { + [DataMember(Name = "name")] + public string Name { get; set; } + + [DataMember(Name = "iconUrl")] + public Uri IconUrl { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/ProgressInfo.cs b/Dapplo.Confluence.Shared/Entities/ProgressInfo.cs new file mode 100644 index 0000000..4d3204a --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/ProgressInfo.cs @@ -0,0 +1,42 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Resolution information + /// + [DataContract] + public class ProgressInfo + { + [DataMember(Name = "progress")] + public long Progress { get; set; } + + [DataMember(Name = "total")] + public long Total { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Project.cs b/Dapplo.Confluence.Shared/Entities/Project.cs new file mode 100644 index 0000000..f6c5449 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Project.cs @@ -0,0 +1,63 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Project information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/project + /// + [DataContract] + public class Project : ProjectDigest + { + [DataMember(Name = "assigneeType")] + public string AssigneeType { get; set; } + + [DataMember(Name = "url")] + public Uri BrowseUrl { get; set; } + + [DataMember(Name = "projectCategory")] + public ProjectCategory Category { get; set; } + + [DataMember(Name = "components")] + public IList Components { get; set; } + + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "email")] + public string Email { get; set; } + + [DataMember(Name = "issueTypes")] + public IList IssueTypes { get; set; } + + [DataMember(Name = "lead")] + public User Lead { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/ProjectCategory.cs b/Dapplo.Confluence.Shared/Entities/ProjectCategory.cs new file mode 100644 index 0000000..47dd137 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/ProjectCategory.cs @@ -0,0 +1,45 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// ProjectCategory information + /// + [DataContract] + public class ProjectCategory + { + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "id")] + public string Id { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/ProjectDigest.cs b/Dapplo.Confluence.Shared/Entities/ProjectDigest.cs new file mode 100644 index 0000000..99e31f7 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/ProjectDigest.cs @@ -0,0 +1,49 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Project information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/project + /// + [DataContract] + public class ProjectDigest + { + [DataMember(Name = "avatarUrls")] + public AvatarUrls Avatar { get; set; } + + [DataMember(Name = "id")] + public string Id { get; set; } + + [DataMember(Name = "key")] + public string Key { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Resolution.cs b/Dapplo.Confluence.Shared/Entities/Resolution.cs new file mode 100644 index 0000000..da60037 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Resolution.cs @@ -0,0 +1,42 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Resolution information + /// + [DataContract] + public class Resolution : BaseProperties + { + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Search.cs b/Dapplo.Confluence.Shared/Entities/Search.cs new file mode 100644 index 0000000..cd1fa34 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Search.cs @@ -0,0 +1,56 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Search request information, see here + /// + [DataContract] + public class Search + { + [DataMember(Name = "expand")] + public string Expand { get; set; } + + [DataMember(Name = "startAt")] + public int StartAt { get; set; } + + [DataMember(Name = "maxResults")] + public int MaxResults { get; set; } + + [DataMember(Name = "validateQuery")] + public bool ValidateQuery { get; set; } + + [DataMember(Name = "jql")] + public string Jql { get; set; } + + [DataMember(Name = "fields")] + public IList Fields { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/SearchResult.cs b/Dapplo.Confluence.Shared/Entities/SearchResult.cs new file mode 100644 index 0000000..5492954 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/SearchResult.cs @@ -0,0 +1,53 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Search result information, see here + /// + [DataContract] + public class SearchResult + { + [DataMember(Name = "expand")] + public string Expand { get; set; } + + [DataMember(Name = "startAt")] + public int StartAt { get; set; } + + [DataMember(Name = "maxResults")] + public int MaxResults { get; set; } + + [DataMember(Name = "total")] + public int Total { get; set; } + + [DataMember(Name = "issues")] + public IList Issues { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/ServerInfo.cs b/Dapplo.Confluence.Shared/Entities/ServerInfo.cs new file mode 100644 index 0000000..95ff993 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/ServerInfo.cs @@ -0,0 +1,56 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Server Info is used for the version and title + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/serverInfo + /// + [DataContract] + public class ServerInfo + { + [DataMember(Name = "baseUrl")] + public Uri BaseUrl { get; set; } + + [DataMember(Name = "buildDate")] + public DateTimeOffset BuildDate { get; set; } + + [DataMember(Name = "buildNumber")] + public int BuildNumber { get; set; } + + [DataMember(Name = "scmInfo")] + public string ScmInfo { get; set; } + + [DataMember(Name = "serverTitle")] + public string ServerTitle { get; set; } + + [DataMember(Name = "version")] + public string Version { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Status.cs b/Dapplo.Confluence.Shared/Entities/Status.cs new file mode 100644 index 0000000..7868637 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Status.cs @@ -0,0 +1,49 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Status information + /// + [DataContract] + public class Status : BaseProperties + { + [DataMember(Name = "statusCategory")] + public StatusCategory Category { get; set; } + + [DataMember(Name = "description")] + public string Description { get; set; } + + [DataMember(Name = "iconUrl")] + public Uri IconUri { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/StatusCategory.cs b/Dapplo.Confluence.Shared/Entities/StatusCategory.cs new file mode 100644 index 0000000..ed08d6b --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/StatusCategory.cs @@ -0,0 +1,45 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// StatusCategory information + /// + [DataContract] + public class StatusCategory : BaseProperties + { + [DataMember(Name = "colorName")] + public string ColorName { get; set; } + + [DataMember(Name = "key")] + public string Key { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/User.cs b/Dapplo.Confluence.Shared/Entities/User.cs new file mode 100644 index 0000000..98ac0c4 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/User.cs @@ -0,0 +1,56 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// User information + /// See: https://docs.atlassian.com/Confluence/REST/latest/#api/2/user + /// + [DataContract] + public class User + { + [DataMember(Name = "active")] + public bool Active { get; set; } + + [DataMember(Name = "avatarUrls")] + public AvatarUrls Avatars { get; set; } + + [DataMember(Name = "displayName")] + public string DisplayName { get; set; } + + [DataMember(Name = "emailAddress")] + public string EmailAddress { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + + [DataMember(Name = "self")] + public Uri Self { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Version.cs b/Dapplo.Confluence.Shared/Entities/Version.cs new file mode 100644 index 0000000..4810bd1 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Version.cs @@ -0,0 +1,45 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Version information + /// + [DataContract] + public class Version : BaseProperties + { + [DataMember(Name = "archived")] + public bool Archived { get; set; } + + [DataMember(Name = "name")] + public string Name { get; set; } + + [DataMember(Name = "released")] + public bool Released { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Visibility.cs b/Dapplo.Confluence.Shared/Entities/Visibility.cs new file mode 100644 index 0000000..df2498e --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Visibility.cs @@ -0,0 +1,42 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Visibility information + /// + [DataContract] + public class Visibility + { + [DataMember(Name = "type")] + public string Type { get; set; } + + [DataMember(Name = "value")] + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/VoteInfo.cs b/Dapplo.Confluence.Shared/Entities/VoteInfo.cs new file mode 100644 index 0000000..7889db7 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/VoteInfo.cs @@ -0,0 +1,46 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Visibility information + /// + [DataContract] + public class VoteInfo + { + [DataMember(Name = "self")] + public Uri Self { get; set; } + + [DataMember(Name = "votest")] + public long Votes { get; set; } + + [DataMember(Name = "hasVoted")] + public bool HasVoted { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Shared/Entities/Watches.cs b/Dapplo.Confluence.Shared/Entities/Watches.cs new file mode 100644 index 0000000..153b626 --- /dev/null +++ b/Dapplo.Confluence.Shared/Entities/Watches.cs @@ -0,0 +1,50 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Confluence +// +// Dapplo.Confluence is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Confluence is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Confluence. If not, see . + +#region using + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +#endregion + +namespace Dapplo.Confluence.Entities +{ + /// + /// Container for the Watcher + /// + [DataContract] + public class Watches + { + [DataMember(Name = "self")] + public Uri Self { get; set; } + + [DataMember(Name = "isWatching")] + public bool IsWatching { get; set; } + + [DataMember(Name = "watchCount")] + public int WatchCount { get; set; } + + [DataMember(Name = "watchers")] + public IList Watchers { get; set; } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Tests/ConfluenceTests.cs b/Dapplo.Confluence.Tests/ConfluenceTests.cs new file mode 100644 index 0000000..fd43c9c --- /dev/null +++ b/Dapplo.Confluence.Tests/ConfluenceTests.cs @@ -0,0 +1,92 @@ +/* + Dapplo - building blocks for desktop applications + Copyright (C) 2015-2016 Dapplo + + For more information see: http://dapplo.net/ + Dapplo repositories are hosted on GitHub: https://github.com/dapplo + + This file is part of Dapplo.Confluence + + Dapplo.Confluence is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Dapplo.Confluence is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dapplo.Confluence. If not, see . + */ + +using Xunit; +using System; +using System.Diagnostics; +using System.Drawing; +using System.Threading.Tasks; +using Xunit.Abstractions; +using Dapplo.LogFacade; + +namespace Dapplo.Confluence.Tests +{ + public class ConfluenceTests + { + // Test against a well known Confluence + private static readonly Uri TestConfluenceUri = new Uri("https://greenshot.atlassian.net"); + + private ConfluenceApi _ConfluenceApi; + + public ConfluenceTests(ITestOutputHelper testOutputHelper) + { + XUnitLogger.RegisterLogger(testOutputHelper, LogLevel.Verbose); + } + + [Fact] + public async Task TestCreateAndInitializeAsync() + { + _ConfluenceApi = await ConfluenceApi.CreateAndInitializeAsync(TestConfluenceUri); + Assert.NotNull(_ConfluenceApi); + Assert.NotNull(_ConfluenceApi.ConfluenceVersion); + Assert.NotNull(_ConfluenceApi.ServerTitle); + // This should be changed when the title changes + Assert.Equal("Greenshot Confluence", _ConfluenceApi.ServerTitle); + Debug.WriteLine($"Version {_ConfluenceApi.ConfluenceVersion} - Title: {_ConfluenceApi.ServerTitle}"); + } + + [Fact] + public async Task TestProjectsAsync() + { + _ConfluenceApi = await ConfluenceApi.CreateAndInitializeAsync(TestConfluenceUri); + var projects = await _ConfluenceApi.ProjectsAsync(); + + Assert.NotNull(projects); + Assert.NotNull(projects.Count > 0); + + foreach (var project in projects) + { + var avatar = await _ConfluenceApi.AvatarAsync(project.Avatar, AvatarSizes.ExtraLarge); + Assert.True(avatar.Width == 48); + + var projectDetails = await _ConfluenceApi.ProjectAsync(project.Key); + Assert.NotNull(projectDetails); + } + } + + [Fact] + public async Task TestSearch() + { + _ConfluenceApi = await ConfluenceApi.CreateAndInitializeAsync(TestConfluenceUri); + var searchResult = await _ConfluenceApi.SearchAsync("text ~ \"robin\""); + + Assert.NotNull(searchResult); + Assert.NotNull(searchResult.Issues.Count > 0); + + foreach (var issue in searchResult.Issues) + { + Assert.NotNull(issue.Fields.Project); + } + } + } +} diff --git a/Dapplo.Confluence.Tests/Dapplo.Confluence.Tests.csproj b/Dapplo.Confluence.Tests/Dapplo.Confluence.Tests.csproj new file mode 100644 index 0000000..3ab9d6b --- /dev/null +++ b/Dapplo.Confluence.Tests/Dapplo.Confluence.Tests.csproj @@ -0,0 +1,105 @@ + + + + + + Debug + AnyCPU + {2119C12B-5874-4E60-BD36-45CA1D29FDDC} + Library + Properties + Dapplo.Confluence.Tests + Dapplo.Confluence.Tests + v4.6 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Dapplo.HttpExtensions.0.4.22.0\lib\net46\Dapplo.HttpExtensions.dll + True + + + ..\packages\Dapplo.LogFacade.0.2.13.0\lib\net46\Dapplo.LogFacade.dll + True + + + + + + + + + + + + ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll + True + + + ..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll + True + + + ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll + True + + + ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll + True + + + + + + + + + + + Always + + + + + + {4ae569b6-987b-4eef-936c-d60672ce861e} + Dapplo.Confluence + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.Tests/JsonParseTests.cs b/Dapplo.Confluence.Tests/JsonParseTests.cs new file mode 100644 index 0000000..6117f95 --- /dev/null +++ b/Dapplo.Confluence.Tests/JsonParseTests.cs @@ -0,0 +1,50 @@ +/* + Dapplo - building blocks for desktop applications + Copyright (C) 2015-2016 Dapplo + + For more information see: http://dapplo.net/ + Dapplo repositories are hosted on GitHub: https://github.com/dapplo + + This file is part of Dapplo.Confluence + + Dapplo.Confluence is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Dapplo.Confluence is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dapplo.Confluence. If not, see . + */ + +using Dapplo.HttpExtensions; +using Dapplo.Confluence.Entities; +using Xunit; +using System.IO; +using Xunit.Abstractions; +using Dapplo.LogFacade; + +namespace Dapplo.Confluence.Tests +{ + public class JsonParseTests + { + public JsonParseTests(ITestOutputHelper testOutputHelper) + { + XUnitLogger.RegisterLogger(testOutputHelper, LogLevel.Verbose); + } + + [Fact] + public void TestParseServerInfo() + { + var json = File.ReadAllText("JsonTestFiles/serverInfo.json"); + var serverInfo = SimpleJson.DeserializeObject(json); + Assert.NotNull(serverInfo); + Assert.Equal("http://localhost:8080/Confluence", serverInfo.BaseUrl.AbsoluteUri); + Assert.Equal("Greenshot Confluence", serverInfo.ServerTitle); + } + } +} diff --git a/Dapplo.Confluence.Tests/JsonTestFiles/serverInfo.json b/Dapplo.Confluence.Tests/JsonTestFiles/serverInfo.json new file mode 100644 index 0000000..298ecb4 --- /dev/null +++ b/Dapplo.Confluence.Tests/JsonTestFiles/serverInfo.json @@ -0,0 +1,13 @@ +{ + "baseUrl": "http://localhost:8080/Confluence", + "version": "7.0", + "versionNumbers": [ + 11, + 0, + 0 + ], + "buildNumber": 582, + "buildDate": "2016-01-08T01:45:48.856+0000", + "scmInfo": "1f51473f5c7b75c1a69a0090f4832cdc5053702a", + "serverTitle": "Greenshot Confluence" +} \ No newline at end of file diff --git a/Dapplo.Confluence.Tests/Properties/AssemblyInfo.cs b/Dapplo.Confluence.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6230627 --- /dev/null +++ b/Dapplo.Confluence.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dapplo.Confluence.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Dapplo")] +[assembly: AssemblyProduct("Dapplo.Confluence.Tests")] +[assembly: AssemblyCopyright("Copyright © Dapplo 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2119c12b-5874-4e60-bd36-45ca1d29fddc")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dapplo.Confluence.Tests/XUnitLogger.cs b/Dapplo.Confluence.Tests/XUnitLogger.cs new file mode 100644 index 0000000..45896b8 --- /dev/null +++ b/Dapplo.Confluence.Tests/XUnitLogger.cs @@ -0,0 +1,117 @@ +// Dapplo - building blocks for desktop applications +// Copyright (C) 2015-2016 Dapplo +// +// For more information see: http://dapplo.net/ +// Dapplo repositories are hosted on GitHub: https://github.com/dapplo +// +// This file is part of Dapplo.Config +// +// Dapplo.Config is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Dapplo.Config is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have Config a copy of the GNU Lesser General Public License +// along with Dapplo.Config. If not, see . + +#region using + +using System; +using System.Threading; +using Dapplo.LogFacade; +using Xunit.Abstractions; + +#endregion + +namespace Dapplo.Confluence.Tests +{ + /// + /// xUnit will have tests run parallel, and due to this it won't capture trace output correctly. + /// This is where their ITestOutputHelper comes around, but Dapplo.LogFacade can only have one logger. + /// This class solves the problem by registering the ITestOutputHelper in the CallContext. + /// Every log statement will retrieve the ITestOutputHelper from the context and use it to log. + /// + public class XUnitLogger : ILogger + { + private static readonly AsyncLocal TestOutputHelperAsyncLocal = new AsyncLocal(); + private static readonly AsyncLocal LogLevelAsyncLocal = new AsyncLocal(); + + /// + /// Prevent the constructor from being use elsewhere + /// + private XUnitLogger() + { + } + + /// + /// LogLevel, this can give a different result pro xUnit test... + /// It will depend on the RegisterLogger value which was used in the current xUnit test + /// + public LogLevel Level + { + get + { + var logLevel = LogLevelAsyncLocal.Value; + if (logLevel != LogLevel.None) + { + return logLevel; + } + return LogSettings.DefaultLevel; + } + set { LogLevelAsyncLocal.Value = value; } + } + + /// + /// If the level is enabled, this returns true + /// The level depends on what the xUnit test used in the RegisterLogger + /// + /// LogLevel + /// true if the level is enabled + public bool IsLogLevelEnabled(LogLevel level) + { + return level != LogLevel.None && level >= Level; + } + + public void Write(LogInfo logInfo, string messageTemplate, params object[] logParameters) + { + var testOutputHelper = TestOutputHelperAsyncLocal.Value; + if (testOutputHelper == null) + { + throw new ArgumentNullException(nameof(testOutputHelper), "Couldn't find a ITestOutputHelper in the CallContext"); + } + testOutputHelper.WriteLine($"{logInfo} - {messageTemplate}", logParameters); + } + + public void Write(LogInfo logInfo, Exception exception, string messageTemplate, params object[] logParameters) + { + var testOutputHelper = TestOutputHelperAsyncLocal.Value; + if (testOutputHelper == null) + { + throw new ArgumentNullException(nameof(testOutputHelper), "Couldn't find a ITestOutputHelper in the CallContext"); + } + testOutputHelper.WriteLine($"{logInfo} - {messageTemplate}", logParameters); + testOutputHelper.WriteLine(exception.ToString()); + } + + /// + /// Register the XUnitLogger, as the global LogFacade logger + /// This also places the ITestOutputHelper in the CallContext, so the output is mapped to the xUnit test + /// + /// ITestOutputHelper + /// LogLevel, when none is given the LogSettings.DefaultLevel is used + public static void RegisterLogger(ITestOutputHelper testOutputHelper, LogLevel level = default(LogLevel)) + { + TestOutputHelperAsyncLocal.Value = testOutputHelper; + LogLevelAsyncLocal.Value = level; + if (!(LogSettings.Logger is XUnitLogger)) + { + LogSettings.Logger = new XUnitLogger(); + } + } + } +} \ No newline at end of file diff --git a/Dapplo.Confluence.Tests/packages.config b/Dapplo.Confluence.Tests/packages.config new file mode 100644 index 0000000..a7afd73 --- /dev/null +++ b/Dapplo.Confluence.Tests/packages.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.WpfExample/App.config b/Dapplo.Confluence.WpfExample/App.config new file mode 100644 index 0000000..2d2a12d --- /dev/null +++ b/Dapplo.Confluence.WpfExample/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Dapplo.Confluence.WpfExample/App.xaml b/Dapplo.Confluence.WpfExample/App.xaml new file mode 100644 index 0000000..336d83c --- /dev/null +++ b/Dapplo.Confluence.WpfExample/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Dapplo.Confluence.WpfExample/App.xaml.cs b/Dapplo.Confluence.WpfExample/App.xaml.cs new file mode 100644 index 0000000..5446a80 --- /dev/null +++ b/Dapplo.Confluence.WpfExample/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Dapplo.Confluence.WpfExample +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/Dapplo.Confluence.WpfExample/Dapplo.Confluence.WpfExample.csproj b/Dapplo.Confluence.WpfExample/Dapplo.Confluence.WpfExample.csproj new file mode 100644 index 0000000..1f1876a --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Dapplo.Confluence.WpfExample.csproj @@ -0,0 +1,123 @@ + + + + + Debug + AnyCPU + {21318574-B731-40E3-BA54-0C92429B5317} + WinExe + Properties + Dapplo.Confluence.WpfExample + Dapplo.Confluence.WpfExample + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Dapplo.HttpExtensions.0.4.22.0\lib\net46\Dapplo.HttpExtensions.dll + True + + + ..\packages\Dapplo.LogFacade.0.2.13.0\lib\net46\Dapplo.LogFacade.dll + True + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + {4ae569b6-987b-4eef-936c-d60672ce861e} + Dapplo.Confluence + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.WpfExample/MainWindow.xaml b/Dapplo.Confluence.WpfExample/MainWindow.xaml new file mode 100644 index 0000000..9191ad1 --- /dev/null +++ b/Dapplo.Confluence.WpfExample/MainWindow.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + diff --git a/Dapplo.Confluence.WpfExample/MainWindow.xaml.cs b/Dapplo.Confluence.WpfExample/MainWindow.xaml.cs new file mode 100644 index 0000000..5e3dc7e --- /dev/null +++ b/Dapplo.Confluence.WpfExample/MainWindow.xaml.cs @@ -0,0 +1,72 @@ +/* + Dapplo - building blocks for desktop applications + Copyright (C) 2015-2016 Dapplo + + For more information see: http://dapplo.net/ + Dapplo repositories are hosted on GitHub: https://github.com/dapplo + + This file is part of Dapplo.Confluence + + Dapplo.Confluence is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Dapplo.Confluence is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dapplo.Confluence. If not, see . + */ + +using Dapplo.LogFacade; +using Dapplo.LogFacade.Loggers; +using System; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Dapplo.Confluence.WpfExample +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public ObservableCollection Projects + { + get; + set; + } = new ObservableCollection(); + + public MainWindow() + { + InitializeComponent(); + LogSettings.Logger = new TraceLogger(); + DataContext = this; + + Loaded += MainWindow_Loaded; + } + + private async void MainWindow_Loaded(object sender, RoutedEventArgs e) + { + var confluenceApi = await ConfluenceApi.CreateAndInitializeAsync(new Uri("https://greenshot.atlassian.net")); + + var projects = await confluenceApi.ProjectsAsync(); + + foreach (var project in projects) + { + // Demonstrate the Avatar and it's underlying GetAsAsync + // could also be done with setting the source of the image, but this might not work without login + var avatar = await confluenceApi.AvatarAsync(project.Avatar); + Projects.Add(new Project + { + Title = project.Name, + Avatar = avatar + }); + } + } + } +} diff --git a/Dapplo.Confluence.WpfExample/Project.cs b/Dapplo.Confluence.WpfExample/Project.cs new file mode 100644 index 0000000..f9b9878 --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Project.cs @@ -0,0 +1,45 @@ +/* + Dapplo - building blocks for desktop applications + Copyright (C) 2015-2016 Dapplo + + For more information see: http://dapplo.net/ + Dapplo repositories are hosted on GitHub: https://github.com/dapplo + + This file is part of Dapplo.Confluence + + Dapplo.Confluence is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Dapplo.Confluence is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dapplo.Confluence. If not, see . + */ + +using System.Windows.Media.Imaging; + +namespace Dapplo.Confluence.WpfExample +{ + /// + /// A container for reading the project data into, currently also by a lack of having them inside the API + /// + public class Project + { + public string Title + { + get; + set; + } + + public BitmapSource Avatar + { + get; + set; + } + } +} diff --git a/Dapplo.Confluence.WpfExample/Properties/AssemblyInfo.cs b/Dapplo.Confluence.WpfExample/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6f06317 --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Properties/AssemblyInfo.cs @@ -0,0 +1,53 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dapplo.Confluence.WpfExample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Dapplo")] +[assembly: AssemblyProduct("Dapplo.Confluence.WpfExample")] +[assembly: AssemblyCopyright("Copyright © Dapplo 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dapplo.Confluence.WpfExample/Properties/Resources.Designer.cs b/Dapplo.Confluence.WpfExample/Properties/Resources.Designer.cs new file mode 100644 index 0000000..23c044c --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Dapplo.Confluence.WpfExample.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Dapplo.Confluence.WpfExample.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Dapplo.Confluence.WpfExample/Properties/Resources.resx b/Dapplo.Confluence.WpfExample/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Dapplo.Confluence.WpfExample/Properties/Settings.Designer.cs b/Dapplo.Confluence.WpfExample/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f869e0f --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Dapplo.Confluence.WpfExample.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Dapplo.Confluence.WpfExample/Properties/Settings.settings b/Dapplo.Confluence.WpfExample/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Dapplo.Confluence.WpfExample/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.WpfExample/packages.config b/Dapplo.Confluence.WpfExample/packages.config new file mode 100644 index 0000000..d3618a2 --- /dev/null +++ b/Dapplo.Confluence.WpfExample/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence.sln b/Dapplo.Confluence.sln new file mode 100644 index 0000000..85f743a --- /dev/null +++ b/Dapplo.Confluence.sln @@ -0,0 +1,47 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapplo.Confluence", "Dapplo.Confluence\Dapplo.Confluence.csproj", "{4AE569B6-987B-4EEF-936C-D60672CE861E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapplo.Confluence.WpfExample", "Dapplo.Confluence.WpfExample\Dapplo.Confluence.WpfExample.csproj", "{21318574-B731-40E3-BA54-0C92429B5317}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Dapplo.Confluence.Shared", "Dapplo.Confluence.Shared\Dapplo.Confluence.Shared.shproj", "{9ADC9877-D20C-426D-B82D-DDED453D12BD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapplo.Confluence.PCL", "Dapplo.Confluence.PCL\Dapplo.Confluence.PCL.csproj", "{437D6408-B03C-4AE2-B736-D7E9763C2B09}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapplo.Confluence.Tests", "Dapplo.Confluence.Tests\Dapplo.Confluence.Tests.csproj", "{2119C12B-5874-4E60-BD36-45CA1D29FDDC}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + Dapplo.Confluence.Shared\Dapplo.Confluence.Shared.projitems*{9adc9877-d20c-426d-b82d-dded453d12bd}*SharedItemsImports = 13 + Dapplo.Confluence.Shared\Dapplo.Confluence.Shared.projitems*{4ae569b6-987b-4eef-936c-d60672ce861e}*SharedItemsImports = 4 + Dapplo.Confluence.Shared\Dapplo.Confluence.Shared.projitems*{437d6408-b03c-4ae2-b736-d7e9763c2b09}*SharedItemsImports = 4 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AnyCPU = Debug|AnyCPU + Release|AnyCPU = Release|AnyCPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4AE569B6-987B-4EEF-936C-D60672CE861E}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {4AE569B6-987B-4EEF-936C-D60672CE861E}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {4AE569B6-987B-4EEF-936C-D60672CE861E}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {4AE569B6-987B-4EEF-936C-D60672CE861E}.Release|AnyCPU.Build.0 = Release|Any CPU + {21318574-B731-40E3-BA54-0C92429B5317}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {21318574-B731-40E3-BA54-0C92429B5317}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {21318574-B731-40E3-BA54-0C92429B5317}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {21318574-B731-40E3-BA54-0C92429B5317}.Release|AnyCPU.Build.0 = Release|Any CPU + {437D6408-B03C-4AE2-B736-D7E9763C2B09}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {437D6408-B03C-4AE2-B736-D7E9763C2B09}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {437D6408-B03C-4AE2-B736-D7E9763C2B09}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {437D6408-B03C-4AE2-B736-D7E9763C2B09}.Release|AnyCPU.Build.0 = Release|Any CPU + {2119C12B-5874-4E60-BD36-45CA1D29FDDC}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {2119C12B-5874-4E60-BD36-45CA1D29FDDC}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {2119C12B-5874-4E60-BD36-45CA1D29FDDC}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {2119C12B-5874-4E60-BD36-45CA1D29FDDC}.Release|AnyCPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Dapplo.Confluence/Dapplo.Confluence.csproj b/Dapplo.Confluence/Dapplo.Confluence.csproj new file mode 100644 index 0000000..a62c909 --- /dev/null +++ b/Dapplo.Confluence/Dapplo.Confluence.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {4AE569B6-987B-4EEF-936C-D60672CE861E} + Library + Properties + Dapplo.Confluence + Dapplo.Confluence + v4.6 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Dapplo.HttpExtensions.0.4.22.0\lib\net46\Dapplo.HttpExtensions.dll + True + + + ..\packages\Dapplo.LogFacade.0.2.13.0\lib\net46\Dapplo.LogFacade.dll + True + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence/Dapplo.Confluence.nuspec b/Dapplo.Confluence/Dapplo.Confluence.nuspec new file mode 100644 index 0000000..debcd4f --- /dev/null +++ b/Dapplo.Confluence/Dapplo.Confluence.nuspec @@ -0,0 +1,31 @@ + + + + $id$ + $version$ + $author$ + http://www.gnu.org/licenses/lgpl-3.0.en.html + http://www.dapplo.net/blocks/Dapplo.Confluence.html + http://www.dapplo.net/favicon.ico + false + $description$ + A library to access a Confluence server + en-us + Copyright © Dapplo 2016 + Confluence + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Dapplo.Confluence/Properties/AssemblyInfo.cs b/Dapplo.Confluence/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eb2fccd --- /dev/null +++ b/Dapplo.Confluence/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Dapplo.Confluence")] +[assembly: AssemblyDescription("A Confluence client API")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Dapplo")] +[assembly: AssemblyProduct("Dapplo.Confluence")] +[assembly: AssemblyCopyright("Copyright © Dapplo 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4ae569b6-987b-4eef-936c-d60672ce861e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/Dapplo.Confluence/packages.config b/Dapplo.Confluence/packages.config new file mode 100644 index 0000000..d3618a2 --- /dev/null +++ b/Dapplo.Confluence/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md new file mode 100644 index 0000000..652d77d --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Dapplo.Confluence +This is a simple REST based Confluence client, written for Greenshot, by using Dapplo.HttpExtension + +Current build status: [![Build status](https://ci.appveyor.com/api/projects/status/d78ubenwypiwg3j4?svg=true)](https://ci.appveyor.com/project/dapplo/dapplo-confluence) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..4c4fa43 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,43 @@ +version: 0.1.{build} +skip_tags: true +configuration: Release +platform: AnyCPU +clone_depth: 2 +assembly_info: + patch: true + file: '**\AssemblyInfo.*' + assembly_version: '{version}' + assembly_file_version: '{version}' + assembly_informational_version: '{version}' +install: + - choco install gitlink -y +before_build: + - nuget restore +before_package: + - GitLink .\ +build: + project: Dapplo.Confluence.sln + publish_nuget: true + publish_nuget_symbols: false + verbosity: minimal +artifacts: +- path: '*.nupkg' + name: NuGet package +notifications: +- provider: Email + to: + - robin@dapplo.net + on_build_success: true + on_build_failure: true + on_build_status_changed: false +deploy: +- provider: GitHub + release: Dapplo.Confluence-v$(appveyor_build_version) + auth_token: + secure: eBQPtXg53XgcvdcVY3wQAw6kkwNh+QhcsTDwzyQLLh6IOPyiePEaEhJR0D2YBjAj + artifact: /.*\.nupkg/ + draft: false +- provider: NuGet + skip_symbols: true + api_key: + secure: xkDQ385+smLqdzhESsXBJvnUjK4FZ4Djjrqi9tFR29dwESIvPYOrQAqgri5Nf/fA \ No newline at end of file