From 057d2e5f5953d422d813f9e897463057dad2c2cc Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Fri, 14 Mar 2025 13:29:07 +0100 Subject: [PATCH] Migrate new things to DoCustomRequestV5, fix Comments --- api/metadata_sessionkey.go | 8 ++++---- api/metadata_settings.go | 4 ++-- api/metadatakey.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/metadata_sessionkey.go b/api/metadata_sessionkey.go index cf18abe..7cada9d 100644 --- a/api/metadata_sessionkey.go +++ b/api/metadata_sessionkey.go @@ -22,7 +22,7 @@ type MetadataSessionKeyData struct { SessionKeys []MetadataSessionKeyDataElement `json:"session_keys,omitempty"` } -// MetadataSessionKeyData is a MetadataSessionKeyData +// MetadataSessionKeyDataElement is a MetadataSessionKeyDataElement type MetadataSessionKeyDataElement struct { ForeignModel ForeignModelTypes `json:"foreign_model"` ForeignID string `json:"foreign_id"` @@ -30,9 +30,9 @@ type MetadataSessionKeyDataElement struct { Modified Time `json:"modified"` } -// GetMetadataTypeSettings gets the Servers Settings about which Types to use +// GetMetadataSessionKeys gets the Metadata Session Keys func (c *Client) GetMetadataSessionKeys(ctx context.Context) ([]MetadataSessionKey, error) { - msg, err := c.DoCustomRequest(ctx, "GET", "/metadata/session-keys.json", "v2", nil, nil) + msg, err := c.DoCustomRequestV5(ctx, "GET", "/metadata/session-keys.json", nil, nil) if err != nil { return nil, err } @@ -53,7 +53,7 @@ func (c *Client) DeleteSessionKey(ctx context.Context, sessionKeyID string) erro if err != nil { return fmt.Errorf("Checking ID format: %w", err) } - _, err = c.DoCustomRequest(ctx, "DELETE", "/metadata/session-keys/"+sessionKeyID+".json", "v2", nil, nil) + _, err = c.DoCustomRequestV5(ctx, "DELETE", "/metadata/session-keys/"+sessionKeyID+".json", nil, nil) if err != nil { return err } diff --git a/api/metadata_settings.go b/api/metadata_settings.go index b54158f..ae80715 100644 --- a/api/metadata_settings.go +++ b/api/metadata_settings.go @@ -9,7 +9,7 @@ type PassboltAPIVersionType string const ( PassboltAPIVersionTypeV4 PassboltAPIVersionType = "v4" - PassboltAPIVersionTypeV5 = "v5" + PassboltAPIVersionTypeV5 PassboltAPIVersionType = "v5" ) func (s PassboltAPIVersionType) IsValid() bool { @@ -59,7 +59,7 @@ func getV4DefaultMetadataTypeSettings() MetadataTypeSettings { // GetMetadataTypeSettings gets the Servers Settings about which Types to use func (c *Client) GetMetadataTypeSettings(ctx context.Context) (*MetadataTypeSettings, error) { - msg, err := c.DoCustomRequest(ctx, "GET", "/metadata/types/settings.json", "v3", nil, nil) + msg, err := c.DoCustomRequestV5(ctx, "GET", "/metadata/types/settings.json", nil, nil) if err != nil { return nil, err } diff --git a/api/metadatakey.go b/api/metadatakey.go index b968258..49db61c 100644 --- a/api/metadatakey.go +++ b/api/metadatakey.go @@ -9,7 +9,7 @@ type MetadataKeyType string const ( MetadataKeyTypeUserKey MetadataKeyType = "user_key" - MetadataKeyTypeSharedKey = "shared_key" + MetadataKeyTypeSharedKey MetadataKeyType = "shared_key" ) func (s MetadataKeyType) IsValid() bool { @@ -72,7 +72,7 @@ type GetMetadataKeysOptions struct { // GetMetadataKeys gets all Passbolt GetMetadataKeys func (c *Client) GetMetadataKeys(ctx context.Context, opts *GetMetadataKeysOptions) ([]MetadataKey, error) { - msg, err := c.DoCustomRequest(ctx, "GET", "/metadata/keys.json", "v2", nil, opts) + msg, err := c.DoCustomRequestV5(ctx, "GET", "/metadata/keys.json", nil, opts) if err != nil { return nil, err }