Compare commits

...

2 commits

4 changed files with 18 additions and 8 deletions

View file

@ -26,12 +26,22 @@ type APIHeader struct {
}
// DoCustomRequest Executes a Custom Request and returns a APIResponse
//
// Deprecated: DoCustomRequest is deprecated. Use DoCustomRequestV5 instead
func (c *Client) DoCustomRequest(ctx context.Context, method, path, version string, body interface{}, opts interface{}) (*APIResponse, error) {
_, response, err := c.DoCustomRequestAndReturnRawResponse(ctx, method, path, version, body, opts)
return response, err
}
// DoCustomRequestV5 Executes a Custom Request and returns a APIResponse
func (c *Client) DoCustomRequestV5(ctx context.Context, method, path string, body interface{}, opts interface{}) (*APIResponse, error) {
_, response, err := c.DoCustomRequestAndReturnRawResponseV5(ctx, method, path, body, opts)
return response, err
}
// DoCustomRequestAndReturnRawResponse Executes a Custom Request and returns a APIResponse and the Raw HTTP Response
//
// Deprecated: DoCustomRequestAndReturnRawResponse is deprecated. Use DoCustomRequestAndReturnRawResponseV5 instead
func (c *Client) DoCustomRequestAndReturnRawResponse(ctx context.Context, method, path, version string, body interface{}, opts interface{}) (*http.Response, *APIResponse, error) {
// version is no longer used and is ignored.
return c.DoCustomRequestAndReturnRawResponseV5(ctx, method, path, body, opts)

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}