github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/internal/osnadmin/list.go (about)

     1  /*
     2  Copyright hechain. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package osnadmin
     8  
     9  import (
    10  	"crypto/tls"
    11  	"crypto/x509"
    12  	"fmt"
    13  	"net/http"
    14  )
    15  
    16  // Lists the channels an OSN is a member of.
    17  func ListAllChannels(osnURL string, caCertPool *x509.CertPool, tlsClientCert tls.Certificate) (*http.Response, error) {
    18  	url := fmt.Sprintf("%s/participation/v1/channels", osnURL)
    19  
    20  	return httpGet(url, caCertPool, tlsClientCert)
    21  }
    22  
    23  // Lists a single channel an OSN is a member of.
    24  func ListSingleChannel(osnURL, channelID string, caCertPool *x509.CertPool, tlsClientCert tls.Certificate) (*http.Response, error) {
    25  	url := fmt.Sprintf("%s/participation/v1/channels/%s", osnURL, channelID)
    26  
    27  	return httpGet(url, caCertPool, tlsClientCert)
    28  }