api

package
v0.2.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action map[string]interface{}

Action represents a Port action.

type Automation

type Automation map[string]interface{}

Automation represents a Port automation.

type Blueprint

type Blueprint map[string]interface{}

Blueprint represents a Port blueprint.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles authenticated requests to Port's API.

func NewClient

func NewClient(opts ClientOpts) *Client

NewClient creates a new Port API client.

func (*Client) Close

func (c *Client) Close() error

Close closes the HTTP client (no-op for standard client, but implements closer pattern).

func (*Client) CreateAction

func (c *Client) CreateAction(ctx context.Context, blueprintIdentifier string, action Action) (Action, error)

CreateAction creates a blueprint-level action.

func (*Client) CreateAutomation

func (c *Client) CreateAutomation(ctx context.Context, automation Automation) (Automation, error)

CreateAutomation creates a new automation (organization-wide action).

func (*Client) CreateBlueprint

func (c *Client) CreateBlueprint(ctx context.Context, blueprint Blueprint) (Blueprint, error)

CreateBlueprint creates a new blueprint.

func (*Client) CreateEntity

func (c *Client) CreateEntity(ctx context.Context, blueprintIdentifier string, entity Entity) (Entity, error)

CreateEntity creates a new entity.

func (*Client) CreateFolder added in v0.1.15

func (c *Client) CreateFolder(ctx context.Context, folder Folder) error

CreateFolder creates a sidebar folder under the catalog sidebar.

func (*Client) CreatePage

func (c *Client) CreatePage(ctx context.Context, page Page) (Page, error)

CreatePage creates a new page.

func (*Client) CreateScorecard

func (c *Client) CreateScorecard(ctx context.Context, blueprintIdentifier string, scorecard Scorecard) (Scorecard, error)

CreateScorecard creates a new scorecard for a blueprint.

func (*Client) CreateTeam

func (c *Client) CreateTeam(ctx context.Context, team Team) (Team, error)

CreateTeam creates a new team.

func (*Client) DeleteAction

func (c *Client) DeleteAction(ctx context.Context, blueprintIdentifier, actionIdentifier string) error

DeleteAction deletes a blueprint-level action.

func (*Client) DeleteAutomation

func (c *Client) DeleteAutomation(ctx context.Context, automationIdentifier string) error

DeleteAutomation deletes an automation.

func (*Client) DeleteBlueprint

func (c *Client) DeleteBlueprint(ctx context.Context, identifier string) error

DeleteBlueprint deletes a blueprint.

func (*Client) DeleteEntity

func (c *Client) DeleteEntity(ctx context.Context, blueprintIdentifier, entityIdentifier string) error

DeleteEntity deletes an entity.

func (*Client) DeleteFolder added in v0.2.0

func (c *Client) DeleteFolder(ctx context.Context, folderIdentifier string) error

DeleteFolder deletes a sidebar folder from the catalog sidebar.

func (*Client) DeleteIntegration

func (c *Client) DeleteIntegration(ctx context.Context, integrationIdentifier string) error

DeleteIntegration deletes an integration.

func (*Client) DeletePage

func (c *Client) DeletePage(ctx context.Context, pageIdentifier string) error

DeletePage deletes a page.

func (*Client) DeleteScorecard

func (c *Client) DeleteScorecard(ctx context.Context, blueprintIdentifier, scorecardIdentifier string) error

DeleteScorecard deletes a scorecard.

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(ctx context.Context, teamName string) error

DeleteTeam deletes a team.

func (*Client) GetActionPermissions added in v0.1.7

func (c *Client) GetActionPermissions(ctx context.Context, actionIdentifier string) (Permissions, error)

GetActionPermissions retrieves permissions for an action.

func (*Client) GetActions

func (c *Client) GetActions(ctx context.Context, blueprintIdentifier string) ([]Action, error)

GetActions retrieves actions for a blueprint.

func (*Client) GetAllActions

func (c *Client) GetAllActions(ctx context.Context) ([]Action, error)

GetAllActions retrieves all actions and automations (organization-wide).

func (*Client) GetAllScorecards

func (c *Client) GetAllScorecards(ctx context.Context) ([]Scorecard, error)

GetAllScorecards retrieves all scorecards (organization-wide).

func (*Client) GetBlueprint

func (c *Client) GetBlueprint(ctx context.Context, identifier string) (Blueprint, error)

GetBlueprint retrieves a specific blueprint.

func (*Client) GetBlueprintPermissions added in v0.1.7

func (c *Client) GetBlueprintPermissions(ctx context.Context, blueprintIdentifier string) (Permissions, error)

GetBlueprintPermissions retrieves permissions for a blueprint.

func (*Client) GetBlueprints

func (c *Client) GetBlueprints(ctx context.Context) ([]Blueprint, error)

GetBlueprints retrieves all blueprints.

func (*Client) GetEntities

func (c *Client) GetEntities(ctx context.Context, blueprintIdentifier string, params map[string]string) ([]Entity, error)

GetEntities retrieves entities for a blueprint.

func (*Client) GetEntity

func (c *Client) GetEntity(ctx context.Context, blueprintIdentifier, entityIdentifier string) (Entity, error)

GetEntity retrieves a specific entity.

func (*Client) GetFolders added in v0.1.15

func (c *Client) GetFolders(ctx context.Context) ([]Folder, error)

GetFolders retrieves sidebar folders from the catalog sidebar.

func (*Client) GetIntegrations

func (c *Client) GetIntegrations(ctx context.Context) ([]Integration, error)

GetIntegrations retrieves all integrations.

func (*Client) GetPage added in v0.1.3

func (c *Client) GetPage(ctx context.Context, pageIdentifier string) (Page, error)

GetPage retrieves a single page by identifier.

func (*Client) GetPages

func (c *Client) GetPages(ctx context.Context) ([]Page, error)

GetPages retrieves all pages.

func (*Client) GetScorecards

func (c *Client) GetScorecards(ctx context.Context, blueprintIdentifier string) ([]Scorecard, error)

GetScorecards retrieves scorecards for a blueprint.

func (*Client) GetSkillFilesForVersion added in v0.2.16

func (c *Client) GetSkillFilesForVersion(ctx context.Context, versionIdentifier string) ([]Entity, error)

GetSkillFilesForVersion retrieves skill_file entities related to one skill_version.

func (*Client) GetSkillFilesForVersions added in v0.2.16

func (c *Client) GetSkillFilesForVersions(ctx context.Context, versionIdentifiers []string) ([]Entity, error)

GetSkillFilesForVersions retrieves skill_file entities related to skill_versions.

func (*Client) GetSkillGroups added in v0.2.0

func (c *Client) GetSkillGroups(ctx context.Context) ([]Entity, error)

GetSkillGroups retrieves all skill_group blueprint entities from Port.

func (*Client) GetSkillVersionsForSkills added in v0.2.16

func (c *Client) GetSkillVersionsForSkills(ctx context.Context, skillIdentifiers []string) ([]Entity, error)

GetSkillVersionsForSkills retrieves skill_version entities for a set of skills.

func (*Client) GetSkills added in v0.2.0

func (c *Client) GetSkills(ctx context.Context) ([]Entity, error)

GetSkills retrieves all skill blueprint entities from Port.

func (*Client) GetTeams

func (c *Client) GetTeams(ctx context.Context) ([]Team, error)

GetTeams retrieves all teams.

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, userEmail string) (User, error)

GetUser retrieves a specific user by email.

func (*Client) GetUsers

func (c *Client) GetUsers(ctx context.Context) ([]User, error)

GetUsers retrieves all users in the organization.

func (*Client) InviteUser

func (c *Client) InviteUser(ctx context.Context, user User) (User, error)

InviteUser invites a user to the organization.

func (*Client) PatchBlueprint added in v0.2.10

func (c *Client) PatchBlueprint(ctx context.Context, identifier string, blueprint Blueprint) (Blueprint, error)

PatchBlueprint updates an existing blueprint with a partial payload (PATCH).

func (*Client) Request added in v0.2.0

func (c *Client) Request(ctx context.Context, params RequestParams) (any, error)

func (*Client) SearchEntities added in v0.2.16

func (c *Client) SearchEntities(ctx context.Context, blueprintIdentifier string, body map[string]interface{}) ([]Entity, error)

SearchEntities queries entities for a blueprint using Port's search endpoint.

func (*Client) TopSearchEntities added in v0.2.16

func (c *Client) TopSearchEntities(ctx context.Context, blueprintIdentifier string, body map[string]interface{}) ([]Entity, error)

TopSearchEntities queries entities using Port's top-search endpoint, which supports server-side sorting.

func (*Client) UpdateAction

func (c *Client) UpdateAction(ctx context.Context, blueprintIdentifier, actionIdentifier string, action Action) (Action, error)

UpdateAction updates an existing blueprint-level action.

func (*Client) UpdateActionPermissions added in v0.1.7

func (c *Client) UpdateActionPermissions(ctx context.Context, actionIdentifier string, permissions Permissions) (Permissions, error)

UpdateActionPermissions updates permissions for an action.

func (*Client) UpdateAutomation

func (c *Client) UpdateAutomation(ctx context.Context, automationIdentifier string, automation Automation) (Automation, error)

UpdateAutomation updates an existing automation.

func (*Client) UpdateBlueprint

func (c *Client) UpdateBlueprint(ctx context.Context, identifier string, blueprint Blueprint) (Blueprint, error)

UpdateBlueprint updates an existing blueprint.

func (*Client) UpdateBlueprintPermissions added in v0.1.7

func (c *Client) UpdateBlueprintPermissions(ctx context.Context, blueprintIdentifier string, permissions Permissions) (Permissions, error)

UpdateBlueprintPermissions updates permissions for a blueprint.

func (*Client) UpdateEntity

func (c *Client) UpdateEntity(ctx context.Context, blueprintIdentifier, entityIdentifier string, entity Entity) (Entity, error)

UpdateEntity updates an existing entity.

func (*Client) UpdateIntegrationConfig

func (c *Client) UpdateIntegrationConfig(ctx context.Context, integrationIdentifier string, config map[string]interface{}) (Integration, error)

UpdateIntegrationConfig updates an integration's configuration.

func (*Client) UpdatePage

func (c *Client) UpdatePage(ctx context.Context, pageIdentifier string, page Page) (Page, error)

UpdatePage updates an existing page.

func (*Client) UpdateScorecard

func (c *Client) UpdateScorecard(ctx context.Context, blueprintIdentifier, scorecardIdentifier string, scorecard Scorecard) (Scorecard, error)

UpdateScorecard updates an existing scorecard.

func (*Client) UpdateScorecards

func (c *Client) UpdateScorecards(ctx context.Context, blueprintIdentifier string, scorecards []Scorecard) ([]Scorecard, error)

UpdateScorecards updates multiple scorecards for a blueprint using bulk PUT endpoint. The API expects the array of scorecards directly (not wrapped in an object).

func (*Client) UpdateTeam

func (c *Client) UpdateTeam(ctx context.Context, teamName string, team Team) (Team, error)

UpdateTeam updates an existing team.

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, userEmail string, user User) (User, error)

UpdateUser updates an existing user.

type ClientOpts added in v0.1.17

type ClientOpts struct {
	Token        *auth.Token
	ClientID     string
	ClientSecret string
	APIURL       string
	Timeout      time.Duration
}

type Entity

type Entity map[string]interface{}

Entity represents a Port entity.

type Folder added in v0.1.15

type Folder map[string]interface{}

Folder represents a Port sidebar folder.

type Integration

type Integration map[string]interface{}

Integration represents a Port integration.

type Page

type Page map[string]interface{}

Page represents a Port page.

type Permissions added in v0.1.7

type Permissions map[string]interface{}

Permissions represents Port resource permissions.

type RequestParams added in v0.2.0

type RequestParams struct {
	Method   string
	Endpoint string
	Data     any
	Params   map[string]string
}

type Scorecard

type Scorecard map[string]interface{}

Scorecard represents a Port scorecard.

type Team

type Team map[string]interface{}

Team represents a Port team.

type TokenManager

type TokenManager struct {
	ClientID     string
	ClientSecret string
	APIURL       string
	// contains filtered or unexported fields
}

TokenManager manages authentication tokens with thread-safe caching.

func NewTokenManager

func NewTokenManager(clientID, clientSecret, apiURL string) *TokenManager

NewTokenManager creates a new token manager.

func (*TokenManager) GetToken

func (tm *TokenManager) GetToken() (string, error)

GetToken returns a valid token, refreshing if necessary. Thread-safe with read/write locks.

func (*TokenManager) SetToken

func (tm *TokenManager) SetToken(token string, expiry time.Time)

SetToken sets the token and expiry (used by client during refresh).

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"accessToken"`
	ExpiresIn   int    `json:"expiresIn"`
	TokenType   string `json:"tokenType"`
}

TokenResponse represents the Port API token response.

type User

type User map[string]interface{}

User represents a Port user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL