extended OpenAPI with port endpoint and refs, adjusted some code to compile
This commit is contained in:
parent
a2c56e9696
commit
6a6ffa38f9
2690
misc/BreCalApi.cs
2690
misc/BreCalApi.cs
File diff suppressed because it is too large
Load Diff
@ -705,9 +705,11 @@ paths:
|
||||
- id: 3
|
||||
name: Pier 1
|
||||
owner_id: 5
|
||||
port_id: 3
|
||||
- id: 4
|
||||
name: Pier 2
|
||||
owner_id: 5
|
||||
port_id: 3
|
||||
'400':
|
||||
$ref: '#/components/responses/400'
|
||||
'401':
|
||||
@ -758,6 +760,36 @@ paths:
|
||||
$ref: '#/components/responses/500'
|
||||
'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:
|
||||
schemas:
|
||||
credentials:
|
||||
@ -808,6 +840,7 @@ components:
|
||||
example:
|
||||
id: 6
|
||||
ship_id: 8
|
||||
port_id: 1
|
||||
type: arrival
|
||||
eta: '2023-08-21T08:23:35Z'
|
||||
voyage: Voyage 123
|
||||
@ -846,6 +879,9 @@ components:
|
||||
ship_id:
|
||||
type: integer
|
||||
example: 8
|
||||
port_id:
|
||||
type: integer
|
||||
example: 3
|
||||
type:
|
||||
$ref: '#/components/schemas/ShipcallType'
|
||||
eta:
|
||||
@ -978,6 +1014,7 @@ components:
|
||||
example:
|
||||
- id: 6
|
||||
ship_id: 8
|
||||
port_id: 1
|
||||
type: arrival
|
||||
eta: '2023-08-21T08:23:35Z'
|
||||
voyage: Voyage 123
|
||||
@ -1011,6 +1048,7 @@ components:
|
||||
modified: '2023-08-21T08:23:35Z'
|
||||
- id: 7
|
||||
ship_id: 8
|
||||
port_id: 1
|
||||
type: departure
|
||||
eta: '2023-08-21T08:23:35Z'
|
||||
voyage: Voyage 123
|
||||
@ -1281,6 +1319,11 @@ components:
|
||||
nullable: true
|
||||
description: If true lock must be passed
|
||||
example: true
|
||||
port_id:
|
||||
type: integer
|
||||
nullable: false
|
||||
description: Required reference to a port
|
||||
example: 1
|
||||
created:
|
||||
description: Readonly field set by the database when berth was created
|
||||
type: string
|
||||
@ -1303,6 +1346,7 @@ components:
|
||||
owner_id: 5
|
||||
authority_id: 6
|
||||
lock: true
|
||||
port_id: 1
|
||||
created: '2023-08-21T08:23:35Z'
|
||||
modified: '2023-08-21T08:23:35Z'
|
||||
deleted: false
|
||||
@ -1317,6 +1361,7 @@ components:
|
||||
owner_id: 5
|
||||
authority_id: 6
|
||||
lock: true
|
||||
port_id: 1
|
||||
created: '2023-08-21T08:23:35Z'
|
||||
modified: '2023-08-21T08:23:35Z'
|
||||
deleted: false
|
||||
@ -1325,6 +1370,7 @@ components:
|
||||
owner_id: 5
|
||||
authority_id: 6
|
||||
lock: true
|
||||
port_id: 1
|
||||
created: '2023-08-21T08:23:35Z'
|
||||
modified: '2023-08-21T08:23:35Z'
|
||||
deleted: false
|
||||
@ -1777,6 +1823,48 @@ components:
|
||||
- times
|
||||
- shipcall
|
||||
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:
|
||||
ApiKey:
|
||||
description: API key needed to access the API
|
||||
|
||||
@ -184,10 +184,10 @@ namespace BreCalClient
|
||||
{
|
||||
if ((ex.ErrorContent != null && ((string)ex.ErrorContent).StartsWith("{"))) {
|
||||
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;
|
||||
else
|
||||
this.labelLoginResult.Content = anError?.Message ?? ex.Message;
|
||||
this.labelLoginResult.Content = anError?.ErrorField ?? ex.Message;
|
||||
}
|
||||
else {
|
||||
this.labelLoginResult.Content = ex.Message;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user