Skip to content

Commit 4ad911e

Browse files
authored
Merge pull request #48 from fossa-app/unified-api-clients
feat: add IClients interface and Clients implementation for improved service management
2 parents 56f7ff6 + 40854a0 commit 4ad911e

4 files changed

Lines changed: 54 additions & 5 deletions

File tree

.build.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Task PackNPM Build, Test, {
246246
$fablePattern = "$($fableOutputArtifactsFolder.Replace('\', '/'))/**/*"
247247
$distPath = $distArtifactsFolder.Replace('\', '/')
248248
$fablePath = $fableOutputArtifactsFolder.Replace('\', '/')
249-
249+
250250
$tempTsConfig = @"
251251
{
252252
`"extends`": `"$baseTsConfig`",
@@ -270,15 +270,15 @@ Task PackNPM Build, Test, {
270270
$packageJsonPath = Resolve-Path -Path 'package.json'
271271
$packageJsonContent = Get-Content -Path $packageJsonPath -Raw | ConvertFrom-Json
272272
$packageJsonContent.version = $nextVersion.ToString()
273-
273+
274274
$packageJsonContent | ConvertTo-Json -Depth 10 | Set-Content -Path (Join-Path -Path $distArtifactsFolder -ChildPath 'package.json')
275-
275+
276276
Get-ChildItem -Path 'README.md', 'LICENSE' -File | Copy-Item -Destination $distArtifactsFolder
277-
277+
278278
Exec { npm version '1.0.0' --no-git-tag-version --allow-same-version }
279279

280280
Exec { npm pack $distArtifactsFolder --pack-destination $buildArtifactsFolder }
281-
281+
282282
$npmPackage = Get-ChildItem -Path $buildArtifactsFolder -Filter '*.tgz' | Select-Object -First 1
283283

284284
$state.NPMPackagePath = $npmPackage.FullName

src/Bridge/Bridge.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
<Compile Include="Services\Clients\CompanyLicenseClient.fs" />
3737
<Compile Include="Services\Clients\ISystemLicenseClient.fs" />
3838
<Compile Include="Services\Clients\SystemLicenseClient.fs" />
39+
<Compile Include="Services\IClients.fs" />
40+
<Compile Include="Services\Clients.fs" />
3941
</ItemGroup>
4042
<ItemGroup>
4143
<PackageReference Include="Fable.Core" Version="4.5.0" />

src/Bridge/Services/Clients.fs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace Fossa.Bridge.Services.Clients
2+
3+
open Fossa.Bridge.Services
4+
5+
open Fossa.Bridge.Services.Clients
6+
7+
type Clients(transport: IHttpTransport) =
8+
let branchClient: IBranchClient = BranchClient(transport) :> IBranchClient
9+
let companyClient: ICompanyClient = CompanyClient(transport) :> ICompanyClient
10+
11+
let companyLicenseClient: ICompanyLicenseClient =
12+
CompanyLicenseClient(transport) :> ICompanyLicenseClient
13+
14+
let companySettingsClient: ICompanySettingsClient =
15+
CompanySettingsClient(transport) :> ICompanySettingsClient
16+
17+
let departmentClient: IDepartmentClient =
18+
DepartmentClient(transport) :> IDepartmentClient
19+
20+
let employeeClient: IEmployeeClient = EmployeeClient(transport) :> IEmployeeClient
21+
let identityClient: IIdentityClient = IdentityClient(transport) :> IIdentityClient
22+
23+
let systemLicenseClient: ISystemLicenseClient =
24+
SystemLicenseClient(transport) :> ISystemLicenseClient
25+
26+
interface IClients with
27+
member _.BranchClient = branchClient
28+
member _.CompanyClient = companyClient
29+
member _.CompanyLicenseClient = companyLicenseClient
30+
member _.CompanySettingsClient = companySettingsClient
31+
member _.DepartmentClient = departmentClient
32+
member _.EmployeeClient = employeeClient
33+
member _.IdentityClient = identityClient
34+
member _.SystemLicenseClient = systemLicenseClient

src/Bridge/Services/IClients.fs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Fossa.Bridge.Services
2+
3+
open Fossa.Bridge.Services.Clients
4+
5+
type IClients =
6+
abstract BranchClient: IBranchClient
7+
abstract CompanyClient: ICompanyClient
8+
abstract CompanyLicenseClient: ICompanyLicenseClient
9+
abstract CompanySettingsClient: ICompanySettingsClient
10+
abstract DepartmentClient: IDepartmentClient
11+
abstract EmployeeClient: IEmployeeClient
12+
abstract IdentityClient: IIdentityClient
13+
abstract SystemLicenseClient: ISystemLicenseClient

0 commit comments

Comments
 (0)