Skip to content

Upgraded PlanGrid.Api.Net45 form .Net Framework to .Net8.0. #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api.NetCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>PlanGrid.Api</RootNamespace>
<AssemblyName>PlanGrid.Api</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyTitle>PlanGrid.Api</AssemblyTitle>
<Company>PlanGrid, Inc.</Company>
<Product>PlanGrid.Api.Core</Product>
<Copyright>Copyright © 2016</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageTags>Plangrid.Api.Core</PackageTags>
<Title>PlanGrid.Api.Core</Title>
<PackageOutputPath>C:\Users\bilalyas\Downloads\plangrid-api-net-master</PackageOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Refit" Version="4.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<Target Name="ValidateCopyright" AfterTargets="Compile">
<!--<Exec Command="PowerShell.exe -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command &quot;&amp; '$(SolutionDir)build\CopyrightCheck.ps1'&quot; '$(ProjectDir)'" />-->
</Target>
</Project>
19 changes: 19 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AnnotationVisibility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// <copyright file="AnnotationVisibility.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using System.Runtime.Serialization;

namespace PlanGrid.Api
{
public enum AnnotationVisibility
{
None,

[EnumMember(Value = "user")]
User,

[EnumMember(Value = "master")]
Master
}
}
33 changes: 33 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/Attachment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// <copyright file="Attachment.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using System;
using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class Attachment
{
[JsonProperty("uid")]
public string Uid { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("folder")]
public string Folder { get; set; }

[JsonProperty("url")]
public string Url { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }

[JsonProperty("created_by")]
public UserReference CreatedBy { get; set; }

[JsonProperty("deleted")]
public bool IsDeleted { get; set; }
}
}
10 changes: 10 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AttachmentReference.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class AttachmentReference
{
[JsonProperty("attachment_uid")]
public string AttachmentUid { get; set; }
}
}
13 changes: 13 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AttachmentUpdate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class AttachmentUpdate
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("folder")]
public string Folder { get; set; }
}
}
22 changes: 22 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AttachmentUpload.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// <copyright file="RfisTests.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class AttachmentUpload
{
public const string Pdf = "application/pdf";

[JsonProperty("content_type")]
public string ContentType { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("folder")]
public string Folder { get; set; }
}
}
50 changes: 50 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AutoGeneratedIPlanGridApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// <copyright file="AutoGeneratedIPlanGridApi.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using Refit;

namespace PlanGrid.Api
{
public partial class AutoGeneratedIPlanGridApi
{
public string ApiKey { get; private set; }
public RefitSettings Settings { get; private set; }
public string Version { get; private set; }
public int? MaxRetries { get; private set; }

public void Initialize(string apiKey, RefitSettings settings, string version, int? maxRetries)
{
ApiKey = apiKey;
Settings = settings;
Version = version;
MaxRetries = maxRetries;

foreach (KeyValuePair<string, Func<HttpClient, object[], object>> methodImpl in methodImpls.ToArray())
{
methodImpls[methodImpl.Key] = (client, arguments) => methodImpl.Value(client, FixArguments(arguments));
}
}

private object[] FixArguments(object[] arguments)
{
for (int i = 0; i < arguments.Length; i++)
{
if (arguments[i] is bool)
{
arguments[i] = (bool)arguments[i] ? "true" : "false";
}
}
return arguments;
}

public void Dispose()
{
Client.Dispose();
}
}
}
17 changes: 17 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AwsPostFormArgument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// <copyright file="RfisTests.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class AwsPostFormArgument
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("value")]
public string Value { get; set; }
}
}
17 changes: 17 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/AwsPostFormArguments.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// <copyright file="RfisTests.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class AwsPostFormArguments
{
[JsonProperty("action")]
public string Action { get; set; }

[JsonProperty("fields")]
public AwsPostFormArgument[] Fields { get; set; }
}
}
17 changes: 17 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/CollectionReference.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// <copyright file="CollectionReference.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class CollectionReference<T>
{
[JsonProperty("total_count")]
public int TotalCount { get; set; }

[JsonProperty("url")]
public string Url { get; set; }
}
}
30 changes: 30 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/Comment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// <copyright file="Comment.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>

using System;
using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class Comment
{
[JsonProperty("uid")]
public string Uid { get; set; }

[JsonProperty("text")]
public string Text { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }

[JsonProperty("created_by")]
public UserReference CreatedBy { get; set; }

[JsonProperty("record_type")]
public RecordType RecordType { get; set; }

[JsonProperty("record")]
public RecordReference<Record> Record { get; set; }
}
}
75 changes: 75 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/Date.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// <copyright file="Date.cs" company="PlanGrid, Inc.">
// Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
// </copyright>
using System;
using System.Globalization;

namespace PlanGrid.Api
{
public struct Date
{
public const string Format = "yyyy-MM-dd";

private readonly DateTime when;

public Date(DateTime when)
{
this.when = when.Date;
}

public Date(int year, int month, int day) : this(new DateTime(year, month, day))
{
}

public static implicit operator DateTime(Date date)
{
return date.when;
}

public static implicit operator Date(DateTime dateTime)
{
return new Date(dateTime);
}

public override string ToString()
{
return when.ToString(Format, CultureInfo.InvariantCulture);
}

public static Date Parse(string s)
{
return DateTime.ParseExact(s, Format, CultureInfo.InvariantCulture);
}

public override int GetHashCode()
{
return when.GetHashCode();
}

public override bool Equals(object obj)
{
var other = obj as Date?;
return other != null && when.Equals(other.Value.when);
}

public static bool operator ==(Date left, Date right)
{
return left.Equals(right);
}

public static bool operator !=(Date left, Date right)
{
return !left.Equals(right);
}

public static bool operator <(Date left, Date right)
{
return left.when < right.when;
}

public static bool operator >(Date left, Date right)
{
return left.when > right.when;
}
}
}
20 changes: 20 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/FailedRequestException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Net;

namespace PlanGrid.Api
{
public class FailedRequestException : Exception
{
public HttpStatusCode StatusCode { get; }

public FailedRequestException(HttpStatusCode statusCode, string message) : base($"{(int)statusCode} ({statusCode}): {message}")
{
StatusCode = statusCode;
}

public FailedRequestException(HttpStatusCode statusCode, string message, Exception innerException) : base(message, innerException)
{
StatusCode = statusCode;
}
}
}
16 changes: 16 additions & 0 deletions PlanGrid.Api.NetCore/PlanGrid.Api/FailedRequestResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;

namespace PlanGrid.Api
{
public class FailedRequestResponse
{
[JsonProperty("message")]
public string Message { get; set; }

[JsonProperty("rate_limit")]
public RateLimit RateLimit { get; set; }
}
}
Loading