github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/network_name.go (about) 1 package hedera 2 3 /*- 4 * 5 * Hedera Go SDK 6 * 7 * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 */ 22 23 type NetworkName string 24 25 const ( 26 NetworkNameMainnet NetworkName = "mainnet" 27 NetworkNameTestnet NetworkName = "testnet" 28 NetworkNamePreviewnet NetworkName = "previewnet" 29 NetworkNameOther NetworkName = "other" 30 ) 31 32 // Deprecated 33 func (networkName NetworkName) String() string { //nolint 34 switch networkName { 35 case NetworkNameMainnet: 36 return "mainnet" 37 case NetworkNameTestnet: 38 return "testnet" 39 case NetworkNamePreviewnet: 40 return "previewnet" 41 case NetworkNameOther: 42 return "other" 43 } 44 45 panic("unreachable: NetworkName.String() switch statement is non-exhaustive.") 46 } 47 48 // Deprecated 49 func NetworkNameFromString(s string) NetworkName { //nolint 50 switch s { 51 case "mainnet": 52 return NetworkNameMainnet 53 case "testnet": 54 return NetworkNameTestnet 55 case "previewnet": 56 return NetworkNamePreviewnet 57 case "other": 58 return NetworkNameOther 59 } 60 61 panic("unreachable: NetworkName.String() switch statement is non-exhaustive.") 62 }