Skip to content

Commit

Permalink
Merge pull request #19 from mn-mde-edfi/MOAI-729
Browse files Browse the repository at this point in the history
[MOAI-729] Generate SDK from Sandbox Environment
  • Loading branch information
steve-dlp authored Feb 9, 2022
2 parents 2f5623e + 154bbba commit c47153b
Show file tree
Hide file tree
Showing 4,846 changed files with 239,087 additions and 1,213,703 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 4 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@ target
atlassian-ide-plugin.xml
.DS_Store

/generated-sdk

CSharpSDK/**/bin
CSharpSDK/**/obj
CSharpSDK/**/packages
CSharpSDK/**/*.suo
CSharpSDK/**/*.user
CSharpSDK/EdFi.OdsApi.Sdk/Api
CSharpSDK/EdFi.OdsApi.Sdk/Models
CSharpSDK/EdFi.OdsApi.Sdk/Program.cs
CSharpSDK/EdFi.OdsApi.Sdk/*.nupkg
CSharpSDK/EdFi.OdsApi.Sdk/Helpers
/MDE-EdFiClientSDK/EdFi/OdsApiV31/.vs/

**/.vs/
**/.vscode/

**/generated-sdk
swagger-codegen-cli*.jar
9 changes: 9 additions & 0 deletions MDE-EdFiClientSDK/EdFi/OdsApiv52_2023/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
language: csharp
mono:
- latest
solution: EdFi.OdsApi.Sdk.sln
script:
- /bin/sh ./mono_nunit_test.sh
24 changes: 12 additions & 12 deletions MDE-EdFiClientSDK/EdFi/OdsApiv52_2023/EdFi.OdsApi.Sdk.sln
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31702.278
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdFi.OdsApi.SdkClient", "EdFi.OdsApi.SdkClient\EdFi.OdsApi.SdkClient.csproj", "{20B921EA-718B-4F0C-970D-336568527802}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdFi.OdsApi.Sdk", "src\EdFi.OdsApi.Sdk\EdFi.OdsApi.Sdk.csproj", "{C86AEA53-A646-470C-9787-046115AC78AA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdFi.OdsApi.Sdk", "src\EdFi.OdsApi.Sdk\EdFi.OdsApi.Sdk.csproj", "{916DB972-62B9-4B96-A2B2-1F69B8E41877}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdFi.OdsApi.SdkClient", "EdFi.OdsApi.SdkClient\EdFi.OdsApi.SdkClient.csproj", "{26347A62-8E37-46F0-8739-A2A29E0D99B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{20B921EA-718B-4F0C-970D-336568527802}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20B921EA-718B-4F0C-970D-336568527802}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20B921EA-718B-4F0C-970D-336568527802}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20B921EA-718B-4F0C-970D-336568527802}.Release|Any CPU.Build.0 = Release|Any CPU
{916DB972-62B9-4B96-A2B2-1F69B8E41877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{916DB972-62B9-4B96-A2B2-1F69B8E41877}.Debug|Any CPU.Build.0 = Debug|Any CPU
{916DB972-62B9-4B96-A2B2-1F69B8E41877}.Release|Any CPU.ActiveCfg = Release|Any CPU
{916DB972-62B9-4B96-A2B2-1F69B8E41877}.Release|Any CPU.Build.0 = Release|Any CPU
{C86AEA53-A646-470C-9787-046115AC78AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C86AEA53-A646-470C-9787-046115AC78AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C86AEA53-A646-470C-9787-046115AC78AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C86AEA53-A646-470C-9787-046115AC78AA}.Release|Any CPU.Build.0 = Release|Any CPU
{26347A62-8E37-46F0-8739-A2A29E0D99B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26347A62-8E37-46F0-8739-A2A29E0D99B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26347A62-8E37-46F0-8739-A2A29E0D99B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26347A62-8E37-46F0-8739-A2A29E0D99B8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {33D9AA3A-33D0-41A6-9829-9DAAB5C71382}
SolutionGuid = {23983A0B-13D5-42EE-A631-2DD183A52166}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,68 @@
<Project Sdk="Microsoft.NET.Sdk">

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{26347A62-8E37-46F0-8739-A2A29E0D99B8}</ProjectGuid>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>EdFi.OdsApi.SdkClient</RootNamespace>
<AssemblyName>EdFi.OdsApi.SdkClient</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=105.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.105.1.0\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TokenRetriever.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\EdFi.OdsApi.Sdk\EdFi.OdsApi.Sdk.csproj" />
<ProjectReference Include="..\src\EdFi.OdsApi.Sdk\EdFi.OdsApi.Sdk.csproj">
<Project>{e6dbf980-c252-4123-ac4b-91b02a165bb1}</Project>
<Name>EdFi.OdsApi.Sdk</Name>
</ProjectReference>
</ItemGroup>

</Project>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System.Linq;

using EdFi.OdsApi.Sdk.Apis.Descriptors;
using EdFi.OdsApi.Sdk.Apis.Profiles.Minnesota_TwentyTwo_TwentyThree_SISVendor_Profile;
using EdFi.OdsApi.Sdk.Apis.Profiles.Minnesota_Twenty_Two_Twenty_Three_SISVendor_Profile;
using EdFi.OdsApi.Sdk.Client;

namespace EdFi.OdsApi.SdkClient
{

public class Program
{
public static void Main(string[] args)
Expand All @@ -20,12 +18,13 @@ public static void Main(string[] args)
// Due to our reliance on some older libraries, the.NET framework won't necessarily default
// to the latest unless we explicitly request it. Some hosting environments will not allow older versions
// of TLS, and thus calls can fail without this extra configuration.
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
System.Net.ServicePointManager.SecurityProtocol |=
System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;

// Oauth configuration
var oauthUrl = "http://localhost:54746";
var clientKey = "5MrTEHo3wGZRsaD12V9zy";
var clientSecret = "XofzCbh2slKgRN87Qp36j";
var oauthUrl = "https://test.edfi5.education.mn.gov/api";
var clientKey = "populated";
var clientSecret = "populatedSecret";

// TokenRetriever makes the oauth calls. It has RestSharp dependency, install via NuGet
var tokenRetriever = new TokenRetriever(oauthUrl, clientKey, clientSecret);
Expand All @@ -34,7 +33,7 @@ public static void Main(string[] args)
var configuration = new Configuration
{
AccessToken = tokenRetriever.ObtainNewBearerToken(),
BasePath = "http://localhost:54746/data/v3/"
BasePath = "https://test.edfi5.education.mn.gov/api/data/v3"
};

Console.WriteLine("GET MN extension StudentSchoolAssociations");
Expand Down Expand Up @@ -88,7 +87,8 @@ public static void Main(string[] args)
Console.WriteLine();
Console.WriteLine("GET MN Extension Descriptor: EarlyChildhoodScreeningExitStatus");
var mnDescriptorApi = new EarlyChildhoodScreeningExitStatusDescriptorsApi(configuration);
var mnDescriptorResponse = mnDescriptorApi.GetEarlyChildhoodScreeningExitStatusDescriptorsWithHttpInfo(null, null);
var mnDescriptorResponse =
mnDescriptorApi.GetEarlyChildhoodScreeningExitStatusDescriptorsWithHttpInfo(null, null);
httpResponseCode = mnDescriptorResponse.StatusCode;
var mnDescriptors = mnDescriptorResponse.Data;
Console.WriteLine($"Response code is {httpResponseCode}");
Expand All @@ -106,4 +106,4 @@ public static void Main(string[] args)
Console.ReadLine();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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("EdFi.OdsApi.SdkClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdFi.OdsApi.SdkClient")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("26347a62-8e37-46f0-8739-a2a29e0d99b8")]

// 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")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Runtime.Serialization;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Authentication;
using EdFi.OdsApi.Sdk.Client;
using RestSharp.Portable;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestSharp;

namespace EdFi.OdsApi.SdkClient
{
Expand All @@ -15,6 +18,12 @@ public class TokenRetriever
private string clientKey;
private string clientSecret;

/// <summary>
///
/// </summary>
/// <param name="oauthUrl"></param>
/// <param name="clientKey"></param>
/// <param name="clientSecret"></param>
public TokenRetriever(string oauthUrl, string clientKey, string clientSecret)
{
this.oauthUrl = oauthUrl;
Expand All @@ -24,22 +33,23 @@ public TokenRetriever(string oauthUrl, string clientKey, string clientSecret)

public string ObtainNewBearerToken()
{
var oauthClient = new ApiClient(oauthUrl);
var oauthClient = new RestClient(oauthUrl);
return GetBearerToken(oauthClient);
}

private string GetBearerToken(ApiClient oauthClient)

private string GetBearerToken(IRestClient oauthClient)
{
var bearerTokenRequest = new RestRequest("oauth/token", Method.POST);
bearerTokenRequest.AddParameter("Client_id", clientKey);
bearerTokenRequest.AddParameter("Client_secret", clientSecret);
bearerTokenRequest.AddParameter("Grant_type", "client_credentials");

var bearerTokenResponse = oauthClient.RestClient.Execute<BearerTokenResponse>(bearerTokenRequest).Result;
var bearerTokenResponse = oauthClient.Execute<BearerTokenResponse>(bearerTokenRequest);
if (bearerTokenResponse.StatusCode != HttpStatusCode.OK)
{
throw new AuthenticationException("Unable to retrieve an access token. Error message: " +
bearerTokenResponse.Data.Error);
bearerTokenResponse.ErrorMessage);
}

if (bearerTokenResponse.Data.Error != null || bearerTokenResponse.Data.TokenType != "bearer")
Expand All @@ -52,19 +62,11 @@ private string GetBearerToken(ApiClient oauthClient)
}
}

[DataContract]
internal class BearerTokenResponse
{
[DataMember(Name = "access_token", EmitDefaultValue = false)]
public string AccessToken { get; set; }

[DataMember(Name = "expires_in", EmitDefaultValue = false)]
public string ExpiresIn { get; set; }

[DataMember(Name = "token_type", EmitDefaultValue = false)]
public string TokenType { get; set; }

[DataMember(Name = "error", EmitDefaultValue = false)]
public string Error { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="RestSharp" version="105.1.0" targetFramework="net462" />
</packages>
Loading

0 comments on commit c47153b

Please sign in to comment.