Commit 60271dd6 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '2-nugetize' into 'master'

Resolve "nugetize"

Closes #2

See merge request !3
parents 52867342 a41c5430
Pipeline #13702 passed with stage
in 30 seconds
......@@ -188,3 +188,4 @@ GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
GeneSys2.userprefs
.vs/
variables:
VERSION: 2.0.0
stages:
- compile
- publish
build branch:
stage: compile
image: mcr.microsoft.com/dotnet/core/sdk:3.1
before_script:
# - echo "Hi"
- cd Client
- dotnet restore
script:
- dotnet build /p:Version=${VERSION}-${CI_COMMIT_REF_SLUG} -c Release --no-restore --version-suffix ${CI_COMMIT_REF_SLUG}
- find bin/
- dotnet pack /p:Version=${VERSION}-${CI_COMMIT_REF_SLUG} -c Release --no-restore --no-build --version-suffix ${CI_COMMIT_REF_SLUG}
- find obj/
- cat obj/Release/GenesysPGR.Client.*.nuspec
artifacts:
name: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 1 day
paths:
- Client/bin/*
except:
- /^v\d\./
publish release to nuget:
stage: publish
image: mcr.microsoft.com/dotnet/core/sdk:3.1
before_script:
- cd Client
- dotnet restore
- if [[ "${CI_COMMIT_TAG}" =~ ^v[0-9] ]] ; then
export VERSION=`echo "${CI_COMMIT_TAG}" | sed -E 's/v(.*\..*)/\1/'`;
else
echo "Invalid version format ${CI_COMMIT_TAG}";
exit -1;
fi
script:
- dotnet build /p:Version=${VERSION} -c Release --no-restore
- dotnet pack /p:Version=${VERSION} -c Release --no-restore --no-build
- cat obj/Release/GenesysPGR.Client.${VERSION}.nuspec
- dotnet nuget push bin/Release/GenesysPGR.Client.${VERSION}.nupkg -k "${NUGET_API_KEY}" -s https://api.nuget.org/v3/index.json
only:
- /^v\d\./
......@@ -14,17 +14,15 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GeneSys2.Client.OAuth;
using GenesysPGR.Client.Model;
using GenesysPGR.Client.OAuth;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// AccessionApi encapsulates the Genesys API methods used to interact with Accession data
......
......@@ -14,7 +14,7 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GenesysPGR.Client.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -27,7 +27,7 @@ using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// Base class for GeneSys API calls. Provides a series of methods for querying the server (both synchronous and asynchronous), raising
......
......@@ -14,8 +14,8 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GeneSys2.Client.OAuth;
using GenesysPGR.Client.Model;
using GenesysPGR.Client.OAuth;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
......@@ -23,7 +23,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// CropApi encapsulates the Genesys API methods used to interact with crop data
......
......@@ -15,9 +15,9 @@
**/
using System;
using GeneSys2.Client.Model;
using GenesysPGR.Client.Model;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// IAccessionApi interface describes the Genesys API methods used to interact with accession data
......
......@@ -15,9 +15,9 @@
**/
using System;
using GeneSys2.Client.Model;
using GenesysPGR.Client.Model;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// ICropApi interface describes the Genesys API methods used to interact with crop data
......
......@@ -15,9 +15,9 @@
**/
using System;
using GeneSys2.Client.Model;
using GenesysPGR.Client.Model;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// IKpiApi interface describes the Genesys API methods used to interact with parameter, dimension and execution data
......
......@@ -16,7 +16,7 @@
using System;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// IOrganizationApi interface describes the Genesys API methods used to interact with organization data
......
......@@ -15,9 +15,9 @@
**/
using System;
using GeneSys2.Client.Model;
using GenesysPGR.Client.Model;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// IUserApi interface describes the Genesys API methods used to interact with user data
......
......@@ -14,15 +14,15 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GeneSys2.Client.OAuth;
using GenesysPGR.Client.Model;
using GenesysPGR.Client.OAuth;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// KpiApi encapsulates the Genesys API methods used to interact with parameter, dimension, and execution data.
......
......@@ -14,8 +14,8 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GeneSys2.Client.OAuth;
using GenesysPGR.Client.Model;
using GenesysPGR.Client.OAuth;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
......@@ -23,7 +23,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// OrganizationApi encapsulates the Genesys API methods used to interact with organization data
......
......@@ -14,8 +14,8 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GeneSys2.Client.OAuth;
using GenesysPGR.Client.Model;
using GenesysPGR.Client.OAuth;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
......@@ -23,12 +23,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Api
namespace GenesysPGR.Client.Api
{
/// <summary>
/// UserApi encapsulates the Genesys API methods used to interact with user data
/// </summary>
public class UserApi : BaseApi, GeneSys2.Client.Api.IUserApi
public class UserApi : BaseApi, GenesysPGR.Client.Api.IUserApi
{
/// <summary>
/// UserApi constructor
......
......@@ -14,7 +14,7 @@
* limitations under the License.
**/
using GeneSys2.Client.Model;
using GenesysPGR.Client.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
......@@ -23,7 +23,7 @@ using System.Net;
using System.Net.Http;
using System.Text;
namespace GeneSys2.Client
namespace GenesysPGR.Client
{
/// <summary>
/// The GenesysApiException is thrown when there is an error thrown by the server.
......
......@@ -14,9 +14,9 @@
* limitations under the License.
**/
using GeneSys2.Client.Api;
using GeneSys2.Client.Model;
using GeneSys2.Client.OAuth;
using GenesysPGR.Client.Api;
using GenesysPGR.Client.Model;
using GenesysPGR.Client.OAuth;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
......@@ -28,7 +28,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace GeneSys2.Client
namespace GenesysPGR.Client
{
/// <summary>
/// The GenesysClient is the primary class of the library, serving as the entry point to call the Genesys
......@@ -36,24 +36,6 @@ namespace GeneSys2.Client
/// </summary>
public class GenesysClient : IGenesysClient
{
/// <summary>
/// GenesysClient constructor. Base URI of the Genesys server loaded from the configuration file.
/// </summary>
/// <param name="authProvider">OAuth Handler providing the tokens for API calls</param>
public GenesysClient(IOAuthHandler authProvider)
{
// Read baseUri from configuration
OAuthClientConfigurationSection config = (OAuthClientConfigurationSection)System.Configuration.ConfigurationManager.GetSection("genesysAuthentication");
var apiUri = new Uri(config.BaseUrl.TrimEnd("/".ToCharArray()) + "/api/v0");
// Create API objects
Accession = new AccessionApi(apiUri, authProvider);
Organization = new OrganizationApi(apiUri, authProvider);
User = new UserApi(apiUri, authProvider);
Crop = new CropApi(apiUri, authProvider);
Kpi = new KpiApi(apiUri, authProvider);
}
/// <summary>
/// GenesysClient constructor
/// </summary>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;netstandard2.1</TargetFrameworks>
<Authors>Genesys Helpdesk</Authors>
<Company>Global Crop Diversity Trust</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>2.0.0.1</AssemblyVersion>
<FileVersion>2.0.0.1</FileVersion>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>2020 Global Crop Diversity Trust</Copyright>
<Description>API client to www.genesys-pgr.org</Description>
<PackageDescription>Interact with Genesys PGR - the global portal on plant genetic resources in genebanks.</PackageDescription>
<Product>Genesys PGR client</Product>
<Version>2.0.0</Version>
<ProjectUrl>https://gitlab.croptrust.org/genesys-pgr/genesys-client-api-dotnet</ProjectUrl>
<PackageProjectUrl>https://gitlab.croptrust.org/genesys-pgr/genesys-client-api-dotnet</PackageProjectUrl>
<RepositoryUrl>https://gitlab.croptrust.org/genesys-pgr/genesys-client-api-dotnet</RepositoryUrl>
<PackageTags>genesys-pgr</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Web">
<HintPath>..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Web.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>$id$</id>
<title>Genesys PGR client</title>
<!-- The package version number that is used when resolving dependencies -->
<version>$version$</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>$author$</authors>
<!-- Owners are typically nuget.org identities that allow gallery
users to earily find other packages by the same owners. -->
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<!-- The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal. -->
<description>Interact with Genesys PGR - the global portal on plant genetic resources in genebanks.</description>
<license type="expression">Apache-2.0</license>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="NewtonSoft.Json" version="12.0.1" />
</dependencies>
</metadata>
<files>
<!-- A readme.txt will be displayed when the package is installed -->
<file src="..\..\README.md" target="" />
<file src="..\..\docs\**\*.*" target="docs" />
</files>
</package>
......@@ -15,9 +15,9 @@
**/
using System;
using GeneSys2.Client.Api;
using GenesysPGR.Client.Api;
namespace GeneSys2.Client
namespace GenesysPGR.Client
{
/// <summary>
/// IGenesysClient interface exposes the methods used to call the Gensys server
......
......@@ -21,7 +21,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Model
namespace GenesysPGR.Client.Model
{
/// <summary>
/// Accession model
......
......@@ -21,7 +21,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneSys2.Client.Model
namespace GenesysPGR.Client.Model
{
/// <summary>
/// Used as a container of aliases to set names for a given accession.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment