Files
upstream-mirror 240db4e2a7
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 00:29:55 +05:00

226 lines
8.9 KiB
Go

package pluginapi
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/plugin"
)
// PropertyService exposes methods to manipulate property fields and values.
type PropertyService struct {
api plugin.API
}
// CreatePropertyField creates a new property field.
//
// If the field's LinkedFieldID is set, the field inherits type, options,
// and security attributes from the referenced template field. The source
// must be a template field in the same group, must not itself be linked,
// and must not be deleted.
//
// Minimum server version: 10.10
func (p *PropertyService) CreatePropertyField(field *model.PropertyField) (*model.PropertyField, error) {
return p.api.CreatePropertyField(field)
}
// GetPropertyField gets a property field by groupID and fieldID.
//
// Minimum server version: 10.10
func (p *PropertyService) GetPropertyField(groupID, fieldID string) (*model.PropertyField, error) {
return p.api.GetPropertyField(groupID, fieldID)
}
// GetPropertyFields gets multiple property fields by groupID and a list of IDs.
//
// Minimum server version: 10.10
func (p *PropertyService) GetPropertyFields(groupID string, ids []string) ([]*model.PropertyField, error) {
return p.api.GetPropertyFields(groupID, ids)
}
// UpdatePropertyField updates an existing property field.
//
// Fields with a LinkedFieldID cannot have their type or options modified.
// Set LinkedFieldID to an empty string to unlink a field from its source.
//
// Minimum server version: 10.10
func (p *PropertyService) UpdatePropertyField(groupID string, field *model.PropertyField) (*model.PropertyField, error) {
return p.api.UpdatePropertyField(groupID, field)
}
// DeletePropertyField deletes a property field (soft delete).
//
// Returns an error if the field has active linked dependents. Unlink or
// delete dependent fields first.
//
// Minimum server version: 10.10
func (p *PropertyService) DeletePropertyField(groupID, fieldID string) error {
return p.api.DeletePropertyField(groupID, fieldID)
}
// SearchPropertyFields searches for property fields with filtering options.
//
// Minimum server version: 11.0
func (p *PropertyService) SearchPropertyFields(groupID string, opts model.PropertyFieldSearchOpts) ([]*model.PropertyField, error) {
return p.api.SearchPropertyFields(groupID, opts)
}
// CountPropertyFields counts property fields for a group.
//
// Minimum server version: 11.0
func (p *PropertyService) CountPropertyFields(groupID string, includeDeleted bool) (int64, error) {
return p.api.CountPropertyFields(groupID, includeDeleted)
}
// CountPropertyFieldsForTarget counts property fields for a specific target.
//
// Minimum server version: 11.0
func (p *PropertyService) CountPropertyFieldsForTarget(groupID, targetType, targetID string, includeDeleted bool) (int64, error) {
return p.api.CountPropertyFieldsForTarget(groupID, targetType, targetID, includeDeleted)
}
// CreatePropertyValue creates a new property value.
//
// Minimum server version: 10.10
func (p *PropertyService) CreatePropertyValue(value *model.PropertyValue) (*model.PropertyValue, error) {
return p.api.CreatePropertyValue(value)
}
// GetPropertyValue gets a property value by groupID and valueID.
//
// Minimum server version: 10.10
func (p *PropertyService) GetPropertyValue(groupID, valueID string) (*model.PropertyValue, error) {
return p.api.GetPropertyValue(groupID, valueID)
}
// GetPropertyValues gets multiple property values by groupID and a list of IDs.
//
// Minimum server version: 10.10
func (p *PropertyService) GetPropertyValues(groupID string, ids []string) ([]*model.PropertyValue, error) {
return p.api.GetPropertyValues(groupID, ids)
}
// UpdatePropertyValue updates an existing property value.
//
// Minimum server version: 10.10
func (p *PropertyService) UpdatePropertyValue(groupID string, value *model.PropertyValue) (*model.PropertyValue, error) {
return p.api.UpdatePropertyValue(groupID, value)
}
// UpsertPropertyValue creates a new property value or updates it if it already exists.
//
// Minimum server version: 10.10
func (p *PropertyService) UpsertPropertyValue(value *model.PropertyValue) (*model.PropertyValue, error) {
return p.api.UpsertPropertyValue(value)
}
// DeletePropertyValue deletes a property value (soft delete).
//
// Minimum server version: 10.10
func (p *PropertyService) DeletePropertyValue(groupID, valueID string) error {
return p.api.DeletePropertyValue(groupID, valueID)
}
// SearchPropertyValues searches for property values with filtering options.
//
// Minimum server version: 11.0
func (p *PropertyService) SearchPropertyValues(groupID string, opts model.PropertyValueSearchOpts) ([]*model.PropertyValue, error) {
return p.api.SearchPropertyValues(groupID, opts)
}
// RegisterPropertyGroup registers a new property group.
//
// Minimum server version: 10.10
func (p *PropertyService) RegisterPropertyGroup(name string) (*model.PropertyGroup, error) {
return p.api.RegisterPropertyGroup(name)
}
// GetPropertyGroup gets a property group by name.
//
// Minimum server version: 10.10
func (p *PropertyService) GetPropertyGroup(name string) (*model.PropertyGroup, error) {
return p.api.GetPropertyGroup(name)
}
// GetPropertyFieldByName gets a property field by groupID, targetID and name.
//
// Minimum server version: 10.10
func (p *PropertyService) GetPropertyFieldByName(groupID, targetID, name string) (*model.PropertyField, error) {
return p.api.GetPropertyFieldByName(groupID, targetID, name)
}
// UpdatePropertyFields updates multiple property fields in a single operation.
//
// Minimum server version: 10.10
func (p *PropertyService) UpdatePropertyFields(groupID string, fields []*model.PropertyField) ([]*model.PropertyField, error) {
return p.api.UpdatePropertyFields(groupID, fields)
}
// UpdatePropertyValues updates multiple property values in a single operation.
//
// Minimum server version: 10.10
func (p *PropertyService) UpdatePropertyValues(groupID string, values []*model.PropertyValue) ([]*model.PropertyValue, error) {
return p.api.UpdatePropertyValues(groupID, values)
}
// UpsertPropertyValues creates or updates multiple property values in a single operation.
//
// Minimum server version: 10.10
func (p *PropertyService) UpsertPropertyValues(values []*model.PropertyValue) ([]*model.PropertyValue, error) {
return p.api.UpsertPropertyValues(values)
}
// DeletePropertyValuesForTarget deletes all property values for a specific target.
//
// Minimum server version: 10.10
func (p *PropertyService) DeletePropertyValuesForTarget(groupID, targetType, targetID string) error {
return p.api.DeletePropertyValuesForTarget(groupID, targetType, targetID)
}
// DeletePropertyValuesForField deletes all property values for a specific field.
//
// Minimum server version: 10.10
func (p *PropertyService) DeletePropertyValuesForField(groupID, fieldID string) error {
return p.api.DeletePropertyValuesForField(groupID, fieldID)
}
// UpsertPropertyValuesWithOptions creates or updates multiple property values,
// declaring the scope the plugin is acting as for owner-based access control.
//
// Minimum server version: 11.10
func (p *PropertyService) UpsertPropertyValuesWithOptions(values []*model.PropertyValue, options model.PropertyRequestOptions) ([]*model.PropertyValue, error) {
return p.api.UpsertPropertyValuesWithOptions(values, options)
}
// UpsertPropertyValueWithOptions creates or updates a single property value,
// declaring the scope the plugin is acting as for owner-based access control.
//
// Minimum server version: 11.10
func (p *PropertyService) UpsertPropertyValueWithOptions(value *model.PropertyValue, options model.PropertyRequestOptions) (*model.PropertyValue, error) {
return p.api.UpsertPropertyValueWithOptions(value, options)
}
// DeletePropertyValueWithOptions deletes a property value, declaring the scope
// the plugin is acting as for owner-based access control.
//
// Minimum server version: 11.10
func (p *PropertyService) DeletePropertyValueWithOptions(groupID, valueID string, options model.PropertyRequestOptions) error {
return p.api.DeletePropertyValueWithOptions(groupID, valueID, options)
}
// DeletePropertyValuesForTargetWithOptions deletes all property values for a
// target, declaring the scope the plugin is acting as. This is the
// deprovisioning entrypoint and needs only the target, no value objects.
//
// Minimum server version: 11.10
func (p *PropertyService) DeletePropertyValuesForTargetWithOptions(groupID, targetType, targetID string, options model.PropertyRequestOptions) error {
return p.api.DeletePropertyValuesForTargetWithOptions(groupID, targetType, targetID, options)
}
// DeletePropertyValuesForFieldWithOptions deletes all property values for a
// field, declaring the scope the plugin is acting as for owner-based access
// control.
//
// Minimum server version: 11.10
func (p *PropertyService) DeletePropertyValuesForFieldWithOptions(groupID, fieldID string, options model.PropertyRequestOptions) error {
return p.api.DeletePropertyValuesForFieldWithOptions(groupID, fieldID, options)
}