mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-05-12 18:48:22 +00:00
Compare commits
No commits in common. "057d2e5f5953d422d813f9e897463057dad2c2cc" and "2afac57e2955756e4b271ff2d299eabcf5faf5cc" have entirely different histories.
057d2e5f59
...
2afac57e29
4 changed files with 8 additions and 18 deletions
10
api/api.go
10
api/api.go
|
@ -26,22 +26,12 @@ type APIHeader struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DoCustomRequest Executes a Custom Request and returns a APIResponse
|
// 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) {
|
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)
|
_, response, err := c.DoCustomRequestAndReturnRawResponse(ctx, method, path, version, body, opts)
|
||||||
return response, err
|
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
|
// 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) {
|
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.
|
// version is no longer used and is ignored.
|
||||||
return c.DoCustomRequestAndReturnRawResponseV5(ctx, method, path, body, opts)
|
return c.DoCustomRequestAndReturnRawResponseV5(ctx, method, path, body, opts)
|
||||||
|
|
|
@ -22,7 +22,7 @@ type MetadataSessionKeyData struct {
|
||||||
SessionKeys []MetadataSessionKeyDataElement `json:"session_keys,omitempty"`
|
SessionKeys []MetadataSessionKeyDataElement `json:"session_keys,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MetadataSessionKeyDataElement is a MetadataSessionKeyDataElement
|
// MetadataSessionKeyData is a MetadataSessionKeyData
|
||||||
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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMetadataSessionKeys gets the Metadata Session Keys
|
// GetMetadataTypeSettings gets the Servers Settings about which Types to use
|
||||||
func (c *Client) GetMetadataSessionKeys(ctx context.Context) ([]MetadataSessionKey, error) {
|
func (c *Client) GetMetadataSessionKeys(ctx context.Context) ([]MetadataSessionKey, error) {
|
||||||
msg, err := c.DoCustomRequestV5(ctx, "GET", "/metadata/session-keys.json", nil, nil)
|
msg, err := c.DoCustomRequest(ctx, "GET", "/metadata/session-keys.json", "v2", 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.DoCustomRequestV5(ctx, "DELETE", "/metadata/session-keys/"+sessionKeyID+".json", nil, nil)
|
_, err = c.DoCustomRequest(ctx, "DELETE", "/metadata/session-keys/"+sessionKeyID+".json", "v2", nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ type PassboltAPIVersionType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PassboltAPIVersionTypeV4 PassboltAPIVersionType = "v4"
|
PassboltAPIVersionTypeV4 PassboltAPIVersionType = "v4"
|
||||||
PassboltAPIVersionTypeV5 PassboltAPIVersionType = "v5"
|
PassboltAPIVersionTypeV5 = "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.DoCustomRequestV5(ctx, "GET", "/metadata/types/settings.json", nil, nil)
|
msg, err := c.DoCustomRequest(ctx, "GET", "/metadata/types/settings.json", "v3", nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ type MetadataKeyType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MetadataKeyTypeUserKey MetadataKeyType = "user_key"
|
MetadataKeyTypeUserKey MetadataKeyType = "user_key"
|
||||||
MetadataKeyTypeSharedKey MetadataKeyType = "shared_key"
|
MetadataKeyTypeSharedKey = "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.DoCustomRequestV5(ctx, "GET", "/metadata/keys.json", nil, opts)
|
msg, err := c.DoCustomRequest(ctx, "GET", "/metadata/keys.json", "v2", nil, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue