@fossa-app/bridge 0.1.1 → 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/.build.ps1 +17 -25
- package/.github/dependabot.yml +38 -38
- package/.github/release-drafter.yml +52 -52
- package/.github/workflows/cicd.yml +87 -106
- package/.github/workflows/lint.yml +34 -34
- package/.github/workflows/release-drafter.yml +27 -27
- package/Fossa.Bridge.slnx +7 -7
- package/LICENSE +21 -21
- package/README.md +42 -42
- package/build.ps1 +11 -11
- package/dotnet-tools.json +26 -26
- package/format.ps1 +11 -11
- package/gig.ps1 +15 -15
- package/global.json +6 -6
- package/lint.ps1 +20 -20
- package/pack.ps1 +11 -11
- package/package.json +21 -21
- package/publish.ps1 +11 -11
- package/restore.ps1 +11 -11
- package/src/Fossa.Bridge/Fossa.Bridge.fsproj +26 -16
- package/src/Fossa.Bridge/Models/ApiModels.fs +142 -136
- package/src/Fossa.Bridge/Services/Clients/BranchClient.fs +46 -0
- package/src/Fossa.Bridge/Services/Clients/CompanyClient.fs +24 -0
- package/src/Fossa.Bridge/Services/Clients/CompanyLicenseClient.fs +17 -0
- package/src/Fossa.Bridge/Services/Clients/CompanySettingsClient.fs +24 -0
- package/src/Fossa.Bridge/Services/Clients/DepartmentClient.fs +48 -0
- package/src/Fossa.Bridge/Services/Clients/EmployeeClient.fs +71 -0
- package/src/Fossa.Bridge/Services/Clients/IdentityClient.fs +9 -0
- package/src/Fossa.Bridge/Services/Clients/SystemLicenseClient.fs +11 -0
- package/src/Fossa.Bridge/Services/Endpoints.fs +13 -0
- package/src/Fossa.Bridge/Services/IHttpTransport.fs +10 -0
- package/src/Fossa.Bridge/Services/UrlHelpers.fs +18 -18
- package/src/Fossa.Bridge/bin/Release/net8.0/Fossa.Bridge.deps.json +97 -97
- package/src/Fossa.Bridge/bin/Release/net8.0/Fossa.Bridge.fable-temp.deps.json +40 -40
- package/src/Fossa.Bridge/bin/Release/net8.0/Fossa.Bridge.xml +6 -6
- package/src/Fossa.Bridge/obj/Fossa.Bridge.fable-temp.csproj.nuget.dgspec.json +82 -80
- package/src/Fossa.Bridge/obj/Fossa.Bridge.fable-temp.csproj.nuget.g.props +24 -25
- package/src/Fossa.Bridge/obj/Fossa.Bridge.fable-temp.csproj.nuget.g.targets +1 -1
- package/src/Fossa.Bridge/obj/Fossa.Bridge.fsproj.nuget.dgspec.json +85 -83
- package/src/Fossa.Bridge/obj/Fossa.Bridge.fsproj.nuget.g.props +28 -29
- package/src/Fossa.Bridge/obj/Fossa.Bridge.fsproj.nuget.g.targets +1 -1
- package/src/Fossa.Bridge/obj/Release/{Fossa.Bridge.0.1.1.nuspec → Fossa.Bridge.0.1.5.nuspec} +19 -19
- package/src/Fossa.Bridge/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -4
- package/src/Fossa.Bridge/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.fs +3 -3
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.AssemblyInfo.fs +11 -11
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.fable-temp.AssemblyInfo.cs +23 -23
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.fable-temp.GeneratedMSBuildEditorConfig.editorconfig +17 -17
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.fable-temp.csproj.FileListAbsolute.txt +4 -4
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.fsproj.FileListAbsolute.txt +14 -14
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.sourcelink.json +1 -1
- package/src/Fossa.Bridge/obj/Release/net8.0/Fossa.Bridge.xml +6 -6
- package/src/Fossa.Bridge/obj/Release/net8.0/ILLink.Substitutions.xml +15 -15
- package/src/Fossa.Bridge/obj/project.assets.json +229 -228
- package/test.ps1 +11 -11
- package/tests/Fossa.Bridge.Tests/Fossa.Bridge.Tests.fsproj +18 -18
- package/tests/Fossa.Bridge.Tests/Main.fs +7 -7
- package/tests/Fossa.Bridge.Tests/UrlHelpersTests.fs +33 -33
- package/tests/Fossa.Bridge.Tests/bin/Release/net8.0/.msCoverageSourceRootsMapping_Fossa.Bridge.Tests +0 -0
- package/tests/Fossa.Bridge.Tests/bin/Release/net8.0/Fossa.Bridge.Tests +0 -0
- package/tests/Fossa.Bridge.Tests/bin/Release/net8.0/Fossa.Bridge.Tests.deps.json +805 -805
- package/tests/Fossa.Bridge.Tests/bin/Release/net8.0/Fossa.Bridge.Tests.runtimeconfig.json +13 -13
- package/tests/Fossa.Bridge.Tests/bin/Release/net8.0/Fossa.Bridge.xml +6 -6
- package/tests/Fossa.Bridge.Tests/obj/Fossa.Bridge.Tests.fsproj.nuget.dgspec.json +181 -173
- package/tests/Fossa.Bridge.Tests/obj/Fossa.Bridge.Tests.fsproj.nuget.g.props +29 -30
- package/tests/Fossa.Bridge.Tests/obj/Fossa.Bridge.Tests.fsproj.nuget.g.targets +10 -10
- package/tests/Fossa.Bridge.Tests/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.fs +3 -3
- package/tests/Fossa.Bridge.Tests/obj/Release/net8.0/Fossa.Bridge.Tests.AssemblyInfo.fs +10 -10
- package/tests/Fossa.Bridge.Tests/obj/Release/net8.0/Fossa.Bridge.Tests.fsproj.FileListAbsolute.txt +190 -191
- package/tests/Fossa.Bridge.Tests/obj/Release/net8.0/Fossa.Bridge.Tests.sourcelink.json +1 -1
- package/tests/Fossa.Bridge.Tests/obj/Release/net8.0/ILLink.Substitutions.xml +15 -15
- package/tests/Fossa.Bridge.Tests/obj/Release/net8.0/apphost +0 -0
- package/tests/Fossa.Bridge.Tests/obj/project.assets.json +2022 -2017
- package/trigger.ps1 +32 -32
- package/tsconfig.json +15 -15
- package/version.ps1 +11 -11
|
@@ -1,136 +1,142 @@
|
|
|
1
|
-
namespace Fossa.Bridge.Models
|
|
2
|
-
|
|
3
|
-
open System
|
|
4
|
-
open System.Collections.Generic
|
|
5
|
-
|
|
6
|
-
type AddressModel =
|
|
7
|
-
{ Line1: string
|
|
8
|
-
Line2: string
|
|
9
|
-
City: string
|
|
10
|
-
Subdivision: string
|
|
11
|
-
PostalCode: string
|
|
12
|
-
CountryCode: string }
|
|
13
|
-
|
|
14
|
-
type
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type
|
|
26
|
-
{ Id: int64
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
type
|
|
66
|
-
{ Id: int64
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
type
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
type
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
PageNumber: Nullable<int>
|
|
91
|
-
PageSize: Nullable<int>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
type
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
type
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
namespace Fossa.Bridge.Models
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
open System.Collections.Generic
|
|
5
|
+
|
|
6
|
+
type AddressModel =
|
|
7
|
+
{ Line1: string
|
|
8
|
+
Line2: string
|
|
9
|
+
City: string
|
|
10
|
+
Subdivision: string
|
|
11
|
+
PostalCode: string
|
|
12
|
+
CountryCode: string }
|
|
13
|
+
|
|
14
|
+
type ClientRetrievalModel =
|
|
15
|
+
{ ClientId: Guid
|
|
16
|
+
ClientName: string
|
|
17
|
+
TenantId: Guid }
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
type BranchModificationModel =
|
|
21
|
+
{ Name: string
|
|
22
|
+
TimeZoneId: string
|
|
23
|
+
Address: AddressModel }
|
|
24
|
+
|
|
25
|
+
type BranchQueryRequestModel =
|
|
26
|
+
{ Id: IReadOnlyList<int64>
|
|
27
|
+
Search: string
|
|
28
|
+
PageNumber: Nullable<int>
|
|
29
|
+
PageSize: Nullable<int> }
|
|
30
|
+
|
|
31
|
+
type BranchRetrievalModel =
|
|
32
|
+
{ Id: int64
|
|
33
|
+
CompanyId: int64
|
|
34
|
+
Name: string
|
|
35
|
+
TimeZoneId: string
|
|
36
|
+
Address: AddressModel }
|
|
37
|
+
|
|
38
|
+
type CompanyEntitlementsModel =
|
|
39
|
+
{ CompanyId: int64
|
|
40
|
+
MaximumBranchCount: int
|
|
41
|
+
MaximumEmployeeCount: int
|
|
42
|
+
MaximumDepartmentCount: int }
|
|
43
|
+
|
|
44
|
+
type CompanyModificationModel = { Name: string; CountryCode: string }
|
|
45
|
+
|
|
46
|
+
type CompanyRetrievalModel =
|
|
47
|
+
{ Id: int64
|
|
48
|
+
Name: string
|
|
49
|
+
CountryCode: string }
|
|
50
|
+
|
|
51
|
+
type CompanySettingsModificationModel = { ColorSchemeId: string }
|
|
52
|
+
|
|
53
|
+
type CompanySettingsRetrievalModel =
|
|
54
|
+
{ Id: int64
|
|
55
|
+
CompanyId: int64
|
|
56
|
+
ColorSchemeId: string }
|
|
57
|
+
|
|
58
|
+
type CountryModel = { Name: string; Code: string }
|
|
59
|
+
|
|
60
|
+
type DepartmentModificationModel =
|
|
61
|
+
{ Name: string
|
|
62
|
+
ParentDepartmentId: Nullable<int64>
|
|
63
|
+
ManagerId: Nullable<int64> }
|
|
64
|
+
|
|
65
|
+
type DepartmentQueryRequestModel =
|
|
66
|
+
{ Id: IReadOnlyList<int64>
|
|
67
|
+
Search: string
|
|
68
|
+
PageNumber: Nullable<int>
|
|
69
|
+
PageSize: Nullable<int> }
|
|
70
|
+
|
|
71
|
+
type DepartmentRetrievalModel =
|
|
72
|
+
{ Id: int64
|
|
73
|
+
Name: string
|
|
74
|
+
ParentDepartmentId: Nullable<int64>
|
|
75
|
+
ManagerId: int64 }
|
|
76
|
+
|
|
77
|
+
type EmployeeManagementModel =
|
|
78
|
+
{ AssignedBranchId: Nullable<int64>
|
|
79
|
+
AssignedDepartmentId: Nullable<int64>
|
|
80
|
+
ReportsToId: Nullable<int64>
|
|
81
|
+
JobTitle: string }
|
|
82
|
+
|
|
83
|
+
type EmployeeModificationModel =
|
|
84
|
+
{ FirstName: string
|
|
85
|
+
LastName: string
|
|
86
|
+
FullName: string }
|
|
87
|
+
|
|
88
|
+
type EmployeePagingRequestModel =
|
|
89
|
+
{ Search: string
|
|
90
|
+
PageNumber: Nullable<int>
|
|
91
|
+
PageSize: Nullable<int> }
|
|
92
|
+
|
|
93
|
+
type EmployeeQueryRequestModel =
|
|
94
|
+
{ Id: IReadOnlyList<int64>
|
|
95
|
+
Search: string
|
|
96
|
+
PageNumber: Nullable<int>
|
|
97
|
+
PageSize: Nullable<int>
|
|
98
|
+
ReportsToId: Nullable<int64>
|
|
99
|
+
TopLevelOnly: Nullable<bool> }
|
|
100
|
+
|
|
101
|
+
type EmployeeRetrievalModel =
|
|
102
|
+
{ Id: int64
|
|
103
|
+
CompanyId: int64
|
|
104
|
+
AssignedBranchId: Nullable<int64>
|
|
105
|
+
AssignedDepartmentId: Nullable<int64>
|
|
106
|
+
ReportsToId: Nullable<int64>
|
|
107
|
+
JobTitle: string
|
|
108
|
+
FirstName: string
|
|
109
|
+
LastName: string
|
|
110
|
+
FullName: string }
|
|
111
|
+
|
|
112
|
+
type TimeZoneModel =
|
|
113
|
+
{ Id: string
|
|
114
|
+
Name: string
|
|
115
|
+
CountryCode: string
|
|
116
|
+
CurrentOffset: TimeSpan }
|
|
117
|
+
|
|
118
|
+
type PartyModel = { LongName: string; ShortName: string }
|
|
119
|
+
|
|
120
|
+
type LicenseTermsModel =
|
|
121
|
+
{ Licensor: PartyModel
|
|
122
|
+
Licensee: PartyModel
|
|
123
|
+
NotBefore: DateTimeOffset
|
|
124
|
+
NotAfter: DateTimeOffset }
|
|
125
|
+
|
|
126
|
+
type LicenseResponseModel<'TEntitlementsModel> =
|
|
127
|
+
{ Terms: LicenseTermsModel
|
|
128
|
+
Entitlements: 'TEntitlementsModel }
|
|
129
|
+
|
|
130
|
+
type PagingResponseModel<'T> =
|
|
131
|
+
{ PageNumber: Nullable<int>
|
|
132
|
+
PageSize: Nullable<int>
|
|
133
|
+
Items: IReadOnlyCollection<'T>
|
|
134
|
+
TotalItems: Nullable<int64>
|
|
135
|
+
TotalPages: Nullable<int64> }
|
|
136
|
+
|
|
137
|
+
type SystemEntitlementsModel =
|
|
138
|
+
{ EnvironmentName: string
|
|
139
|
+
EnvironmentKind: string
|
|
140
|
+
Countries: IReadOnlyList<CountryModel>
|
|
141
|
+
TimeZones: IReadOnlyList<TimeZoneModel>
|
|
142
|
+
MaximumCompanyCount: int }
|
|
@@ -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>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
module Fossa.Bridge.Services.UrlHelpers
|
|
2
|
-
|
|
3
|
-
let private suffixMappings =
|
|
4
|
-
[ ".dev.localhost:4211", ".dev.localhost:5210"
|
|
5
|
-
".test.localhost:4210", ".test.localhost:5211"
|
|
6
|
-
".test.localhost:4211", ".test.localhost:5211"
|
|
7
|
-
".localhost:4210", ".localhost:5210" ]
|
|
8
|
-
|
|
9
|
-
let getBackendOrigin (frontendOrigin: string) : string =
|
|
10
|
-
let mapping =
|
|
11
|
-
suffixMappings
|
|
12
|
-
|> List.tryFind (fun (frontendSuffix, _) -> frontendOrigin.EndsWith(frontendSuffix))
|
|
13
|
-
|
|
14
|
-
match mapping with
|
|
15
|
-
| Some(frontendSuffix, backendSuffix) ->
|
|
16
|
-
let prefixLength = frontendOrigin.Length - frontendSuffix.Length
|
|
17
|
-
frontendOrigin.Substring(0, prefixLength) + backendSuffix
|
|
18
|
-
| None -> frontendOrigin
|
|
1
|
+
module Fossa.Bridge.Services.UrlHelpers
|
|
2
|
+
|
|
3
|
+
let private suffixMappings =
|
|
4
|
+
[ ".dev.localhost:4211", ".dev.localhost:5210"
|
|
5
|
+
".test.localhost:4210", ".test.localhost:5211"
|
|
6
|
+
".test.localhost:4211", ".test.localhost:5211"
|
|
7
|
+
".localhost:4210", ".localhost:5210" ]
|
|
8
|
+
|
|
9
|
+
let getBackendOrigin (frontendOrigin: string) : string =
|
|
10
|
+
let mapping =
|
|
11
|
+
suffixMappings
|
|
12
|
+
|> List.tryFind (fun (frontendSuffix, _) -> frontendOrigin.EndsWith(frontendSuffix))
|
|
13
|
+
|
|
14
|
+
match mapping with
|
|
15
|
+
| Some(frontendSuffix, backendSuffix) ->
|
|
16
|
+
let prefixLength = frontendOrigin.Length - frontendSuffix.Length
|
|
17
|
+
frontendOrigin.Substring(0, prefixLength) + backendSuffix
|
|
18
|
+
| None -> frontendOrigin
|