api

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionBlueprintID added in v0.3.7

func ActionBlueprintID(action Action) string

ActionBlueprintID extracts the blueprint identifier an action or automation references, if any. Self-service actions carry it at trigger.blueprintIdentifier; automations can carry it at trigger.event.blueprintIdentifier.

func IsAutomationAction added in v0.3.7

func IsAutomationAction(action Action) bool

IsAutomationAction reports whether an action record is an automation.

func SelfServiceActionBlueprintID added in v0.3.7

func SelfServiceActionBlueprintID(action Action) string

SelfServiceActionBlueprintID extracts the blueprint identifier from a non-automation action. Automations are excluded even when their event references a blueprint.

Types

type APIError added in v0.3.7

type APIError struct {
	Method     string
	URL        string
	Status     string
	StatusCode int
	Body       string
	Code       string
	Message    string
	Details    map[string]interface{}
}

APIError represents a non-2xx response from the Port API.

func (*APIError) Error added in v0.3.7

func (e *APIError) Error() string

type Action

type Action map[string]interface{}

Action represents a Port action.

func ActionWithBlueprintIdentifier added in v0.3.7

func ActionWithBlueprintIdentifier(action Action, blueprintIdentifier string) Action

ActionWithBlueprintIdentifier returns a shallow copy of action with trigger.blueprintIdentifier set.

type ActionRun added in v0.2.23

type ActionRun map[string]interface{}

ActionRun represents a Port action run.

type AuditLog added in v0.2.23

type AuditLog map[string]interface{}

AuditLog represents a Port audit log entry.

type Automation

type Automation map[string]interface{}

Automation represents a Port automation.

type BatchSkillError added in v0.3.1

type BatchSkillError struct {
	Name       string `json:"name"`
	Message    string `json:"message"`
	StatusCode int    `json:"statusCode"`
}

BatchSkillError is a per-item error in batch create.

type BatchUploadSkillResultItem added in v0.3.1

type BatchUploadSkillResultItem struct {
	Identifier string                     `json:"identifier"`
	OK         bool                       `json:"ok"`
	Result     *SkillVersionWriteResponse `json:"result,omitempty"`
	Error      *BatchSkillError           `json:"error,omitempty"`
}

BatchUploadSkillResultItem is one result in POST /skills/upload/batch.

type BatchUploadSkillsRequest added in v0.3.1

type BatchUploadSkillsRequest struct {
	Skills []UploadSkillRequest `json:"skills"`
}

BatchUploadSkillsRequest is the POST /skills/upload/batch body.

type BatchUploadSkillsResponse added in v0.3.1

type BatchUploadSkillsResponse struct {
	OK      bool                         `json:"ok"`
	Results []BatchUploadSkillResultItem `json:"results"`
}

BatchUploadSkillsResponse is returned by POST /skills/upload/batch.

type Blueprint

type Blueprint map[string]interface{}

Blueprint represents a Port blueprint.

type BulkEntityError added in v0.2.22

type BulkEntityError struct {
	Identifier string  `json:"identifier"`
	Index      float64 `json:"index"`
	StatusCode float64 `json:"statusCode"`
	Error      string  `json:"error"`
	Message    string  `json:"message"`
}

BulkEntityError is a single per-entity failure returned by the bulk entity endpoint.

type CatalogEntitySnapshot added in v0.3.1

type CatalogEntitySnapshot struct {
	Identifier string                 `json:"identifier"`
	Title      string                 `json:"title"`
	Blueprint  string                 `json:"blueprint"`
	Properties map[string]interface{} `json:"properties"`
	Relations  map[string]interface{} `json:"relations,omitempty"`
	CreatedAt  *string                `json:"createdAt"`
	UpdatedAt  *string                `json:"updatedAt"`
}

CatalogEntitySnapshot is a Port entity without file payloads.

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) ApproveActionRun added in v0.2.23

func (c *Client) ApproveActionRun(ctx context.Context, runID string, body map[string]interface{}) (ActionRun, error)

ApproveActionRun approves or declines an action run.

func (*Client) BulkDeleteEntities added in v0.2.23

func (c *Client) BulkDeleteEntities(ctx context.Context, blueprintIdentifier string, entityIdentifiers []string, deleteDependents bool) (map[string]interface{}, error)

BulkDeleteEntities deletes multiple entities for a blueprint.

func (*Client) BulkUpsertEntities added in v0.2.23

func (c *Client) BulkUpsertEntities(ctx context.Context, blueprintID string, entities []Entity, upsert bool) ([]BulkEntityError, error)

BulkUpsertEntities upserts up to 20 entities for any blueprint in one call. Set upsert=true to overwrite existing entities; false returns 409 errors for conflicts.

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 using the organization-wide actions endpoint.

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) CreateMigration added in v0.3.7

func (c *Client) CreateMigration(ctx context.Context, migration MigrationRequest) (Migration, error)

CreateMigration starts a Port migration.

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) CreateUserEntitiesBulk added in v0.2.22

func (c *Client) CreateUserEntitiesBulk(ctx context.Context, entities []Entity, upsert bool) ([]BulkEntityError, error)

CreateUserEntitiesBulk creates up to 20 _user blueprint entities in one call. Set upsert=true to overwrite existing entities; false returns 409 errors for conflicts.

func (*Client) CreateWebhook added in v0.2.23

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

CreateWebhook creates a new webhook.

func (*Client) DeleteAction

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

DeleteAction deletes a blueprint-level action using the organization-wide actions endpoint.

func (*Client) DeleteActionByID added in v0.3.7

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

DeleteActionByID deletes an action using the organization-wide actions endpoint.

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) DeleteWebhook added in v0.2.23

func (c *Client) DeleteWebhook(ctx context.Context, id string) error

DeleteWebhook deletes a webhook.

func (*Client) ExecuteAction added in v0.2.23

func (c *Client) ExecuteAction(ctx context.Context, actionID string, body map[string]interface{}) (ActionRun, error)

ExecuteAction creates a new action run for the given action identifier.

func (*Client) ForEachEntity added in v0.3.2

func (c *Client) ForEachEntity(ctx context.Context, blueprintIdentifier string, yield func([]Entity) error) error

ForEachEntity retrieves all entities for a blueprint and calls yield with each returned batch. Blueprints above the threshold use the search endpoint because it supports cursor pagination; smaller blueprints use the canonical GET endpoint.

func (*Client) ForEachEntityPage added in v0.3.2

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

ForEachEntityPage queries entities for a blueprint using Port's search endpoint and calls yield once for each returned page.

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) GetActionRun added in v0.2.23

func (c *Client) GetActionRun(ctx context.Context, runID string) (ActionRun, error)

GetActionRun retrieves a specific action run.

func (*Client) GetActionRuns added in v0.2.23

func (c *Client) GetActionRuns(ctx context.Context) ([]ActionRun, error)

GetActionRuns retrieves all action runs.

func (*Client) GetActions

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

GetActions retrieves actions for a blueprint using the organization-wide actions endpoint and client-side blueprint filtering.

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) GetAuditLogs added in v0.2.23

func (c *Client) GetAuditLogs(ctx context.Context) ([]AuditLog, error)

GetAuditLogs retrieves the organization audit log.

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) GetEntitiesCount added in v0.3.2

func (c *Client) GetEntitiesCount(ctx context.Context, blueprintIdentifier string) (int, error)

GetEntitiesCount retrieves the number of 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) GetMigration added in v0.3.7

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

GetMigration retrieves a Port migration job.

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) GetPagePermissions added in v0.2.18

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

GetPagePermissions retrieves permissions for a page.

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) GetSkill added in v0.3.1

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

GetSkill fetches one published skill.

func (*Client) GetSkillsGrouped added in v0.3.1

func (c *Client) GetSkillsGrouped(ctx context.Context, query GetSkillsQuery) (*GroupedSkillsResponse, error)

GetSkillsGrouped fetches published skills grouped by skill group.

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) GetWebhook added in v0.2.23

func (c *Client) GetWebhook(ctx context.Context, id string) (Webhook, error)

GetWebhook retrieves a specific webhook.

func (*Client) GetWebhooks added in v0.2.23

func (c *Client) GetWebhooks(ctx context.Context) ([]Webhook, error)

GetWebhooks retrieves all webhooks.

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) PublishSkill added in v0.3.1

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

PublishSkill sets the active version to the latest semver.

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. Pages are fetched sequentially (each page's cursor depends on the previous response), so this cannot be parallelized client-side. For large blueprints this is still far better than GetEntities, which makes a single unbounded request that 504s above ~10k entities.

func (*Client) SearchSkills added in v0.3.1

func (c *Client) SearchSkills(ctx context.Context, query SearchSkillsQuery) (*SkillsSummaryResponse, error)

SearchSkills finds skills whose identifier or title matches the query.

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) UnpublishSkill added in v0.3.1

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

UnpublishSkill clears the active version.

func (*Client) UpdateAction

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

UpdateAction updates an existing blueprint-level action using the organization-wide actions endpoint.

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) UpdateActionRun added in v0.2.23

func (c *Client) UpdateActionRun(ctx context.Context, runID string, body map[string]interface{}) (ActionRun, error)

UpdateActionRun updates an action run (set status, message, link, logs).

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) UpdatePagePermissions added in v0.2.18

func (c *Client) UpdatePagePermissions(ctx context.Context, pageIdentifier string, permissions Permissions) (Permissions, error)

UpdatePagePermissions updates permissions for a 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) UpdateWebhook added in v0.2.23

func (c *Client) UpdateWebhook(ctx context.Context, id string, body map[string]interface{}) (Webhook, error)

UpdateWebhook updates an existing webhook.

func (*Client) UploadSkill added in v0.3.1

UploadSkill creates or updates a skill via POST /skills/upload.

func (*Client) UploadSkillsBatch added in v0.3.1

func (c *Client) UploadSkillsBatch(ctx context.Context, body BatchUploadSkillsRequest) (*BatchUploadSkillsResponse, error)

UploadSkillsBatch uploads multiple skills via POST /skills/upload/batch.

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 GetSkillResponse added in v0.3.1

type GetSkillResponse struct {
	OK    bool                 `json:"ok"`
	Skill SkillAtLatestVersion `json:"skill"`
}

GetSkillResponse is returned by GET /skills/:identifier.

type GetSkillsQuery added in v0.3.1

type GetSkillsQuery struct {
	SkillIdentifiers   []string
	IncludeGroups      []string
	ExcludeGroups      []string
	TeamsDefault       *bool
	Limit              int
	Exclude            []string
	IncludeUngrouped   bool
	IncludeUnpublished bool
}

GetSkillsQuery optional filters for GET /skills.

type GroupedSkillsResponse added in v0.3.1

type GroupedSkillsResponse struct {
	OK              bool                        `json:"ok"`
	Groups          []SkillGroupAtLatestVersion `json:"groups"`
	UngroupedSkills []SkillAtLatestVersion      `json:"ungroupedSkills"`
}

GroupedSkillsResponse is the GET /skills response body.

type Integration

type Integration map[string]interface{}

Integration represents a Port integration.

type Migration added in v0.3.7

type Migration map[string]interface{}

Migration represents a Port migration job.

type MigrationRequest added in v0.3.7

type MigrationRequest struct {
	SourceBlueprint string                 `json:"sourceBlueprint"`
	Mapping         map[string]interface{} `json:"mapping"`
}

MigrationRequest represents a Port migration request.

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 SearchSkillsQuery added in v0.3.1

type SearchSkillsQuery struct {
	Query string
	Limit int
}

SearchSkillsQuery optional filters for GET /skills/search.

type SkillAtLatestVersion added in v0.3.1

type SkillAtLatestVersion struct {
	Identifier        string      `json:"identifier"`
	AgentSkillName    string      `json:"agentSkillName,omitempty"`
	Title             string      `json:"title"`
	Location          string      `json:"location"`
	Description       string      `json:"description,omitempty"`
	Version           string      `json:"version"`
	VersionIdentifier string      `json:"versionIdentifier"`
	GroupIdentifiers  []string    `json:"groupIdentifiers,omitempty"`
	Files             []SkillFile `json:"files"`
}

SkillAtLatestVersion is one skill at its active version (sync catalog).

type SkillCatalogEntry added in v0.3.1

type SkillCatalogEntry struct {
	Skill   CatalogEntitySnapshot  `json:"skill"`
	Version *CatalogEntitySnapshot `json:"version"`
}

SkillCatalogEntry pairs a skill entity with its resolved version (if any).

type SkillFile added in v0.3.1

type SkillFile struct {
	Identifier string                 `json:"identifier,omitempty"`
	Title      string                 `json:"title,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
	Relations  map[string]interface{} `json:"relations,omitempty"`
}

SkillFile is one file in a skill directory tree.

type SkillFileInput added in v0.3.1

type SkillFileInput struct {
	Path    string `json:"path"`
	Content string `json:"content"`
	Title   string `json:"title,omitempty"`
}

SkillFileInput is one file in a create/edit skill request.

type SkillGroupAtLatestVersion added in v0.3.1

type SkillGroupAtLatestVersion struct {
	Identifier       string                 `json:"identifier"`
	Title            string                 `json:"title"`
	Description      string                 `json:"description,omitempty"`
	OwningTeamIDs    []string               `json:"owningTeamIds"`
	MatchesUserTeams bool                   `json:"matchesUserTeams"`
	Skills           []SkillAtLatestVersion `json:"skills"`
}

SkillGroupAtLatestVersion groups skills with catalog metadata.

type SkillVersionWriteResponse added in v0.3.1

type SkillVersionWriteResponse struct {
	OK                bool     `json:"ok"`
	SkillIdentifier   string   `json:"skillIdentifier"`
	Version           string   `json:"version"`
	VersionIdentifier string   `json:"versionIdentifier"`
	ActiveVersionSet  bool     `json:"activeVersionSet"`
	FileIdentifiers   []string `json:"fileIdentifiers"`
}

SkillVersionWriteResponse is returned by create/edit skill endpoints.

type SkillsSummaryResponse added in v0.3.1

type SkillsSummaryResponse struct {
	OK     bool                `json:"ok"`
	Skills []SkillCatalogEntry `json:"skills"`
}

SkillsSummaryResponse is the GET /skills/summary response body.

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 UnpublishSkillResponse added in v0.3.1

type UnpublishSkillResponse struct {
	OK              bool   `json:"ok"`
	SkillIdentifier string `json:"skillIdentifier"`
}

UnpublishSkillResponse is returned by POST /skills/:identifier/unpublish.

type UploadSkillRequest added in v0.3.1

type UploadSkillRequest struct {
	Identifier     string           `json:"identifier"`
	Title          string           `json:"title,omitempty"`
	Description    string           `json:"description,omitempty"`
	Location       string           `json:"location,omitempty"`
	Publish        bool             `json:"publish,omitempty"`
	VersionBump    VersionBump      `json:"versionBump,omitempty"`
	GroupIDs       []string         `json:"groupIdentifiers,omitempty"`
	FolderBaseName string           `json:"folderBaseName,omitempty"`
	Files          []SkillFileInput `json:"files"`
}

UploadSkillRequest is the POST /skills/upload body.

type User

type User map[string]interface{}

User represents a Port user.

type VersionBump added in v0.3.1

type VersionBump string

VersionBump is the semver increment for a new skill version.

const (
	VersionBumpPatch VersionBump = "patch"
	VersionBumpMinor VersionBump = "minor"
	VersionBumpMajor VersionBump = "major"
)

type Webhook added in v0.2.23

type Webhook map[string]interface{}

Webhook represents a Port webhook.

Jump to

Keyboard shortcuts

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