refactor: update HTTP request handling and improve documentation
- Replaced http.NewRequest with http.NewRequestWithContext in client tests for better context management. - Updated method names and comments for clarity, including renaming GetWsdlUrl to GetWsdlURL and StorageUri to StorageURI for consistency. - Enhanced comments across various files to provide clearer descriptions of functionality and ONVIF specifications.
This commit is contained in:
+6
-4
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/0x524a/onvif-go/internal/soap"
|
||||
)
|
||||
|
||||
// ONVIF Specification: GetStorageConfigurations operation.
|
||||
// GetStorageConfigurations retrieves storage configurations. ONVIF Specification: GetStorageConfigurations operation.
|
||||
func (c *Client) GetStorageConfigurations(ctx context.Context) ([]*StorageConfiguration, error) {
|
||||
type GetStorageConfigurationsBody struct {
|
||||
XMLName xml.Name `xml:"tds:GetStorageConfigurations"`
|
||||
@@ -35,7 +35,7 @@ func (c *Client) GetStorageConfigurations(ctx context.Context) ([]*StorageConfig
|
||||
return response.StorageConfigurations, nil
|
||||
}
|
||||
|
||||
// ONVIF Specification: GetStorageConfiguration operation.
|
||||
// GetStorageConfiguration retrieves a storage configuration. ONVIF Specification: GetStorageConfiguration operation.
|
||||
func (c *Client) GetStorageConfiguration(ctx context.Context, token string) (*StorageConfiguration, error) {
|
||||
type GetStorageConfigurationBody struct {
|
||||
XMLName xml.Name `xml:"tds:GetStorageConfiguration"`
|
||||
@@ -64,6 +64,7 @@ func (c *Client) GetStorageConfiguration(ctx context.Context, token string) (*St
|
||||
return response.StorageConfiguration, nil
|
||||
}
|
||||
|
||||
// CreateStorageConfiguration creates a storage configuration.
|
||||
// ONVIF Specification: CreateStorageConfiguration operation.
|
||||
func (c *Client) CreateStorageConfiguration(ctx context.Context, config *StorageConfiguration) (string, error) {
|
||||
type CreateStorageConfigurationBody struct {
|
||||
@@ -93,7 +94,7 @@ func (c *Client) CreateStorageConfiguration(ctx context.Context, config *Storage
|
||||
return response.Token, nil
|
||||
}
|
||||
|
||||
// ONVIF Specification: SetStorageConfiguration operation.
|
||||
// SetStorageConfiguration sets a storage configuration. ONVIF Specification: SetStorageConfiguration operation.
|
||||
func (c *Client) SetStorageConfiguration(ctx context.Context, config *StorageConfiguration) error {
|
||||
type SetStorageConfigurationBody struct {
|
||||
XMLName xml.Name `xml:"tds:SetStorageConfiguration"`
|
||||
@@ -121,6 +122,7 @@ func (c *Client) SetStorageConfiguration(ctx context.Context, config *StorageCon
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteStorageConfiguration deletes a storage configuration.
|
||||
// ONVIF Specification: DeleteStorageConfiguration operation.
|
||||
func (c *Client) DeleteStorageConfiguration(ctx context.Context, token string) error {
|
||||
type DeleteStorageConfigurationBody struct {
|
||||
@@ -149,7 +151,7 @@ func (c *Client) DeleteStorageConfiguration(ctx context.Context, token string) e
|
||||
return nil
|
||||
}
|
||||
|
||||
// ONVIF Specification: SetHashingAlgorithm operation.
|
||||
// SetHashingAlgorithm sets the hashing algorithm. ONVIF Specification: SetHashingAlgorithm operation.
|
||||
func (c *Client) SetHashingAlgorithm(ctx context.Context, algorithm string) error {
|
||||
type SetHashingAlgorithmBody struct {
|
||||
XMLName xml.Name `xml:"tds:SetHashingAlgorithm"`
|
||||
|
||||
Reference in New Issue
Block a user