added sample client with sample autogenerated client code
as per Visual Studio Extension
This commit is contained in:
parent
161553a84f
commit
c02e51c427
9
src/BreCalClient/App.xaml
Normal file
9
src/BreCalClient/App.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application x:Class="BreCalClient.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:BreCalClient"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
src/BreCalClient/App.xaml.cs
Normal file
17
src/BreCalClient/App.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
10
src/BreCalClient/AssemblyInfo.cs
Normal file
10
src/BreCalClient/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
10
src/BreCalClient/BreCalClient.csproj
Normal file
10
src/BreCalClient/BreCalClient.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
src/BreCalClient/BreCalClient.sln
Normal file
25
src/BreCalClient/BreCalClient.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33627.172
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BreCalClient", "BreCalClient.csproj", "{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {CBF797A4-0CAF-4F01-B0D5-708702165337}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
12
src/BreCalClient/MainWindow.xaml
Normal file
12
src/BreCalClient/MainWindow.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<Window x:Class="BreCalClient.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:BreCalClient"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
28
src/BreCalClient/MainWindow.xaml.cs
Normal file
28
src/BreCalClient/MainWindow.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
2167
src/BreCalClient/Swagger.cs
Normal file
2167
src/BreCalClient/Swagger.cs
Normal file
File diff suppressed because it is too large
Load Diff
484
src/BreCalClient/Swagger.yaml
Normal file
484
src/BreCalClient/Swagger.yaml
Normal file
@ -0,0 +1,484 @@
|
||||
openapi: '3.0.0'
|
||||
info:
|
||||
version: '1.0.0'
|
||||
title: 'Bremen calling API'
|
||||
description: Administer DEBRE ship calls, times and notifications
|
||||
termsOfService: "https://www.bsmd.de/" # url to terms page
|
||||
contact:
|
||||
name: "Bremen calling API"
|
||||
url: "https://www.textbausteine.net"
|
||||
email: "info@textbausteine.net"
|
||||
license:
|
||||
name: "Use at your own risk"
|
||||
url: "https://www.bsmd.de/license"
|
||||
|
||||
servers:
|
||||
# tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step3_servers_object.html
|
||||
- url : "https://puls200.dyn-dns.org:8088/brecal/api"
|
||||
description: "Test server self-hosted by yours truly"
|
||||
|
||||
paths:
|
||||
# tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html
|
||||
/verify:
|
||||
get:
|
||||
summary: Returns a session key if successful
|
||||
responses:
|
||||
200:
|
||||
description: Successful response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
title: Session key
|
||||
type: string
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
403:
|
||||
$ref: '#/components/responses/403'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
/shipcalls:
|
||||
get:
|
||||
summary: Gets a list of ship calls
|
||||
parameters:
|
||||
- name: participant_id
|
||||
in: query
|
||||
required: true
|
||||
description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls"
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
200:
|
||||
description: ship call list
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/shipcalls'
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
post:
|
||||
summary: Create a new ship call
|
||||
requestBody:
|
||||
description: Creates a new ship call. **Do not** provide id parameter.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/shipcall'
|
||||
responses:
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
put:
|
||||
summary: Updates a ship call
|
||||
requestBody:
|
||||
description: Creates a new ship call. The id parameter is **required**.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/shipcall'
|
||||
responses:
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
/ships:
|
||||
get:
|
||||
summary: gets a list of registered shipcalls
|
||||
responses:
|
||||
200:
|
||||
description: list of ships
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ship_list'
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
/participant:
|
||||
get:
|
||||
summary: gets a particular participant entry corresponding to user id
|
||||
parameters:
|
||||
- name: user_id
|
||||
in: query
|
||||
required: true
|
||||
description: "**Id of user**. *Example: 2*. User id returned by verify call."
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
200:
|
||||
description: ship call list
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/participant'
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
/times:
|
||||
get:
|
||||
summary: Get all recorded times for a a ship call
|
||||
parameters:
|
||||
- name: shipcall_id
|
||||
in: query
|
||||
description: "**Id**. *Example: 42*. Id of referenced ship call."
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
200:
|
||||
description: list of recorded times
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/times_list'
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
post:
|
||||
summary: Create a new times entry for a ship call
|
||||
requestBody:
|
||||
description: Times entry that will be added to the ship call. **Do not** provide id parameter.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/times'
|
||||
responses:
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
put:
|
||||
summary: Update a times entry for a ship call
|
||||
requestBody:
|
||||
description: Times entry that will be added to the ship call. The id parameter is **required**.
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/times'
|
||||
responses:
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
delete:
|
||||
summary: Delete a times entry for a ship call.
|
||||
parameters:
|
||||
- name: id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/components/schemas/timesId'
|
||||
responses:
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
|
||||
/notifications:
|
||||
get:
|
||||
summary: Gets a list of notifications pursuant to a specified participant and ship call
|
||||
parameters:
|
||||
- name: participant_id
|
||||
in: query
|
||||
required: true
|
||||
description: "**Id of participant**. *Example: 2*. Id returned through loading of participant"
|
||||
schema:
|
||||
type: integer
|
||||
- name: shipcall_id
|
||||
in: query
|
||||
required: true
|
||||
description: "**Id of ship call**. *Example: 52*. Id given in ship call list"
|
||||
schema:
|
||||
$ref: '#/components/schemas/shipcallId'
|
||||
responses:
|
||||
200:
|
||||
description: notification list
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/notification'
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
/berths:
|
||||
get:
|
||||
summary: Gets a list of all berths registered
|
||||
responses:
|
||||
200:
|
||||
description: list of berths
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/berth_list'
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
401:
|
||||
$ref: '#/components/responses/401'
|
||||
500:
|
||||
$ref: '#/components/responses/500'
|
||||
503:
|
||||
$ref: '#/components/responses/503'
|
||||
components:
|
||||
schemas:
|
||||
timesId:
|
||||
description: The unique identifier for a times entry
|
||||
type: integer
|
||||
shipcallId:
|
||||
description: The unique identifier of a ship call
|
||||
type: integer
|
||||
shipcall:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- ship_id
|
||||
- type
|
||||
- eta
|
||||
- voyage
|
||||
- etd
|
||||
properties:
|
||||
id:
|
||||
$ref: '#/components/schemas/shipcallId'
|
||||
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- incoming
|
||||
- outgoing
|
||||
- shifting
|
||||
|
||||
description:
|
||||
type: string
|
||||
|
||||
shipcalls:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipcall'
|
||||
|
||||
times:
|
||||
type: object
|
||||
description: the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated
|
||||
required:
|
||||
- shipcall_id
|
||||
- participant_id
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
start_planned:
|
||||
type: string
|
||||
format: date-time
|
||||
end_planned:
|
||||
type: string
|
||||
format: date-time
|
||||
duration_planned:
|
||||
type: integer
|
||||
start_actual:
|
||||
type: string
|
||||
format: date-time
|
||||
end_actual:
|
||||
type: string
|
||||
format: date-time
|
||||
shipcall_id:
|
||||
type: integer
|
||||
participant_id:
|
||||
type: integer
|
||||
|
||||
times_list:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/times'
|
||||
|
||||
berth:
|
||||
type: object
|
||||
description: Ship berth used for a ship call
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name1:
|
||||
type: string
|
||||
name2:
|
||||
type: string
|
||||
|
||||
berth_list:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/berth'
|
||||
|
||||
ship:
|
||||
type: object
|
||||
description: a ship
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
imo:
|
||||
type: integer
|
||||
callsign:
|
||||
type: string
|
||||
length:
|
||||
type: number
|
||||
format: float
|
||||
width:
|
||||
type: number
|
||||
format: float
|
||||
created:
|
||||
type: string
|
||||
format: date-time
|
||||
modified:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
ship_list:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ship'
|
||||
|
||||
notification:
|
||||
type: object
|
||||
description: a notification created by the engine if a times entry violates a rule
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
times_id:
|
||||
type: integer
|
||||
participant_id:
|
||||
type: integer
|
||||
notification_type:
|
||||
type: string
|
||||
enum: [undefined, email, push]
|
||||
timestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
acknowledged:
|
||||
type: boolean
|
||||
|
||||
notification_list:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/notification'
|
||||
|
||||
participant:
|
||||
type: object
|
||||
description: A organisational entity that participates in Bremen Calling
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
street:
|
||||
type: string
|
||||
postal code:
|
||||
type: string
|
||||
city:
|
||||
type: string
|
||||
|
||||
Error:
|
||||
type: object
|
||||
required:
|
||||
- message
|
||||
properties:
|
||||
message:
|
||||
description: A human readable error message
|
||||
type: string
|
||||
|
||||
securitySchemes:
|
||||
ApiKey:
|
||||
type: apiKey
|
||||
in: header
|
||||
name: X-Api-Key
|
||||
responses:
|
||||
400:
|
||||
description: Invalid input
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
401:
|
||||
description: Not authorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
403:
|
||||
description: Forbidden
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
500:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
503:
|
||||
description: Not available
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
security:
|
||||
- ApiKey: []
|
||||
externalDocs:
|
||||
url: http://textbausteine.net/
|
||||
description: Extra documentation and conditions for Bremen Calling
|
||||
Reference in New Issue
Block a user