Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(b bool) *bool
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Int(i int) *int
- func Int64(i int64) *int64
- func Pointer[T any](v T) *T
- func String(s string) *string
- type Accounts
- type AddressBook
- type ByExtID
- func (s *ByExtID) AddToGroup(ctx context.Context, extID string, groupID int64, opts ...operations.Option) (*operations.AddContactByExtIDToGroupResponse, error)
- func (s *ByExtID) Delete(ctx context.Context, extID string, opts ...operations.Option) (*operations.DeleteContactByExternalIDResponse, error)
- func (s *ByExtID) Get(ctx context.Context, extID string, opts ...operations.Option) (*operations.GetContactByExternalIDResponse, error)
- func (s *ByExtID) RemoveFromGroup(ctx context.Context, extID string, groupID int64, opts ...operations.Option) (*operations.RemoveContactByExtIDToGroupResponse, error)
- func (s *ByExtID) Update(ctx context.Context, extID string, contact components.Contact, ...) (*operations.UpdateContactByExternalIDResponse, error)
- type Client
- type Common
- type Contacts
- func (s *Contacts) Add(ctx context.Context, request components.Contact, opts ...operations.Option) (*operations.AddContactResponse, error)
- func (s *Contacts) AddToGroup(ctx context.Context, id int64, groupID int64, opts ...operations.Option) (*operations.AddContactToGroupResponse, error)
- func (s *Contacts) Delete(ctx context.Context, id int64, opts ...operations.Option) (*operations.DeleteContactResponse, error)
- func (s *Contacts) Get(ctx context.Context, id int64, opts ...operations.Option) (*operations.GetContactByIDResponse, error)
- func (s *Contacts) List(ctx context.Context, page *int64, limit *int64, opts ...operations.Option) (*operations.ListContactsResponse, error)
- func (s *Contacts) RemoveFromGroup(ctx context.Context, id int64, groupID int64, opts ...operations.Option) (*operations.RemoveContactFromGroupResponse, error)
- func (s *Contacts) Update(ctx context.Context, id int64, contact components.Contact, ...) (*operations.UpdateContactResponse, error)
- type Groups
- func (s *Groups) Add(ctx context.Context, request components.Group, opts ...operations.Option) (*operations.AddGroupResponse, error)
- func (s *Groups) Delete(ctx context.Context, id int64, contacts *operations.ContactHandling, ...) (*operations.DeleteGroupResponse, error)
- func (s *Groups) Get(ctx context.Context, id int64, opts ...operations.Option) (*operations.GetGroupByIDResponse, error)
- func (s *Groups) List(ctx context.Context, opts ...operations.Option) (*operations.ListGroupsResponse, error)
- func (s *Groups) Update(ctx context.Context, id int64, group components.Group, ...) (*operations.UpdateGroupResponse, error)
- type HTTPClient
- type Metadata
- type SDKOption
- func WithClient(client HTTPClient) SDKOption
- func WithRetryConfig(retryConfig retry.Config) SDKOption
- func WithSecurity(bearer string) SDKOption
- func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption
- func WithServer(server string) SDKOption
- func WithServerURL(serverURL string) SDKOption
- func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption
- func WithTimeout(timeout time.Duration) SDKOption
- type Senders
- func (s *Senders) Add(ctx context.Context, request components.Sender, opts ...operations.Option) (*operations.AddSenderResponse, error)
- func (s *Senders) Delete(ctx context.Context, id int64, opts ...operations.Option) (*operations.DeleteSenderResponse, error)
- func (s *Senders) List(ctx context.Context, opts ...operations.Option) (*operations.ListSendersResponse, error)
- func (s *Senders) Verify(ctx context.Context, id int64, requestBody operations.VerifySenderRequestBody, ...) (*operations.VerifySenderResponse, error)
- type Shipments
- func (s *Shipments) Cancel(ctx context.Context, ids []string, opts ...operations.Option) (*operations.CancelShipmentResponse, error)
- func (s *Shipments) Dispatch(ctx context.Context, request components.Shipment, opts ...operations.Option) (*operations.ShipmentDispatchResponse, error)
- func (s *Shipments) Documents(ctx context.Context, id string, type_ operations.DocumentType, ...) (*operations.GetDocumentsResponse, error)
- func (s *Shipments) Price(ctx context.Context, request components.Shipment, opts ...operations.Option) (*operations.ShipmentPriceResponse, error)
- func (s *Shipments) Status(ctx context.Context, ids []string, opts ...operations.Option) (*operations.GetStatusResponse, error)
Constants ¶
const ( // Production system ServerProd string = "prod" // Test system (SANDBOX) ServerSandbox string = "sandbox" )
Variables ¶
var ServerList = map[string]string{ ServerProd: "https://api.postivo.pl/rest/v1", ServerSandbox: "https://api.postivo.pl/rest-sandbox/v1", }
ServerList contains the list of servers available to the SDK
Functions ¶
Types ¶
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
func (*Accounts) Get ¶
func (s *Accounts) Get(ctx context.Context, opts ...operations.Option) (*operations.GetAccountDetailsResponse, error)
Get - Retrieve account details Retrieve the current account balance and other account details. You can also check the account limit and whether the account is a **main** account. Main accounts have unrestricted privileges and, via the [User Panel](https://panel.postivo.pl), you can create as many subaccounts as needed.
func (*Accounts) GetSubaccount ¶
func (s *Accounts) GetSubaccount(ctx context.Context, userLogin string, opts ...operations.Option) (*operations.GetSubaccountDetailsResponse, error)
GetSubaccount - Get subaccount details Check the account balance and other details, such as the subcredit balance of a subaccount. Subaccounts are additional users who can access your account’s services and data. You can restrict access levels and set privileges for subaccounts in the [User Panel](https://panel.postivo.pl).
Provide the full subaccount login to access its data.
type AddressBook ¶
type ByExtID ¶
type ByExtID struct {
// contains filtered or unexported fields
}
func (*ByExtID) AddToGroup ¶
func (s *ByExtID) AddToGroup(ctx context.Context, extID string, groupID int64, opts ...operations.Option) (*operations.AddContactByExtIDToGroupResponse, error)
AddToGroup - Add a contact to a group by EXT_ID Assign a contact to a group using the contact’s external (custom) ID (assigned when creating the contact). If a contact and a group exist in your account, you can add the contact to that group.
Provide the contact’s `ext_id` and the group’s `group_id` parameters to perform the assignment.
func (*ByExtID) Delete ¶
func (s *ByExtID) Delete(ctx context.Context, extID string, opts ...operations.Option) (*operations.DeleteContactByExternalIDResponse, error)
Delete a contact by EXT_ID Remove a contact from your account by its external (custom) ID - the value defined when the contact was created.
func (*ByExtID) Get ¶
func (s *ByExtID) Get(ctx context.Context, extID string, opts ...operations.Option) (*operations.GetContactByExternalIDResponse, error)
Get - Retrieve contact details by EXT_ID Get the details of a contact from your Address Book using your external (custom) ID (the value you defined when creating the contact).
func (*ByExtID) RemoveFromGroup ¶
func (s *ByExtID) RemoveFromGroup(ctx context.Context, extID string, groupID int64, opts ...operations.Option) (*operations.RemoveContactByExtIDToGroupResponse, error)
RemoveFromGroup - Remove a contact from a group by EXT_ID Remove a contact from a group in your Address Book using the contact’s external (custom) ID. This operation does not delete the contact; it only detaches the contact from the group. Provide the contact’s `ext_id` and the group’s `group_id` parameters to perform the detachment.
func (*ByExtID) Update ¶
func (s *ByExtID) Update(ctx context.Context, extID string, contact components.Contact, opts ...operations.Option) (*operations.UpdateContactByExternalIDResponse, error)
Update a contact by EXT_ID Update a contact by its external (custom) ID - the value you defined when creating the contact.
type Client ¶
type Common ¶
type Common struct {
// contains filtered or unexported fields
}
Common
func (*Common) Ping ¶
func (s *Common) Ping(ctx context.Context, opts ...operations.Option) (*operations.PingResponse, error)
Ping - Check API availability and version Check the API connection and current availability status. The response also includes the current API version.
type Contacts ¶
type Contacts struct {
ByExtID *ByExtID
// contains filtered or unexported fields
}
func (*Contacts) Add ¶
func (s *Contacts) Add(ctx context.Context, request components.Contact, opts ...operations.Option) (*operations.AddContactResponse, error)
Add a new contact Create a new contact in your account’s **Address Book**.
func (*Contacts) AddToGroup ¶
func (s *Contacts) AddToGroup(ctx context.Context, id int64, groupID int64, opts ...operations.Option) (*operations.AddContactToGroupResponse, error)
AddToGroup - Add a contact to a group Assign a contact to a group. If a contact and a group exist in your account, you can add the contact to that group.
Provide the contact’s `id` and the group’s `group_id` parameters to perform the assignment.
func (*Contacts) Delete ¶
func (s *Contacts) Delete(ctx context.Context, id int64, opts ...operations.Option) (*operations.DeleteContactResponse, error)
Delete a contact Remove a contact from your account by system ID.
func (*Contacts) Get ¶
func (s *Contacts) Get(ctx context.Context, id int64, opts ...operations.Option) (*operations.GetContactByIDResponse, error)
Get - Retrieve contact details Get the details of a contact from your Address Book using its global `id`.
func (*Contacts) List ¶
func (s *Contacts) List(ctx context.Context, page *int64, limit *int64, opts ...operations.Option) (*operations.ListContactsResponse, error)
List contacts Retrieve a paginated list of all contacts defined in your account’s **Address Book**.
func (*Contacts) RemoveFromGroup ¶
func (s *Contacts) RemoveFromGroup(ctx context.Context, id int64, groupID int64, opts ...operations.Option) (*operations.RemoveContactFromGroupResponse, error)
RemoveFromGroup - Remove a contact from a group Remove a contact from a group in your Address Book. This does not delete the contact; it only detaches the contact from the group.
Provide the contact’s `id` and the group’s `group_id` parameters to perform the detachment.
func (*Contacts) Update ¶
func (s *Contacts) Update(ctx context.Context, id int64, contact components.Contact, opts ...operations.Option) (*operations.UpdateContactResponse, error)
Update a contact Update a contact by its global ID.
type Groups ¶
type Groups struct {
// contains filtered or unexported fields
}
func (*Groups) Add ¶
func (s *Groups) Add(ctx context.Context, request components.Group, opts ...operations.Option) (*operations.AddGroupResponse, error)
Add a new group Create a new contact group in your account’s Address Book.
func (*Groups) Delete ¶
func (s *Groups) Delete(ctx context.Context, id int64, contacts *operations.ContactHandling, opts ...operations.Option) (*operations.DeleteGroupResponse, error)
Delete a group Remove a group from your account’s Address Book by `ID`. Pass the group’s `id` to remove it. The group is deleted immediately from the Address Book.
If you also want to remove contacts that belong to this group, set the parameter `contacts` to `delete`. The default is `contacts: detach`, which detaches contacts from the removed group but leaves them in the Address Book.
func (*Groups) Get ¶
func (s *Groups) Get(ctx context.Context, id int64, opts ...operations.Option) (*operations.GetGroupByIDResponse, error)
Get - Retrieve group details Get the details of a single group from your Address Book by its `id` (returned when the group was created).
func (*Groups) List ¶
func (s *Groups) List(ctx context.Context, opts ...operations.Option) (*operations.ListGroupsResponse, error)
List groups Retrieve the full list of groups defined in your account’s Address Book.
func (*Groups) Update ¶
func (s *Groups) Update(ctx context.Context, id int64, group components.Group, opts ...operations.Option) (*operations.UpdateGroupResponse, error)
Update a group Update a group’s details by ID.
type HTTPClient ¶
HTTPClient provides an interface for supplying the SDK with a custom HTTP client
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
func (*Metadata) GetPredefinedConfigs ¶
func (s *Metadata) GetPredefinedConfigs(ctx context.Context, opts ...operations.Option) (*operations.ListPredefinedConfigsResponse, error)
GetPredefinedConfigs - List predefined configs Retrieve a complete list of predefined shipment configurations. The method has no body and takes no parameters. The response includes all stored configuration options.
func (*Metadata) List ¶
func (s *Metadata) List(ctx context.Context, opts ...operations.Option) (*operations.ListMetadataResponse, error)
List metadata Retrieve a complete list of all types for shipments and their possible values. The method has no body and takes no parameters. The response includes metadata such as carrier types, service types, and more.
type SDKOption ¶
type SDKOption func(*Client)
func WithClient ¶
func WithClient(client HTTPClient) SDKOption
WithClient allows the overriding of the default HTTP client used by the SDK
func WithRetryConfig ¶
func WithSecurity ¶
WithSecurity configures the SDK to use the provided security details
func WithSecuritySource ¶
WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication
func WithServer ¶
WithServer allows the overriding of the default server by name
func WithServerURL ¶
WithServerURL allows the overriding of the default server URL
func WithTemplatedServerURL ¶
WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters
func WithTimeout ¶
WithTimeout Optional request timeout applied to each operation
type Senders ¶
type Senders struct {
// contains filtered or unexported fields
}
func (*Senders) Add ¶
func (s *Senders) Add(ctx context.Context, request components.Sender, opts ...operations.Option) (*operations.AddSenderResponse, error)
Add a new sender Create a new sender on your account. The request must contain a `Sender` object. To prevent fraud, all additional senders are verified by mailing a verification code to the sender’s address. Complete the verification using the `verifySender` method. Verified senders have `active: true` and can be used to send shipments. Inactive senders are also returned (`active: false`), but cannot be used until verification is completed.
func (*Senders) Delete ¶
func (s *Senders) Delete(ctx context.Context, id int64, opts ...operations.Option) (*operations.DeleteSenderResponse, error)
Delete a sender Remove a sender from your account by `id`. Pass the sender’s `id` parameter to remove it. The sender is deleted immediately.
func (*Senders) List ¶
func (s *Senders) List(ctx context.Context, opts ...operations.Option) (*operations.ListSendersResponse, error)
List senders Retrieve the list of allowed senders defined in your account. Senders are registered in your account and must be verified and activated before use. Activated senders have `active: true` property and can be used to send shipments. Inactive senders are also returned (`active: false`), but cannot be used until activated.
func (*Senders) Verify ¶
func (s *Senders) Verify(ctx context.Context, id int64, requestBody operations.VerifySenderRequestBody, opts ...operations.Option) (*operations.VerifySenderResponse, error)
Verify sender Verify a sender to activate it. After adding a new sender, a letter containing a verification code is mailed to the sender’s address. Provide this code to complete verification.
type Shipments ¶
type Shipments struct {
// contains filtered or unexported fields
}
func (*Shipments) Cancel ¶
func (s *Shipments) Cancel(ctx context.Context, ids []string, opts ...operations.Option) (*operations.CancelShipmentResponse, error)
Cancel shipments Cancel shipments that have not yet been processed by their `ids`. Pass the unique shipment IDs (returned when the shipment was created) as a parameter. To cancel multiple shipments at once, provide a list of IDs (up to **50** per call). For larger volumes, split the operation into multiple requests. Only shipments with status `ACCEPTED` can be cancelled.
If duplicate shipment IDs are provided in a single call, the API processes each unique ID only once.
func (*Shipments) Dispatch ¶
func (s *Shipments) Dispatch(ctx context.Context, request components.Shipment, opts ...operations.Option) (*operations.ShipmentDispatchResponse, error)
Dispatch a new shipment Send a shipment to one or multiple recipients in a single request. Provide a `Shipment` object. The object includes properties that define the shipment (recipient details, included documents, and optional settings). Some fields are required.
The system accepts up to **50** recipients per call. For larger volumes, split the operation into multiple requests.
func (*Shipments) Documents ¶
func (s *Shipments) Documents(ctx context.Context, id string, type_ operations.DocumentType, opts ...operations.Option) (*operations.GetDocumentsResponse, error)
Documents - Retrieve documents related to a shipment Download documents related to a shipment by its `id`. Pass the unique shipment `id` (returned when the shipment was created) as a parameter. The second parameter is the document type to download. Supported document types include: dispatch certificate, envelope template, and EPO (in PDF or XML formats).
func (*Shipments) Price ¶
func (s *Shipments) Price(ctx context.Context, request components.Shipment, opts ...operations.Option) (*operations.ShipmentPriceResponse, error)
Price - Check the shipment price Check the price of a shipment for one or multiple recipients. Provide a `Shipment` object in the request. Each object includes properties such as recipient details, included documents, and optional settings. Some fields are required.
The system accepts up to **50** recipients per call. For larger volumes, split the operation into multiple requests.
func (*Shipments) Status ¶
func (s *Shipments) Status(ctx context.Context, ids []string, opts ...operations.Option) (*operations.GetStatusResponse, error)
Status - Retrieve shipment details with status events Retrieve the current status and details for one or more shipments by their `ids`. Pass the unique shipment IDs (returned when the shipments were created) as a path parameter. To query provide a list (up to **50** IDs per call). For larger batches, split the requests.