Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/api/org_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type ToggleInput struct {
// ListConfiguredProviders returns providers that have org-level credentials configured.
func (c *Client) ListConfiguredProviders(ctx context.Context) ([]any, error) {
var providers []any
if err := c.do(ctx, http.MethodGet, "/v1/org/app-config/configured", nil, &providers); err != nil {
if err := c.do(ctx, http.MethodGet, "/v1/org/apps/configured", nil, &providers); err != nil {
return nil, fmt.Errorf("listing configured providers: %w", err)
}
return providers, nil
Expand All @@ -29,7 +29,7 @@ func (c *Client) ListConfiguredProviders(ctx context.Context) ([]any, error) {
// GetOrgAppConfig returns the app config for a provider at the org level.
func (c *Client) GetOrgAppConfig(ctx context.Context, provider string) (*OrgAppConfig, error) {
var config OrgAppConfig
if err := c.do(ctx, http.MethodGet, "/v1/org/app-config/"+provider, nil, &config); err != nil {
if err := c.do(ctx, http.MethodGet, "/v1/org/apps/"+provider+"/config", nil, &config); err != nil {
return nil, fmt.Errorf("getting org app config: %w", err)
}
return &config, nil
Expand All @@ -38,15 +38,15 @@ func (c *Client) GetOrgAppConfig(ctx context.Context, provider string) (*OrgAppC
// UpsertOrgAppConfig saves BYOC credentials for a provider at the org level.
func (c *Client) UpsertOrgAppConfig(ctx context.Context, provider string, input ConfigAppInput) error {
var resp SuccessResponse
if err := c.do(ctx, http.MethodPost, "/v1/org/app-config/"+provider, input, &resp); err != nil {
if err := c.do(ctx, http.MethodPost, "/v1/org/apps/"+provider+"/config", input, &resp); err != nil {
return fmt.Errorf("configuring org app: %w", err)
}
return nil
}

// DeleteOrgAppConfig removes BYOC credentials for a provider at the org level.
func (c *Client) DeleteOrgAppConfig(ctx context.Context, provider string) error {
if err := c.do(ctx, http.MethodDelete, "/v1/org/app-config/"+provider, nil, nil); err != nil {
if err := c.do(ctx, http.MethodDelete, "/v1/org/apps/"+provider+"/config", nil, nil); err != nil {
return fmt.Errorf("removing org app config: %w", err)
}
return nil
Expand All @@ -55,7 +55,7 @@ func (c *Client) DeleteOrgAppConfig(ctx context.Context, provider string) error
// ToggleOrgAppConfig enables or disables an app config at the org level.
func (c *Client) ToggleOrgAppConfig(ctx context.Context, provider string, enabled bool) error {
var resp SuccessResponse
if err := c.do(ctx, http.MethodPatch, "/v1/org/app-config/"+provider+"/toggle", ToggleInput{Enabled: enabled}, &resp); err != nil {
if err := c.do(ctx, http.MethodPatch, "/v1/org/apps/"+provider+"/config/toggle", ToggleInput{Enabled: enabled}, &resp); err != nil {
return fmt.Errorf("toggling org app config: %w", err)
}
return nil
Expand Down
6 changes: 3 additions & 3 deletions internal/api/org_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Connection struct {
// ListOrgConnections returns all connections for the organization.
func (c *Client) ListOrgConnections(ctx context.Context) ([]Connection, error) {
var connections []Connection
if err := c.do(ctx, http.MethodGet, "/v1/org/connections", nil, &connections); err != nil {
if err := c.do(ctx, http.MethodGet, "/v1/org/apps/connections", nil, &connections); err != nil {
return nil, fmt.Errorf("listing org connections: %w", err)
}
return connections, nil
Expand All @@ -26,15 +26,15 @@ func (c *Client) ListOrgConnections(ctx context.Context) ([]Connection, error) {
// ListOrgConnectionsByProvider returns connections for a specific provider.
func (c *Client) ListOrgConnectionsByProvider(ctx context.Context, provider string) ([]Connection, error) {
var connections []Connection
if err := c.do(ctx, http.MethodGet, "/v1/org/connections/"+provider, nil, &connections); err != nil {
if err := c.do(ctx, http.MethodGet, "/v1/org/apps/connections/"+provider, nil, &connections); err != nil {
return nil, fmt.Errorf("listing org connections for provider: %w", err)
}
return connections, nil
}

// DeleteOrgConnection removes an org-scoped connection by ID.
func (c *Client) DeleteOrgConnection(ctx context.Context, connectionID string) error {
if err := c.do(ctx, http.MethodDelete, "/v1/org/connections/"+connectionID, nil, nil); err != nil {
if err := c.do(ctx, http.MethodDelete, "/v1/org/apps/connections/"+connectionID, nil, nil); err != nil {
return fmt.Errorf("deleting org connection: %w", err)
}
return nil
Expand Down
Loading