@fossa-app/bridge 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fossa-app/bridge",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Shared Domain Models and DTOs for Fossa UI and API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,6 +10,16 @@
10
10
  <ItemGroup>
11
11
  <Compile Include="Models\ApiModels.fs" />
12
12
  <Compile Include="Services\UrlHelpers.fs" />
13
+ <Compile Include="Services\Endpoints.fs" />
14
+ <Compile Include="Services\IHttpTransport.fs" />
15
+ <Compile Include="Services\Clients\CompanyClient.fs" />
16
+ <Compile Include="Services\Clients\CompanySettingsClient.fs" />
17
+ <Compile Include="Services\Clients\EmployeeClient.fs" />
18
+ <Compile Include="Services\Clients\IdentityClient.fs" />
19
+ <Compile Include="Services\Clients\BranchClient.fs" />
20
+ <Compile Include="Services\Clients\DepartmentClient.fs" />
21
+ <Compile Include="Services\Clients\CompanyLicenseClient.fs" />
22
+ <Compile Include="Services\Clients\SystemLicenseClient.fs" />
13
23
  </ItemGroup>
14
24
  <ItemGroup>
15
25
  <PackageReference Include="Fable.Core" Version="4.5.0" />
@@ -11,6 +11,12 @@ type AddressModel =
11
11
  PostalCode: string
12
12
  CountryCode: string }
13
13
 
14
+ type ClientRetrievalModel =
15
+ { ClientId: Guid
16
+ ClientName: string
17
+ TenantId: Guid }
18
+
19
+
14
20
  type BranchModificationModel =
15
21
  { Name: string
16
22
  TimeZoneId: string
@@ -0,0 +1,46 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+ open System
7
+
8
+ type BranchClient(transport: IHttpTransport) =
9
+ let buildUrl (queryParams: BranchQueryRequestModel) =
10
+ let mutable url = Endpoints.BasePath + "/" + Endpoints.Branches + "?"
11
+
12
+ if queryParams.Id <> null && queryParams.Id.Count > 0 then
13
+ let ids = queryParams.Id |> Seq.map (fun id -> $"Id={id}") |> String.concat "&"
14
+ url <- url + ids + "&"
15
+
16
+ if not (String.IsNullOrEmpty(queryParams.Search)) then
17
+ url <- url + $"Search={Uri.EscapeDataString(queryParams.Search)}&"
18
+
19
+ if queryParams.PageNumber.HasValue then
20
+ url <- url + $"PageNumber={queryParams.PageNumber.Value}&"
21
+
22
+ if queryParams.PageSize.HasValue then
23
+ url <- url + $"PageSize={queryParams.PageSize.Value}&"
24
+
25
+ url.TrimEnd('&')
26
+
27
+ member _.GetBranchesAsync(query: BranchQueryRequestModel) : Task<PagingResponseModel<BranchRetrievalModel>> =
28
+ transport.GetAsync<PagingResponseModel<BranchRetrievalModel>>(buildUrl query)
29
+
30
+ member _.GetBranchAsync(id: int64) : Task<BranchRetrievalModel> =
31
+ transport.GetAsync<BranchRetrievalModel>(Endpoints.BasePath + "/" + Endpoints.Branches + $"/{id}")
32
+
33
+ member _.CreateBranchAsync(model: BranchModificationModel) : Task<BranchRetrievalModel> =
34
+ transport.PostAsync<BranchModificationModel, BranchRetrievalModel>(
35
+ Endpoints.BasePath + "/" + Endpoints.Branches,
36
+ model
37
+ )
38
+
39
+ member _.UpdateBranchAsync(id: int64, model: BranchModificationModel) : Task<BranchRetrievalModel> =
40
+ transport.PutAsync<BranchModificationModel, BranchRetrievalModel>(
41
+ Endpoints.BasePath + "/" + Endpoints.Branches + $"/{id}",
42
+ model
43
+ )
44
+
45
+ member _.DeleteBranchAsync(id: int64) : Task<unit> =
46
+ transport.DeleteAsync(Endpoints.BasePath + "/" + Endpoints.Branches + $"/{id}")
@@ -0,0 +1,24 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+
7
+ type CompanyClient(transport: IHttpTransport) =
8
+ member _.GetCompanyAsync() : Task<CompanyRetrievalModel> =
9
+ transport.GetAsync<CompanyRetrievalModel>(Endpoints.BasePath + "/" + Endpoints.Company)
10
+
11
+ member _.CreateCompanyAsync(model: CompanyModificationModel) : Task<CompanyRetrievalModel> =
12
+ transport.PostAsync<CompanyModificationModel, CompanyRetrievalModel>(
13
+ Endpoints.BasePath + "/" + Endpoints.Company,
14
+ model
15
+ )
16
+
17
+ member _.UpdateCompanyAsync(model: CompanyModificationModel) : Task<CompanyRetrievalModel> =
18
+ transport.PutAsync<CompanyModificationModel, CompanyRetrievalModel>(
19
+ Endpoints.BasePath + "/" + Endpoints.Company,
20
+ model
21
+ )
22
+
23
+ member _.DeleteCompanyAsync() : Task<unit> =
24
+ transport.DeleteAsync(Endpoints.BasePath + "/" + Endpoints.Company)
@@ -0,0 +1,17 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+
7
+ type CompanyLicenseClient(transport: IHttpTransport) =
8
+ member _.GetLicenseAsync() : Task<LicenseResponseModel<CompanyEntitlementsModel>> =
9
+ transport.GetAsync<LicenseResponseModel<CompanyEntitlementsModel>>(
10
+ Endpoints.BasePath + "/" + Endpoints.CompanyLicense
11
+ )
12
+
13
+ member _.CreateLicenseAsync(model: string) : Task<LicenseResponseModel<CompanyEntitlementsModel>> =
14
+ transport.PostAsync<string, LicenseResponseModel<CompanyEntitlementsModel>>(
15
+ Endpoints.BasePath + "/" + Endpoints.CompanyLicense,
16
+ model
17
+ )
@@ -0,0 +1,24 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+
7
+ type CompanySettingsClient(transport: IHttpTransport) =
8
+ member _.GetCompanySettingsAsync() : Task<CompanySettingsRetrievalModel> =
9
+ transport.GetAsync<CompanySettingsRetrievalModel>(Endpoints.BasePath + "/" + Endpoints.CompanySettings)
10
+
11
+ member _.CreateCompanySettingsAsync(model: CompanySettingsModificationModel) : Task<CompanySettingsRetrievalModel> =
12
+ transport.PostAsync<CompanySettingsModificationModel, CompanySettingsRetrievalModel>(
13
+ Endpoints.BasePath + "/" + Endpoints.CompanySettings,
14
+ model
15
+ )
16
+
17
+ member _.UpdateCompanySettingsAsync(model: CompanySettingsModificationModel) : Task<CompanySettingsRetrievalModel> =
18
+ transport.PutAsync<CompanySettingsModificationModel, CompanySettingsRetrievalModel>(
19
+ Endpoints.BasePath + "/" + Endpoints.CompanySettings,
20
+ model
21
+ )
22
+
23
+ member _.DeleteCompanySettingsAsync() : Task<unit> =
24
+ transport.DeleteAsync(Endpoints.BasePath + "/" + Endpoints.CompanySettings)
@@ -0,0 +1,48 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+ open System
7
+
8
+ type DepartmentClient(transport: IHttpTransport) =
9
+ let buildUrl (queryParams: DepartmentQueryRequestModel) =
10
+ let mutable url = Endpoints.BasePath + "/" + Endpoints.Departments + "?"
11
+
12
+ if queryParams.Id <> null && queryParams.Id.Count > 0 then
13
+ let ids = queryParams.Id |> Seq.map (fun id -> $"Id={id}") |> String.concat "&"
14
+ url <- url + ids + "&"
15
+
16
+ if not (String.IsNullOrEmpty(queryParams.Search)) then
17
+ url <- url + $"Search={Uri.EscapeDataString(queryParams.Search)}&"
18
+
19
+ if queryParams.PageNumber.HasValue then
20
+ url <- url + $"PageNumber={queryParams.PageNumber.Value}&"
21
+
22
+ if queryParams.PageSize.HasValue then
23
+ url <- url + $"PageSize={queryParams.PageSize.Value}&"
24
+
25
+ url.TrimEnd('&')
26
+
27
+ member _.GetDepartmentsAsync
28
+ (query: DepartmentQueryRequestModel)
29
+ : Task<PagingResponseModel<DepartmentRetrievalModel>> =
30
+ transport.GetAsync<PagingResponseModel<DepartmentRetrievalModel>>(buildUrl query)
31
+
32
+ member _.GetDepartmentAsync(id: int64) : Task<DepartmentRetrievalModel> =
33
+ transport.GetAsync<DepartmentRetrievalModel>(Endpoints.BasePath + "/" + Endpoints.Departments + $"/{id}")
34
+
35
+ member _.CreateDepartmentAsync(model: DepartmentModificationModel) : Task<DepartmentRetrievalModel> =
36
+ transport.PostAsync<DepartmentModificationModel, DepartmentRetrievalModel>(
37
+ Endpoints.BasePath + "/" + Endpoints.Departments,
38
+ model
39
+ )
40
+
41
+ member _.UpdateDepartmentAsync(id: int64, model: DepartmentModificationModel) : Task<DepartmentRetrievalModel> =
42
+ transport.PutAsync<DepartmentModificationModel, DepartmentRetrievalModel>(
43
+ Endpoints.BasePath + "/" + Endpoints.Departments + $"/{id}",
44
+ model
45
+ )
46
+
47
+ member _.DeleteDepartmentAsync(id: int64) : Task<unit> =
48
+ transport.DeleteAsync(Endpoints.BasePath + "/" + Endpoints.Departments + $"/{id}")
@@ -0,0 +1,71 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+ open System
7
+
8
+ type EmployeeClient(transport: IHttpTransport) =
9
+ let buildUrl (queryParams: EmployeeQueryRequestModel) =
10
+ let mutable url = Endpoints.BasePath + "/" + Endpoints.Employees + "?"
11
+
12
+ if queryParams.Id <> null && queryParams.Id.Count > 0 then
13
+ let ids = queryParams.Id |> Seq.map (fun id -> $"Id={id}") |> String.concat "&"
14
+ url <- url + ids + "&"
15
+
16
+ if not (String.IsNullOrEmpty(queryParams.Search)) then
17
+ url <- url + $"Search={Uri.EscapeDataString(queryParams.Search)}&"
18
+
19
+ if queryParams.PageNumber.HasValue then
20
+ url <- url + $"PageNumber={queryParams.PageNumber.Value}&"
21
+
22
+ if queryParams.PageSize.HasValue then
23
+ url <- url + $"PageSize={queryParams.PageSize.Value}&"
24
+
25
+ if queryParams.ReportsToId.HasValue then
26
+ url <- url + $"ReportsToId={queryParams.ReportsToId.Value}&"
27
+
28
+ if queryParams.TopLevelOnly.HasValue then
29
+ url <- url + $"TopLevelOnly={queryParams.TopLevelOnly.Value}&"
30
+
31
+ url.TrimEnd('&')
32
+
33
+ let buildPagingUrl (queryParams: EmployeePagingRequestModel) =
34
+ let mutable url = Endpoints.BasePath + "/" + Endpoints.Employees + "?"
35
+
36
+ if not (String.IsNullOrEmpty(queryParams.Search)) then
37
+ url <- url + $"Search={Uri.EscapeDataString(queryParams.Search)}&"
38
+
39
+ if queryParams.PageNumber.HasValue then
40
+ url <- url + $"PageNumber={queryParams.PageNumber.Value}&"
41
+
42
+ if queryParams.PageSize.HasValue then
43
+ url <- url + $"PageSize={queryParams.PageSize.Value}&"
44
+
45
+ url.TrimEnd('&')
46
+
47
+ member _.GetEmployeesAsync(query: EmployeeQueryRequestModel) : Task<PagingResponseModel<EmployeeRetrievalModel>> =
48
+ transport.GetAsync<PagingResponseModel<EmployeeRetrievalModel>>(buildUrl query)
49
+
50
+ member _.GetEmployeesPagingAsync
51
+ (query: EmployeePagingRequestModel)
52
+ : Task<PagingResponseModel<EmployeeRetrievalModel>> =
53
+ transport.GetAsync<PagingResponseModel<EmployeeRetrievalModel>>(buildPagingUrl query)
54
+
55
+ member _.GetEmployeeAsync(id: int64) : Task<EmployeeRetrievalModel> =
56
+ transport.GetAsync<EmployeeRetrievalModel>(Endpoints.BasePath + "/" + Endpoints.Employee + $"/{id}")
57
+
58
+ member _.CreateEmployeeAsync(model: EmployeeModificationModel) : Task<EmployeeRetrievalModel> =
59
+ transport.PostAsync<EmployeeModificationModel, EmployeeRetrievalModel>(
60
+ Endpoints.BasePath + "/" + Endpoints.Employee,
61
+ model
62
+ )
63
+
64
+ member _.UpdateEmployeeAsync(id: int64, model: EmployeeModificationModel) : Task<EmployeeRetrievalModel> =
65
+ transport.PutAsync<EmployeeModificationModel, EmployeeRetrievalModel>(
66
+ Endpoints.BasePath + "/" + Endpoints.Employee + $"/{id}",
67
+ model
68
+ )
69
+
70
+ member _.DeleteEmployeeAsync(id: int64) : Task<unit> =
71
+ transport.DeleteAsync(Endpoints.BasePath + "/" + Endpoints.Employee + $"/{id}")
@@ -0,0 +1,9 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+
7
+ type IdentityClient(transport: IHttpTransport) =
8
+ member _.GetClientAsync(origin: string) : Task<ClientRetrievalModel> =
9
+ transport.GetAsync<ClientRetrievalModel>(Endpoints.BasePath + "/" + Endpoints.Client + $"?origin={origin}")
@@ -0,0 +1,11 @@
1
+ namespace Fossa.Bridge.Services.Clients
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+ open Fossa.Bridge.Services
6
+
7
+ type SystemLicenseClient(transport: IHttpTransport) =
8
+ member _.GetLicenseAsync() : Task<LicenseResponseModel<SystemEntitlementsModel>> =
9
+ transport.GetAsync<LicenseResponseModel<SystemEntitlementsModel>>(
10
+ Endpoints.BasePath + "/" + Endpoints.SystemLicense
11
+ )
@@ -0,0 +1,13 @@
1
+ namespace Fossa.Bridge.Services
2
+
3
+ module Endpoints =
4
+ let BasePath = "api/1.0"
5
+ let Client = "Identity/Client"
6
+ let SystemLicense = "License/System"
7
+ let CompanyLicense = "License/Company"
8
+ let Company = "Company"
9
+ let CompanySettings = "CompanySettings"
10
+ let Branches = "Branches"
11
+ let Departments = "Departments"
12
+ let Employee = "Employee"
13
+ let Employees = "Employees"
@@ -0,0 +1,10 @@
1
+ namespace Fossa.Bridge.Services
2
+
3
+ open System.Threading.Tasks
4
+ open Fossa.Bridge.Models
5
+
6
+ type IHttpTransport =
7
+ abstract member GetAsync<'TResponse> : string -> Task<'TResponse>
8
+ abstract member PostAsync<'TRequest, 'TResponse> : string * 'TRequest -> Task<'TResponse>
9
+ abstract member PutAsync<'TRequest, 'TResponse> : string * 'TRequest -> Task<'TResponse>
10
+ abstract member DeleteAsync: string -> Task<unit>
@@ -6,7 +6,7 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v8.0": {
9
- "Fossa.Bridge/0.1.4": {
9
+ "Fossa.Bridge/0.1.5": {
10
10
  "dependencies": {
11
11
  "FSharp.Core": "10.0.102",
12
12
  "Fable.Core": "4.5.0"
@@ -75,7 +75,7 @@
75
75
  }
76
76
  },
77
77
  "libraries": {
78
- "Fossa.Bridge/0.1.4": {
78
+ "Fossa.Bridge/0.1.5": {
79
79
  "type": "project",
80
80
  "serviceable": false,
81
81
  "sha512": ""
@@ -2,10 +2,10 @@
2
2
  <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3
3
  <metadata>
4
4
  <id>Fossa.Bridge</id>
5
- <version>0.1.4</version>
5
+ <version>0.1.5</version>
6
6
  <authors>TIKSN</authors>
7
7
  <description>Shared Domain Models and DTOs for Fossa UI and API</description>
8
- <repository type="git" commit="55d564b7a13d179b4b07862856f928d22586a243" />
8
+ <repository type="git" commit="00fcff73a156f62b5ccacbd84fa794671cb07f22" />
9
9
  <dependencies>
10
10
  <group targetFramework="net8.0">
11
11
  <dependency id="FSharp.Core" version="10.0.102" exclude="Build,Analyzers" />
@@ -10,9 +10,9 @@ open System.Reflection
10
10
  [<assembly: System.Reflection.AssemblyCompanyAttribute("TIKSN")>]
11
11
  [<assembly: System.Reflection.AssemblyConfigurationAttribute("Release")>]
12
12
  [<assembly: System.Reflection.AssemblyDescriptionAttribute("Shared Domain Models and DTOs for Fossa UI and API")>]
13
- [<assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.4.0")>]
14
- [<assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.1.4+55d564b7a13d179b4b07862856f928d22586a243")>]
13
+ [<assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.5.0")>]
14
+ [<assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.1.5+00fcff73a156f62b5ccacbd84fa794671cb07f22")>]
15
15
  [<assembly: System.Reflection.AssemblyProductAttribute("Fossa.Bridge")>]
16
16
  [<assembly: System.Reflection.AssemblyTitleAttribute("Fossa.Bridge")>]
17
- [<assembly: System.Reflection.AssemblyVersionAttribute("0.1.4.0")>]
17
+ [<assembly: System.Reflection.AssemblyVersionAttribute("0.1.5.0")>]
18
18
  do()
@@ -14,7 +14,7 @@ using System.Reflection;
14
14
  [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
15
15
  [assembly: System.Reflection.AssemblyDescriptionAttribute("Shared Domain Models and DTOs for Fossa UI and API")]
16
16
  [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
17
- [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+55d564b7a13d179b4b07862856f928d22586a243")]
17
+ [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+00fcff73a156f62b5ccacbd84fa794671cb07f22")]
18
18
  [assembly: System.Reflection.AssemblyProductAttribute("Fossa.Bridge.fable-temp")]
19
19
  [assembly: System.Reflection.AssemblyTitleAttribute("Fossa.Bridge.fable-temp")]
20
20
  [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
1
- {"documents":{"/home/runner/work/Bridge/Bridge/*":"https://raw.githubusercontent.com/fossa-app/Bridge/55d564b7a13d179b4b07862856f928d22586a243/*"}}
1
+ {"documents":{"/home/runner/work/Bridge/Bridge/*":"https://raw.githubusercontent.com/fossa-app/Bridge/00fcff73a156f62b5ccacbd84fa794671cb07f22/*"}}
@@ -10,7 +10,7 @@ open System.Reflection
10
10
  [<assembly: System.Reflection.AssemblyCompanyAttribute("Fossa.Bridge.Tests")>]
11
11
  [<assembly: System.Reflection.AssemblyConfigurationAttribute("Release")>]
12
12
  [<assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")>]
13
- [<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+55d564b7a13d179b4b07862856f928d22586a243")>]
13
+ [<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+00fcff73a156f62b5ccacbd84fa794671cb07f22")>]
14
14
  [<assembly: System.Reflection.AssemblyProductAttribute("Fossa.Bridge.Tests")>]
15
15
  [<assembly: System.Reflection.AssemblyTitleAttribute("Fossa.Bridge.Tests")>]
16
16
  [<assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")>]
@@ -1 +1 @@
1
- {"documents":{"/home/runner/work/Bridge/Bridge/*":"https://raw.githubusercontent.com/fossa-app/Bridge/55d564b7a13d179b4b07862856f928d22586a243/*"}}
1
+ {"documents":{"/home/runner/work/Bridge/Bridge/*":"https://raw.githubusercontent.com/fossa-app/Bridge/00fcff73a156f62b5ccacbd84fa794671cb07f22/*"}}