Rename blockchain-related properties returned by /api/v1/instance method

This commit is contained in:
silverpill 2022-01-26 00:17:10 +00:00
parent f2fb44bb63
commit 8b2474c448
2 changed files with 53 additions and 6 deletions

View file

@ -238,6 +238,17 @@ paths:
type: array
items:
$ref: '#/components/schemas/Account'
/api/v1/instance:
get:
summary: Information about the instance.
security: []
responses:
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Instance'
/api/v1/notifications:
get:
summary: Notifications concerning the user.
@ -510,6 +521,42 @@ components:
description: Ethereum wallet address.
type: string
example: '0xd8da6bf...'
Instance:
type: object
properties:
uri:
description: The host name of the instance.
type: string
title:
description: The title of the website.
type: string
short_description:
description: A short description defined by the admin.
type: string
description:
description: Admin-defined description of the site.
type: string
version:
description: The version of Mitra server.
type: string
registrations:
description: Whether registrations are enabled.
type: boolean
login_message:
description: Login message for signer.
type: string
blockchain_explorer_url:
description: Blockchain explorer base URL.
type: string
blockchain_contract_name:
description: Blockchain contract name.
type: string
blockchain_contract_address:
description: Blockchain contract address.
type: string
ipfs_gateway_url:
description: IPFS gateway URL.
type: string
Mention:
type: object
properties:

View file

@ -13,9 +13,9 @@ pub struct InstanceInfo {
registrations: bool,
login_message: String,
ethereum_explorer_url: Option<String>,
nft_contract_name: Option<String>,
nft_contract_address: Option<String>,
blockchain_explorer_url: Option<String>,
blockchain_contract_name: Option<String>,
blockchain_contract_address: Option<String>,
ipfs_gateway_url: Option<String>,
}
@ -29,11 +29,11 @@ impl From<&Config> for InstanceInfo {
version: config.version.clone(),
registrations: config.registrations_open,
login_message: config.login_message.clone(),
ethereum_explorer_url: config.blockchain.as_ref()
blockchain_explorer_url: config.blockchain.as_ref()
.and_then(|val| val.explorer_url.clone()),
nft_contract_name: config.blockchain.as_ref()
blockchain_contract_name: config.blockchain.as_ref()
.and(Some(MANAGER.into())),
nft_contract_address: config.blockchain.as_ref()
blockchain_contract_address: config.blockchain.as_ref()
.map(|val| val.contract_address.clone()),
ipfs_gateway_url: config.ipfs_gateway_url.clone(),
}