extended OpenAPI with port endpoint and refs, adjusted some code to compile
This commit is contained in:
parent
a2c56e9696
commit
6a6ffa38f9
2688
misc/BreCalApi.cs
2688
misc/BreCalApi.cs
File diff suppressed because it is too large
Load Diff
@ -705,9 +705,11 @@ paths:
|
|||||||
- id: 3
|
- id: 3
|
||||||
name: Pier 1
|
name: Pier 1
|
||||||
owner_id: 5
|
owner_id: 5
|
||||||
|
port_id: 3
|
||||||
- id: 4
|
- id: 4
|
||||||
name: Pier 2
|
name: Pier 2
|
||||||
owner_id: 5
|
owner_id: 5
|
||||||
|
port_id: 3
|
||||||
'400':
|
'400':
|
||||||
$ref: '#/components/responses/400'
|
$ref: '#/components/responses/400'
|
||||||
'401':
|
'401':
|
||||||
@ -758,6 +760,36 @@ paths:
|
|||||||
$ref: '#/components/responses/500'
|
$ref: '#/components/responses/500'
|
||||||
'503':
|
'503':
|
||||||
$ref: '#/components/responses/503'
|
$ref: '#/components/responses/503'
|
||||||
|
/ports:
|
||||||
|
get:
|
||||||
|
summary: Your GET endpoint
|
||||||
|
description: Returns a list of ports
|
||||||
|
tags:
|
||||||
|
- static
|
||||||
|
operationId: get-ports
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: list of ports
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/port_list'
|
||||||
|
example:
|
||||||
|
- id: 3
|
||||||
|
name: Bremen
|
||||||
|
country: Germany
|
||||||
|
- id: 4
|
||||||
|
name: Hamburg
|
||||||
|
country: Germany
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/401'
|
||||||
|
'403':
|
||||||
|
$ref: '#/components/responses/403'
|
||||||
|
'500':
|
||||||
|
$ref: '#/components/responses/500'
|
||||||
|
'503':
|
||||||
|
$ref: '#/components/responses/503'
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
credentials:
|
credentials:
|
||||||
@ -808,6 +840,7 @@ components:
|
|||||||
example:
|
example:
|
||||||
id: 6
|
id: 6
|
||||||
ship_id: 8
|
ship_id: 8
|
||||||
|
port_id: 1
|
||||||
type: arrival
|
type: arrival
|
||||||
eta: '2023-08-21T08:23:35Z'
|
eta: '2023-08-21T08:23:35Z'
|
||||||
voyage: Voyage 123
|
voyage: Voyage 123
|
||||||
@ -846,6 +879,9 @@ components:
|
|||||||
ship_id:
|
ship_id:
|
||||||
type: integer
|
type: integer
|
||||||
example: 8
|
example: 8
|
||||||
|
port_id:
|
||||||
|
type: integer
|
||||||
|
example: 3
|
||||||
type:
|
type:
|
||||||
$ref: '#/components/schemas/ShipcallType'
|
$ref: '#/components/schemas/ShipcallType'
|
||||||
eta:
|
eta:
|
||||||
@ -978,6 +1014,7 @@ components:
|
|||||||
example:
|
example:
|
||||||
- id: 6
|
- id: 6
|
||||||
ship_id: 8
|
ship_id: 8
|
||||||
|
port_id: 1
|
||||||
type: arrival
|
type: arrival
|
||||||
eta: '2023-08-21T08:23:35Z'
|
eta: '2023-08-21T08:23:35Z'
|
||||||
voyage: Voyage 123
|
voyage: Voyage 123
|
||||||
@ -1011,6 +1048,7 @@ components:
|
|||||||
modified: '2023-08-21T08:23:35Z'
|
modified: '2023-08-21T08:23:35Z'
|
||||||
- id: 7
|
- id: 7
|
||||||
ship_id: 8
|
ship_id: 8
|
||||||
|
port_id: 1
|
||||||
type: departure
|
type: departure
|
||||||
eta: '2023-08-21T08:23:35Z'
|
eta: '2023-08-21T08:23:35Z'
|
||||||
voyage: Voyage 123
|
voyage: Voyage 123
|
||||||
@ -1281,6 +1319,11 @@ components:
|
|||||||
nullable: true
|
nullable: true
|
||||||
description: If true lock must be passed
|
description: If true lock must be passed
|
||||||
example: true
|
example: true
|
||||||
|
port_id:
|
||||||
|
type: integer
|
||||||
|
nullable: false
|
||||||
|
description: Required reference to a port
|
||||||
|
example: 1
|
||||||
created:
|
created:
|
||||||
description: Readonly field set by the database when berth was created
|
description: Readonly field set by the database when berth was created
|
||||||
type: string
|
type: string
|
||||||
@ -1303,6 +1346,7 @@ components:
|
|||||||
owner_id: 5
|
owner_id: 5
|
||||||
authority_id: 6
|
authority_id: 6
|
||||||
lock: true
|
lock: true
|
||||||
|
port_id: 1
|
||||||
created: '2023-08-21T08:23:35Z'
|
created: '2023-08-21T08:23:35Z'
|
||||||
modified: '2023-08-21T08:23:35Z'
|
modified: '2023-08-21T08:23:35Z'
|
||||||
deleted: false
|
deleted: false
|
||||||
@ -1317,6 +1361,7 @@ components:
|
|||||||
owner_id: 5
|
owner_id: 5
|
||||||
authority_id: 6
|
authority_id: 6
|
||||||
lock: true
|
lock: true
|
||||||
|
port_id: 1
|
||||||
created: '2023-08-21T08:23:35Z'
|
created: '2023-08-21T08:23:35Z'
|
||||||
modified: '2023-08-21T08:23:35Z'
|
modified: '2023-08-21T08:23:35Z'
|
||||||
deleted: false
|
deleted: false
|
||||||
@ -1325,6 +1370,7 @@ components:
|
|||||||
owner_id: 5
|
owner_id: 5
|
||||||
authority_id: 6
|
authority_id: 6
|
||||||
lock: true
|
lock: true
|
||||||
|
port_id: 1
|
||||||
created: '2023-08-21T08:23:35Z'
|
created: '2023-08-21T08:23:35Z'
|
||||||
modified: '2023-08-21T08:23:35Z'
|
modified: '2023-08-21T08:23:35Z'
|
||||||
deleted: false
|
deleted: false
|
||||||
@ -1777,6 +1823,48 @@ components:
|
|||||||
- times
|
- times
|
||||||
- shipcall
|
- shipcall
|
||||||
example: times
|
example: times
|
||||||
|
port:
|
||||||
|
title: port
|
||||||
|
x-stoplight:
|
||||||
|
id: j17v63cxewkz6
|
||||||
|
type: object
|
||||||
|
description: Record of port data
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
example: 2
|
||||||
|
minimum: 1
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
x-stoplight:
|
||||||
|
id: zfcomg2kr5e9g
|
||||||
|
example: Hamburg
|
||||||
|
locode:
|
||||||
|
type: string
|
||||||
|
x-stoplight:
|
||||||
|
id: lbrnbreql8ah1
|
||||||
|
maxLength: 5
|
||||||
|
minLength: 5
|
||||||
|
example: DEHAM
|
||||||
|
example:
|
||||||
|
id: 2
|
||||||
|
name: Hamburg
|
||||||
|
locode: DEHAM
|
||||||
|
port_list:
|
||||||
|
title: port_list
|
||||||
|
description: List of ports
|
||||||
|
x-stoplight:
|
||||||
|
id: it0cu6ivurgii
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/port'
|
||||||
|
example:
|
||||||
|
- id: 2
|
||||||
|
name: Hamburg
|
||||||
|
locode: DEHAM
|
||||||
|
- id: 3
|
||||||
|
name: Bremen
|
||||||
|
locode: DEBRE
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
ApiKey:
|
ApiKey:
|
||||||
description: API key needed to access the API
|
description: API key needed to access the API
|
||||||
|
|||||||
@ -184,10 +184,10 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
if ((ex.ErrorContent != null && ((string)ex.ErrorContent).StartsWith("{"))) {
|
if ((ex.ErrorContent != null && ((string)ex.ErrorContent).StartsWith("{"))) {
|
||||||
Error? anError = JsonConvert.DeserializeObject<Error>((string)ex.ErrorContent);
|
Error? anError = JsonConvert.DeserializeObject<Error>((string)ex.ErrorContent);
|
||||||
if ((anError != null) && anError.Message.Equals("invalid credentials"))
|
if ((anError != null) && anError.ErrorField.Equals("invalid credentials"))
|
||||||
this.labelLoginResult.Content = BreCalClient.Resources.Resources.textWrongCredentials;
|
this.labelLoginResult.Content = BreCalClient.Resources.Resources.textWrongCredentials;
|
||||||
else
|
else
|
||||||
this.labelLoginResult.Content = anError?.Message ?? ex.Message;
|
this.labelLoginResult.Content = anError?.ErrorField ?? ex.Message;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.labelLoginResult.Content = ex.Message;
|
this.labelLoginResult.Content = ex.Message;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user