From 8b2474c4483a144b47876934560235f671fcc586 Mon Sep 17 00:00:00 2001 From: silverpill Date: Wed, 26 Jan 2022 00:17:10 +0000 Subject: [PATCH] Rename blockchain-related properties returned by /api/v1/instance method --- docs/openapi.yaml | 47 ++++++++++++++++++++++++++++++ src/mastodon_api/instance/types.rs | 12 ++++---- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 0ebe9f0..7155c4c 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -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: diff --git a/src/mastodon_api/instance/types.rs b/src/mastodon_api/instance/types.rs index c76f049..2c6c2d8 100644 --- a/src/mastodon_api/instance/types.rs +++ b/src/mastodon_api/instance/types.rs @@ -13,9 +13,9 @@ pub struct InstanceInfo { registrations: bool, login_message: String, - ethereum_explorer_url: Option, - nft_contract_name: Option, - nft_contract_address: Option, + blockchain_explorer_url: Option, + blockchain_contract_name: Option, + blockchain_contract_address: Option, ipfs_gateway_url: Option, } @@ -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(), }