sharedtypes

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AddressBlockSchema = schema.ListNestedBlock{
		MarkdownDescription: "Addresses used by the Business Unit.",
		NestedObject: schema.NestedBlockObject{
			Attributes: map[string]schema.Attribute{
				"id": schema.StringAttribute{
					MarkdownDescription: "Unique identifier of the Address",
					Computed:            true,
				},
				"key": schema.StringAttribute{
					MarkdownDescription: "User-defined identifier of the Address that must be unique when multiple " +
						"addresses are referenced in BusinessUnits, Customers, and itemShippingAddresses " +
						"(LineItem-specific addresses) of a Cart, Order, QuoteRequest, or Quote.",
					Required: true,
				},
				"external_id": schema.StringAttribute{
					MarkdownDescription: "ID for the contact used in an external system",
					Optional:            true,
				},
				"country": schema.StringAttribute{
					MarkdownDescription: "Name of the country",
					Required:            true,
				},
				"title": schema.StringAttribute{
					MarkdownDescription: "Title of the contact, for example Dr., Prof.",
					Optional:            true,
				},
				"salutation": schema.StringAttribute{
					MarkdownDescription: "Salutation of the contact, for example Ms., Mr.",
					Optional:            true,
				},
				"first_name": schema.StringAttribute{
					MarkdownDescription: "First name of the contact",
					Optional:            true,
				},
				"last_name": schema.StringAttribute{
					MarkdownDescription: "Last name of the contact",
					Optional:            true,
				},
				"street_name": schema.StringAttribute{
					MarkdownDescription: "Name of the street",
					Optional:            true,
				},
				"street_number": schema.StringAttribute{
					MarkdownDescription: "Street number",
					Optional:            true,
				},
				"additional_street_info": schema.StringAttribute{
					MarkdownDescription: "Further information on the street address",
					Optional:            true,
				},
				"postal_code": schema.StringAttribute{
					MarkdownDescription: "Postal code",
					Optional:            true,
				},
				"city": schema.StringAttribute{
					MarkdownDescription: "Name of the city",
					Optional:            true,
				},
				"region": schema.StringAttribute{
					MarkdownDescription: "Name of the region",
					Optional:            true,
				},
				"state": schema.StringAttribute{
					MarkdownDescription: "Name of the state",
					Optional:            true,
				},
				"company": schema.StringAttribute{
					MarkdownDescription: "Name of the company",
					Optional:            true,
				},
				"department": schema.StringAttribute{
					MarkdownDescription: "Name of the department",
					Optional:            true,
				},
				"building": schema.StringAttribute{
					MarkdownDescription: "Name or number of the building",
					Optional:            true,
				},
				"apartment": schema.StringAttribute{
					MarkdownDescription: "Name or number of the apartment",
					Optional:            true,
				},
				"po_box": schema.StringAttribute{
					MarkdownDescription: "Post office box number",
					Optional:            true,
				},
				"phone": schema.StringAttribute{
					MarkdownDescription: "Phone number",
					Optional:            true,
				},
				"mobile": schema.StringAttribute{
					MarkdownDescription: "Mobile phone number",
					Optional:            true,
				},
				"email": schema.StringAttribute{
					MarkdownDescription: "Email address",
					Optional:            true,
				},
				"fax": schema.StringAttribute{
					MarkdownDescription: "Fax number",
					Optional:            true,
				},
				"additional_address_info": schema.StringAttribute{
					MarkdownDescription: "Further information on the Address",
					Optional:            true,
				},
			},
		},
	}
)
View Source
var (
	CustomSchema schema.Block = schema.SingleNestedBlock{
		MarkdownDescription: "Custom fields for this resource.",
		Attributes: map[string]schema.Attribute{
			"type_id": schema.StringAttribute{
				MarkdownDescription: "The ID of the custom type to use for this resource.",
				Optional:            true,
			},
			"fields": schema.MapAttribute{
				ElementType: types.StringType,
				MarkdownDescription: "CustomValue fields for this resource. Note that " +
					"the values need to be provided as JSON encoded " +
					"strings: `my-value = jsonencode({\"key\": \"value\"})`",
				Optional: true,
			},
		},
		Validators: []validator.Object{

			objectvalidator.AlsoRequires(path.MatchRelative().AtName("type_id")),
		},
	}
)
View Source
var (
	StoreKeyReferenceBlockSchema = schema.ListNestedBlock{
		MarkdownDescription: "Sets the Stores the Business Unit is associated with. \n\nIf the Business Unit has Stores defined, " +
			"then all of its Carts, Orders, Quotes, or Quote Requests must belong to one of the Business Unit's " +
			"Stores.\n\nIf the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests " +
			"must not belong to any Store.",
		NestedObject: schema.NestedBlockObject{
			Attributes: map[string]schema.Attribute{
				"key": schema.StringAttribute{
					MarkdownDescription: "User-defined unique identifier of the Store",
					Optional:            true,
				},
			},
		},
	}
)

Functions

func AddressesAddActions

func AddressesAddActions[A AddAddressAction](currentAddresses []Address, plannedAddresses []Address) []any

func AddressesChangeActions

func AddressesChangeActions[C ChangeAddressAction](currentAddresses []Address, plannedAddresses []Address) []any

func AddressesDeleteActions

func AddressesDeleteActions[D DeleteAddressAction](currentAddresses []Address, plannedAddresses []Address) []any

func CustomFieldUpdateActions added in v1.19.0

func CustomFieldUpdateActions[T commercetools.SetCustomTypeAction, F commercetools.SetCustomFieldAction](t *platform.Type, current, plan *Custom) ([]any, error)

CustomFieldUpdateActions generates the update actions for custom fields. It uses the default custom field encoder.

Types

type AddAddressAction

type AddAddressAction interface {
	platform.BusinessUnitAddAddressAction
}

type Address

type Address struct {
	ID                    types.String `tfsdk:"id"`
	Key                   types.String `tfsdk:"key"`
	ExternalID            types.String `tfsdk:"external_id"`
	Country               types.String `tfsdk:"country"`
	Title                 types.String `tfsdk:"title"`
	Salutation            types.String `tfsdk:"salutation"`
	FirstName             types.String `tfsdk:"first_name"`
	LastName              types.String `tfsdk:"last_name"`
	StreetName            types.String `tfsdk:"street_name"`
	StreetNumber          types.String `tfsdk:"street_number"`
	AdditionalStreetInfo  types.String `tfsdk:"additional_street_info"`
	PostalCode            types.String `tfsdk:"postal_code"`
	City                  types.String `tfsdk:"city"`
	Region                types.String `tfsdk:"region"`
	State                 types.String `tfsdk:"state"`
	Company               types.String `tfsdk:"company"`
	Department            types.String `tfsdk:"department"`
	Building              types.String `tfsdk:"building"`
	Apartment             types.String `tfsdk:"apartment"`
	POBox                 types.String `tfsdk:"po_box"`
	Phone                 types.String `tfsdk:"phone"`
	Mobile                types.String `tfsdk:"mobile"`
	Email                 types.String `tfsdk:"email"`
	Fax                   types.String `tfsdk:"fax"`
	AdditionalAddressInfo types.String `tfsdk:"additional_address_info"`
}

func NewAddressFromNative

func NewAddressFromNative(a *platform.Address) Address

NewAddressFromNative creates a new Address from a platform.Address.

func (Address) Draft

func (a Address) Draft() platform.BaseAddress

func (Address) Equal

func (a Address) Equal(other Address) bool

type ChangeAddressAction

type ChangeAddressAction interface {
	platform.BusinessUnitChangeAddressAction
}

type Custom added in v1.19.0

type Custom struct {
	TypeID *string           `tfsdk:"type_id"`
	Fields map[string]string `tfsdk:"fields"`
}

func NewCustomFromNative added in v1.19.0

func NewCustomFromNative(c *platform.CustomFields) (*Custom, error)

func (*Custom) Draft added in v1.19.0

Draft generates a custom fields draft. It uses the default custom field encoder.

func (*Custom) IsSet added in v1.19.0

func (c *Custom) IsSet() bool

type CustomFieldTypeEncoder added in v1.19.0

type CustomFieldTypeEncoder func(t *platform.Type, name string, value any) (any, error)

type DeleteAddressAction

type DeleteAddressAction interface {
	platform.BusinessUnitRemoveAddressAction
}

type StoreKeyReference

type StoreKeyReference struct {
	Key types.String `tfsdk:"key"`
}

StoreKeyReference is a type to model the fields that all types of StoreKeyReference have in common.

func NewStoreKeyReferenceFromNative

func NewStoreKeyReferenceFromNative(n *platform.StoreKeyReference) StoreKeyReference

Jump to

Keyboard shortcuts

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