Migrate new things to DoCustomRequestV5, fix Comments

This commit is contained in:
Samuel Lorch 2025-03-14 13:29:07 +01:00
parent 7bc894763c
commit 057d2e5f59
3 changed files with 8 additions and 8 deletions

View file

@ -22,7 +22,7 @@ type MetadataSessionKeyData struct {
SessionKeys []MetadataSessionKeyDataElement `json:"session_keys,omitempty"` SessionKeys []MetadataSessionKeyDataElement `json:"session_keys,omitempty"`
} }
// MetadataSessionKeyData is a MetadataSessionKeyData // MetadataSessionKeyDataElement is a MetadataSessionKeyDataElement
type MetadataSessionKeyDataElement struct { type MetadataSessionKeyDataElement struct {
ForeignModel ForeignModelTypes `json:"foreign_model"` ForeignModel ForeignModelTypes `json:"foreign_model"`
ForeignID string `json:"foreign_id"` ForeignID string `json:"foreign_id"`
@ -30,9 +30,9 @@ type MetadataSessionKeyDataElement struct {
Modified Time `json:"modified"` 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) { 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 { if err != nil {
return nil, err return nil, err
} }
@ -53,7 +53,7 @@ func (c *Client) DeleteSessionKey(ctx context.Context, sessionKeyID string) erro
if err != nil { if err != nil {
return fmt.Errorf("Checking ID format: %w", err) 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 { if err != nil {
return err return err
} }

View file

@ -9,7 +9,7 @@ type PassboltAPIVersionType string
const ( const (
PassboltAPIVersionTypeV4 PassboltAPIVersionType = "v4" PassboltAPIVersionTypeV4 PassboltAPIVersionType = "v4"
PassboltAPIVersionTypeV5 = "v5" PassboltAPIVersionTypeV5 PassboltAPIVersionType = "v5"
) )
func (s PassboltAPIVersionType) IsValid() bool { func (s PassboltAPIVersionType) IsValid() bool {
@ -59,7 +59,7 @@ func getV4DefaultMetadataTypeSettings() MetadataTypeSettings {
// GetMetadataTypeSettings gets the Servers Settings about which Types to use // GetMetadataTypeSettings gets the Servers Settings about which Types to use
func (c *Client) GetMetadataTypeSettings(ctx context.Context) (*MetadataTypeSettings, error) { 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 { if err != nil {
return nil, err return nil, err
} }

View file

@ -9,7 +9,7 @@ type MetadataKeyType string
const ( const (
MetadataKeyTypeUserKey MetadataKeyType = "user_key" MetadataKeyTypeUserKey MetadataKeyType = "user_key"
MetadataKeyTypeSharedKey = "shared_key" MetadataKeyTypeSharedKey MetadataKeyType = "shared_key"
) )
func (s MetadataKeyType) IsValid() bool { func (s MetadataKeyType) IsValid() bool {
@ -72,7 +72,7 @@ type GetMetadataKeysOptions struct {
// GetMetadataKeys gets all Passbolt GetMetadataKeys // GetMetadataKeys gets all Passbolt GetMetadataKeys
func (c *Client) GetMetadataKeys(ctx context.Context, opts *GetMetadataKeysOptions) ([]MetadataKey, error) { 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 { if err != nil {
return nil, err return nil, err
} }