sweap

package module
v0.0.0-...-f6e438c Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 15 Imported by: 0

README

Sweap API in Go

This is a community-maintained implementation for the Sweap REST API in Golang

This library supports most if not all of the api.sweap.io REST calls.

Project Status

There is currently no major version released. Therefore, minor version releases may include backward incompatible changes.

See CHANGELOG.md or Releases for more information about the changes.

Original Documentation

The official documentation of the REST API can be found at https://documenter.getpostman.com/view/5746225/UVBzmp2n#defe4351-fb75-4d87-a73f-b9e8f0d843c2

Postman Collection

In addition to this golang we maintain a Postman collection for interacting with the REST API with Postman https://www.postman.com/getsweap

Documentation

Overview

Copyright (c) 2022 Theofanis Vassiliou-Gioles

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	NEWGUEST    = "NEW_GUEST"
	UPDATEGUEST = "UPDATE_GUEST"
)
View Source
const (
	// Official endpoints for normal users
	// APIURL   = "https://api.sweap.io/core/v1/"
	APIURL   = "https://api.sweap.io/core/v1/"
	TOKENURL = "https://auth.sweap.io/realms/users/protocol/openid-connect/token"

	// Inofficial endpoints to the staging or dev area.
	// Normal API users won't need this.
	// For special development purposes, only
	APIURL_ST   = "https://api.sweap.st/core/v1/"
	TOKENURL_ST = "https://auth.sweap.st/realms/users/protocol/openid-connect/token"

	APIURL_DEV   = "https://api.sweap.dev/core/v1/"
	TOKENURL_DEV = "https://auth.sweap.dev/realms/users/protocol/openid-connect/token"
)

Variables

This section is empty.

Functions

func NewGuestIterator

func NewGuestIterator(guests []Guest) func() *Guest

NewGuestIterator creates a new iterator function that iterates over a slice of guests. It takes a slice of Guest objects as input. The returned iterator function can be called repeatedly to retrieve the next Guest from the slice. If all guests have been iterated over, the iterator function returns nil.

func OptionAPIURL

func OptionAPIURL(u string) func(*Client)

OptionAPIURL set the url for the client. only useful for testing.

func OptionClientCredentials

func OptionClientCredentials(id, secret string) func(*Client)

OptionClientCredentials sets an app-level token for the client.

func OptionDebug

func OptionDebug(b bool) func(*Client)

OptionDebug enable debugging for the client

func OptionEnvFile

func OptionEnvFile(fileName string) func(*Client)

OptionEnvFile uses an env file for reading the credentials

func OptionLog

func OptionLog(l logger) func(*Client)

OptionLog set logging for client.

func OptionTOKENURL

func OptionTOKENURL(u string) func(*Client)

OptionTOKENURL set the url for the client. only useful for testing.

func OptionUseDevEnv

func OptionUseDevEnv() func(*Client)

OptionUseDevEnv selects the dev environment for the client.

func OptionUseStagingEnv

func OptionUseStagingEnv() func(*Client)

OptionUseStagingEnv selects the staging environment for the client.

Types

type AttendanceMode

type AttendanceMode string
const (
	OFFLINE AttendanceMode = "OFFLINE"
	ONLINE  AttendanceMode = "ONLINE"
	MIXED   AttendanceMode = "MIXED"
)

type AttendanceState

type AttendanceState string
const (
	NONEATTENDANCE AttendanceState = "NONE"
	PRESENT        AttendanceState = "PRESENT"
	GONE           AttendanceState = "GONE"
)

type AuthTestResponse

type AuthTestResponse struct {
	URL string `json:"url"`
}

AuthTestResponse ...

type Categories

type Categories []Category

type Category

type Category struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	ColorHex  string `json:"colorHex"`
	SortIndex int    `json:"sortIndex"`
	EventID   string `json:"eventId"`
}

type CategorySearchParameter

type CategorySearchParameter struct {
	GuestId      string     // optional, filters equal guest id
	Name         string     // optional, filters equal case insensitive category name
	ExternalID   string     // optional, filters equal guest externalId
	CreatedAfter *time.Time // optional, filters greater than guest createdAt: ISO 8601 timestamp
	UpdatedAfter *time.Time // optional, filters greater than guest updatedAt: ISO 8601 timestamp
}

func NewCategorySearchParameter

func NewCategorySearchParameter() CategorySearchParameter

type Client

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

Client for the Sweap API

func New

func New(clientId, clientSecret string, options ...SweapOptions) (*Client, error)

NewSweap creates a new Sweap object with given credentials if authentication fails error will be non-nil

func (*Client) BulkImportFinishUpload

func (api *Client) BulkImportFinishUpload(gibID string) error

func (*Client) BulkImportInOneGo

func (api *Client) BulkImportInOneGo(gbi GuestBulkImport) (*GuestBulkImport, error)

Create Bulk Import Object creates a guest bulk object. POST /guest-bulk-imports

func (*Client) BulkImportInOneGoContext

func (api *Client) BulkImportInOneGoContext(ctx context.Context, gbi GuestBulkImport) (*GuestBulkImport, error)

CreateGuestBulkImportObjectContext creates a GBI in an event and returns a GBI containing it's unigue ID with custom context

func (*Client) BulkImportStateContext

func (api *Client) BulkImportStateContext(ctx context.Context, gibID string) error

func (*Client) BulkImportUpdateBatch

func (api *Client) BulkImportUpdateBatch(gibID string, guests Guests) error

FIXME: Need documentation

func (*Client) BulkImportUpdateBatchContext

func (api *Client) BulkImportUpdateBatchContext(ctx context.Context, gibID string, guests Guests) error

FIXME: BulkImportUpdateBatchContext will update the guest with the given guestId with a custom context

func (*Client) CheckCredentials

func (api *Client) CheckCredentials() (bool, error)

CheckCredentials will check wether valid credentials have been used GET /events/{ID}

func (*Client) CheckCredentialsContext

func (api *Client) CheckCredentialsContext(ctx context.Context) (bool, error)

GetEventsContext will retrieve the complete list of events with a custom context

func (*Client) CreateGuest

func (api *Client) CreateGuest(g Guest) (*Guest, error)

CreateGuest creates a Guest in an event and returns a Guest containing it's unigue ID

func (*Client) CreateGuestBulkImportObject

func (api *Client) CreateGuestBulkImportObject(gbi GuestBulkImport) (*GuestBulkImport, error)

Create Bulk Import Object creates a guest bulk object. POST /guest-bulk-imports

func (*Client) CreateGuestBulkImportObjectContext

func (api *Client) CreateGuestBulkImportObjectContext(ctx context.Context, gbi GuestBulkImport) (*GuestBulkImport, error)

CreateGuestBulkImportObjectContext creates a GBI in an event and returns a GBI containing it's unigue ID with custom context

func (*Client) CreateGuestContext

func (api *Client) CreateGuestContext(ctx context.Context, g Guest) (*Guest, error)

CreateGuestContext creates the provided Guest (with a given eventID) and returns a Guest containing it's unigue ID with custom context It takes a context.Context object.

func (*Client) Debug

func (api *Client) Debug() bool

Debug returns if debug is enabled.

func (*Client) Debugf

func (api *Client) Debugf(format string, v ...interface{})

----- Logging ------ Debugf print a formatted debug line.

func (*Client) Debugln

func (api *Client) Debugln(v ...interface{})

Debugln print a debug line.

func (*Client) DeleteGuest

func (api *Client) DeleteGuest(guestId string) error

DeleteGuest will delete the guest with the given guestId. If guest is not found error will be returned

func (*Client) DeleteGuestBulkImportObject

func (api *Client) DeleteGuestBulkImportObject(gbiId string) error

DeleteGuestBulkImportObject will delete the gbi with the given Id. If guest is not found error will be returned

func (*Client) DeleteGuestBulkImportObjectContext

func (api *Client) DeleteGuestBulkImportObjectContext(ctx context.Context, gbiId string) error

DeleteGuest will delete the guest with the given guestId wiht a custom context. If guest is not found error will be returned

func (*Client) DeleteGuestContext

func (api *Client) DeleteGuestContext(ctx context.Context, guestId string) error

DeleteGuest will delete the guest with the given guestId wiht a custom context. If guest is not found error will be returned

func (*Client) GetAllBulkImports

func (api *Client) GetAllBulkImports(s ...GuestBulkImportSearchParameter) (*GuestBulkImports, error)

GetAllBulkImports lists all bulk import objects started or completed. GET /guest-bulk-imports?[PARAMS]

func (*Client) GetAllBulkImportsContext

func (api *Client) GetAllBulkImportsContext(ctx context.Context, params GuestBulkImportSearchParameter) (*GuestBulkImports, error)

func (*Client) GetCategories

func (api *Client) GetCategories(eventId string) (*Categories, error)

GetCategories will retrieve the complete list of guest categories for a given eventId

func (*Client) GetCategoriesContext

func (api *Client) GetCategoriesContext(ctx context.Context, eventId string, params CategorySearchParameter) (*Categories, error)

GetCategories will retrieve the complete list of guest categories for a given eventId with a custom context

func (*Client) GetCategoryById

func (api *Client) GetCategoryById(categoryId string) (*Category, error)

GetCategoryById will retrieve the guest with the given guestId

func (*Client) GetCategoryByIdContext

func (api *Client) GetCategoryByIdContext(ctx context.Context, categoryId string) (*Category, error)

GetGuestByIdContext will retrieve the guest with the given guestId with a custom context

func (*Client) GetEventById

func (api *Client) GetEventById(id string) (*Event, error)

GetEvents will retrieve the event with the given ID GET /events/{ID}

func (*Client) GetEventByIdContext

func (api *Client) GetEventByIdContext(ctx context.Context, id string) (*Event, error)

GetEventsContext will retrieve the complete list of events with a custom context

func (*Client) GetEventStatistics

func (api *Client) GetEventStatistics() (*EventStatistics, error)

GetEventStatistics returns all events statistics under your account.

func (*Client) GetEventStatisticsByID

func (api *Client) GetEventStatisticsByID(id string) (*EventStatistic, error)

GetEventStatisticsByID will retrieve the statistic for an event with a given ID

func (*Client) GetEventStatisticsByIDContext

func (api *Client) GetEventStatisticsByIDContext(ctx context.Context, eventID string) (*EventStatistic, error)

GetEventStatisticsByIDContext retrieves the statistics for an event with the given ID using a custom context. It takes a context.Context object and an event ID as input. If successful, it returns a pointer to the EventStatistic and nil error. If an error occurs during the request, it returns nil and the specific error encountered. The function can be called on a Client object.

func (*Client) GetEventStatisticsContext

func (api *Client) GetEventStatisticsContext(ctx context.Context, params EventStatisticsSearchParameter) (*EventStatistics, error)

GetEventStatisticsContext returns all event statistics under your account based on the provided search parameters. It takes a context.Context object and an EventStatisticsSearchParameter object as input. If successful, it returns a pointer to EventStatistics and nil error. If an error occurs during the request, it returns nil and the specific error encountered. The function can be called on a Client object.

func (*Client) GetEvents

func (api *Client) GetEvents() (*Events, error)

GetEvents will retrieve the complete list of events GET /events?[PARAMS]

func (*Client) GetEventsContext

func (api *Client) GetEventsContext(ctx context.Context, params EventSearchParameter) (*Events, error)

GetEventsContext will retrieve the complete list of events with a custom context

func (*Client) GetGuestById

func (api *Client) GetGuestById(guestId string) (*Guest, error)

GetGuestById will retrieve the guest with the given guestId

func (*Client) GetGuestByIdContext

func (api *Client) GetGuestByIdContext(ctx context.Context, guestID string) (*Guest, error)

GetGuestByIdContext retrieves the guest with the given guest ID using a custom context. It takes a context.Context object and a guest ID as input. If successful, it returns a pointer to the Guest and nil error. If an error occurs during the request, it returns nil and an error. The function can be called on a Client object.

func (*Client) GetGuests

func (api *Client) GetGuests(eventId string) (*Guests, error)

GetGuests will retrieve the complete list of guests for a given event You can only get guests for a specific event, so you need to pass the event id via query parameter eventId. The guests are not further filtered. For more fine granular control use #GetGuestsContext

func (*Client) GetGuestsContext

func (api *Client) GetGuestsContext(ctx context.Context, eventId string, params GuestSearchParameter) (*Guests, error)

GetGuestsContext retrieves the complete list of guests for a given event with a custom context. It takes a context.Context object, an event ID, and GuestSearchParameter as input. If successful, it returns a pointer to Guests and nil error. If either the event ID or GuestSearchParameter is not provided, it returns nil and an error. The function can be called on a Client object.

func (*Client) GetGuestsPaginated

func (api *Client) GetGuestsPaginated(eventId string, pp PaginationParameter) (GuestPages, error)

GetGuestsPaginated will retrieve the complete list of guests for a given event You can only get guests for a specific event, so you need to pass the event id via query parameter eventId. The guests are not further filtered. For more fine granular control use #GetGuestsContext

func (*Client) GetGuestsPaginatedContext

func (api *Client) GetGuestsPaginatedContext(ctx context.Context, eventId string, pages PaginationParameter, params GuestSearchParameter) (GuestPages, error)

GetGuestsPaginatedContext retrieves the paginated list of guests for a given event with a custom context. It takes a context.Context object, page and size for pagination, an event ID, and GuestSearchParameter as input. If successful, it returns a pointer to Guests and nil error. If either the event ID or GuestSearchParameter is not provided, it returns nil and an error. If size The function can be called on a Client object.

func (*Client) GetSpecificBulkImport

func (api *Client) GetSpecificBulkImport(gbiId string) (*GuestBulkImport, error)

func (*Client) GetSpecificBulkImportContext

func (api *Client) GetSpecificBulkImportContext(ctx context.Context, gbiId string) (*GuestBulkImport, error)

func (*Client) GetSpecificBulkImportState

func (api *Client) GetSpecificBulkImportState(gbiId string) (*GuestBulkImportState, error)

func (*Client) GetSpecificBulkImportStateContext

func (api *Client) GetSpecificBulkImportStateContext(ctx context.Context, gbiId string) (*GuestBulkImportState, error)

func (*Client) Listen

func (api *Client) Listen() (chan *GuestUpdate, error)

Listen listens to guest changes (new, updates). It returns a channel of GuestUpdate objects and an error. The channel can be used to receive updates on new or updated guests. If an error occurs during the setup, it returns nil channel and the specific error encountered. The function can be called on a Client object.

func (*Client) SearchEventStatistics

func (api *Client) SearchEventStatistics(params EventStatisticsSearchParameter) (*EventStatistics, error)

SearchEventStatistics will retrieve a list of statistics for events filtered by EventStatisticsSearchParameter

func (*Client) SearchEvents

func (api *Client) SearchEvents(params EventSearchParameter) (*Events, error)

SearchEvents will retrieve a list of events filtered by EventSearchParameter

func (*Client) SearchGuests

func (api *Client) SearchGuests(id string, params GuestSearchParameter) (*Guests, error)

SearchGuests will retrieve the complete list of Guests matching the search criteria

func (*Client) UpdateGuest

func (api *Client) UpdateGuest(guest Guest) (*Guest, error)

UpdateGuest updates the guest with the given guest ID. It takes a Guest object as input. If successful, it returns a pointer to the updated Guest and nil error. If an error occurs during the update, it returns nil and the specific error encountered. The function can be called on a Client object.

func (*Client) UpdateGuestContext

func (api *Client) UpdateGuestContext(ctx context.Context, g Guest) (*Guest, error)

UpdateGuestContext updates the guest with the given guest ID using a custom context. It takes a context.Context object and a Guest object as input. If successful, it returns a pointer to the updated Guest and nil error. If the Guest is missing the EventID or ID, it returns a SweapLibraryError with the appropriate error message. If an error occurs during the update, it returns nil and the specific error encountered. The function can be called on a Client object.

type CustomFieldDefinitions

type CustomFieldDefinitions struct {
	ID        string      `json:"id"`
	Name      string      `json:"name"`
	Type      string      `json:"type"`
	SortIndex int         `json:"sortIndex"`
	GroupName interface{} `json:"groupName"`
	Options   interface{} `json:"options"`
}

type CustomFields

type CustomFields map[string]string

type Debug

type Debug interface {
	Debug() bool

	// Debugf print a formatted debug line.
	Debugf(format string, v ...interface{})
	// Debugln print a debug line.
	Debugln(v ...interface{})
}

type Error

type Error struct {
	Error   string
	Code    int
	Message string
}

type Event

type Event struct {
	// Common fields
	ID         string      `json:"id"`
	Version    int         `json:"version"`
	UpdatedAt  *time.Time  `json:"updatedAt"`
	CreatedAt  *time.Time  `json:"createdAt"`
	ExternalID interface{} `json:"externalId"`
	// Specific fields
	Name                   string                   `json:"name"`
	StartDate              time.Time                `json:"startDate"`
	EndDate                time.Time                `json:"endDate"`
	ZoneId                 string                   `json:"zoneId"`
	AttendanceMode         AttendanceMode           `json:"attendanceMode"`
	State                  string                   `json:"state"`
	CustomFieldDefinitions []CustomFieldDefinitions `json:"customFieldDefinitions"`
}

func (Event) String

func (e Event) String() string

type EventPages

type EventPages struct {
	Status   string `json:"status"`
	Content  Events `json:"content"`
	Error    Error  `json:"error"`
	Pageable struct {
		Size          int `json:"size"`
		TotalElements int `json:"totalElements"`
		TotalPages    int `json:"totalPages"`
		Page          int `json:"page"`
	} `json:"pageable"`
}

type EventSearchParameter

type EventSearchParameter struct {
	Id             string     // optional, filters equal event id
	Name           string     // optional, filters equal case insensitive event name
	NameContains   string     // optional, filters equal case insensitive event name
	State          EventState // optional, one of DRAFT, ACTIVE, CLOSED
	StartDateAfter *time.Time // optional, filters greater than event startDate: ISO 8601 timestamp
	EndDateAfter   *time.Time // optional, filters greater than event startDate: ISO 8601 timestamp
	ExternalID     string     // optional, filters equal event externalId
	CreatedAfter   *time.Time // optional, filters greater than event createdAt: ISO 8601 timestamp
	UpdatedAfter   *time.Time // optional, filters greater than event updatedAt: ISO 8601 timestamp
}

func NewEventSearchParameters

func NewEventSearchParameters() EventSearchParameter

type EventState

type EventState string
const (
	DRAFT  EventState = "DRAFT"
	ACTIVE EventState = "ACTIVE"
	CLOSED EventState = "CLOSED"
)

type EventStatistic

type EventStatistic struct {
	// Common fields
	ID         string      `json:"id"`
	Version    int         `json:"version"`
	UpdatedAt  time.Time   `json:"updatedAt"`
	CreatedAt  time.Time   `json:"createdAt"`
	ExternalID interface{} `json:"externalId"`
	// Specific fields
	GuestCount     int `json:"guestCount"`    // Guests overall count (incl. companions)
	AcceptedCount  int `json:"acceptedCount"` // Accepted guest count (incl. companions)
	DeclindedCount int `json:"declinedCount"` // Declined guest count (incl. companions)
	NoReplyCount   int `json:"noReplyCount"`  // No Reply guest count (incl. companions)
	CheckinCount   int `json:"checkinCount"`  // Check-in count (incl. companions)

}

type EventStatistics

type EventStatistics []EventStatistic

type EventStatisticsSearchParameter

type EventStatisticsSearchParameter struct {
	Id           string     // optional, filters equal event id
	ExternalID   string     // optional, filters equal event externalId
	CreatedAfter *time.Time // optional, filters greater than event createdAt: ISO 8601 timestamp
	UpdatedAfter *time.Time // optional, filters greater than event updatedAt: ISO 8601 timestamp

	MinGuestCount    int // optional, filters guestCount equal or greater than minGuestCount value
	MaxGuestCount    int // optional, filters guestCount equal or lesser than maxGuestCount value
	MinAcceptedCount int // optional, filters acceptedCount equal or greater than minAcceptedCount value
	MaxAcceptedCount int // optional, filters acceptedCount equal or lesser than maxAcceptedCount value
	MinDeclinedCount int // optional, filters declinedCount equal or greater than minDeclinedCount value
	MaxDeclinedCount int // optional, filters declinedCount equal or lesser than maxDeclinedCount value
	MinNoReplyCount  int // optional, filters noReplyCount equal or greater than minNoReplyCount value
	MaxNoReplyCount  int // optional, filters noReplyCount equal or lesser than maxNoReplyCount value
	MinCheckinCount  int // optional, filters checkinCount equal or greater than minCheckinCount value
	MaxCheckinCount  int // optional, filters checkinCount equal or lesser than maxCheckinCount value
}

func NewEventStatisticsSearchParameter

func NewEventStatisticsSearchParameter() EventStatisticsSearchParameter

type Events

type Events []Event

type Guest

type Guest struct {
	// Common fields
	ID         string      `json:"id"`
	Version    int         `json:"version"`
	UpdatedAt  *time.Time  `json:"updatedAt,omitempty"`
	CreatedAt  *time.Time  `json:"createdAt,omitempty"`
	ExternalID interface{} `json:"externalId"`
	// Specific fields
	EventID         string          `json:"eventId"`
	FirstName       string          `json:"firstName"`
	LastName        string          `json:"lastName"`
	EntourageCount  int             `json:"entourageCount,omitempty"`
	Comment         interface{}     `json:"comment,omitempty"`
	Email           string          `json:"email,omitempty"`
	CustomFields    CustomFields    `json:"customFields,omitempty"`
	InvitationID    string          `json:"invitationId,omitempty"`
	InvitationState InvitationState `json:"invitationState"`
	TicketID        string          `json:"ticketId,omitempty"`
	ParentGuestID   string          `json:"parentGuestId"`
	CategoryID      string          `json:"categoryId"`
	AttendanceState AttendanceState `json:"attendanceState"`
}

type GuestBulkImport

type GuestBulkImport struct {
	// Common
	ID         string      `json:"id"`
	Version    int         `json:"version"`
	UpdatedAt  *time.Time  `json:"updatedAt"`
	CreatedAt  *time.Time  `json:"createdAt"`
	ExternalID interface{} `json:"externalId"`

	// Specific
	Name                   string                   `json:"name"`
	State                  *GuestBulkImportStatus   `json:"state"`
	Guests                 *Guests                  `json:"guests"`
	EventId                string                   `json:"eventId"`
	CustomFieldDefinitions []CustomFieldDefinitions `json:"customFieldDefinitions"`
}

type GuestBulkImportSearchParameter

type GuestBulkImportSearchParameter struct {
	GuestBulkImportId string                // optional, filters equal guest-bulk-import id
	EventId           string                // optional, filters equal event id
	State             GuestBulkImportStatus // optional, filters equal guest-bulk-import state: UPLOAD_STARTED, UPLOAD_FINISHED, IMPORT_STARTED, IMPORT_FINISHED
	ExternalID        string                // optional, filters equal guest-bulk-import externalId
	CreatedAfter      *time.Time            // optional, filters greater than guest-bulk-import createdAt: ISO 8601 timestamp
	UpdatedAfter      *time.Time            // optional, filters greater than guest-bulk-import updatedAt: ISO 8601 timestamp
}

func NewGuestBulkImportSearchParameter

func NewGuestBulkImportSearchParameter() GuestBulkImportSearchParameter

type GuestBulkImportState

type GuestBulkImportState struct {
	ID    string                `json:"id"`
	State GuestBulkImportStatus `json:"state"`
}

type GuestBulkImportStatus

type GuestBulkImportStatus string
const (
	UPLOADSTARTED  GuestBulkImportStatus = "UPLOAD_STARTED"
	UPLOADFINISHED GuestBulkImportStatus = "UPLOAD_FINISHED"
	IMPORTSTARTED  GuestBulkImportStatus = "IMPORT_STARTED"
	IMPORTFINISHED GuestBulkImportStatus = "IMPORT_FINISHED"
)

type GuestBulkImports

type GuestBulkImports []GuestBulkImport

type GuestPages

type GuestPages struct {
	Status   string `json:"status"`
	Content  Guests `json:"content"`
	Error    Error  `json:"error"`
	Pageable struct {
		Size          int `json:"size"`
		TotalElements int `json:"totalElements"`
		TotalPages    int `json:"totalPages"`
		Page          int `json:"page"`
	} `json:"pageable"`
}

type GuestSearchParameter

type GuestSearchParameter struct {
	Id                string          // optional, filters equal guest id, result will list of 0 or 1 guest, conditionally required if eventId or invitationId are empty
	FirstName         string          // optional, filters equal case insensitive guest firstName
	FirstNameContains string          // optional, filters contains case insensitive guest firstName
	LastName          string          // optional, filters equal case insensitive guest lastName
	LastNameContains  string          // optional, filters contains case insensitive guest lastName
	Email             string          // optional, filters equal case insensitive guest email
	InvitationState   InvitationState // optional, filters equal guest invitationState: NONE, NO_REPLY, ACCEPTED or DECLINED
	ExternalID        string          // optional, filters equal guest externalId
	CreatedAfter      *time.Time      // optional, filters greater than guest createdAt: ISO 8601 timestamp
	UpdatedAfter      *time.Time      // optional, filters greater than guest updatedAt: ISO 8601 timestamp
	InvitationId      string          // optional, filters equal guest invitationId, result will list of 0 or 1 guest, conditionally required if event_id or id are empty
	TicketID          string          // optinal, filters equal guest ticketId
}

func NewGuestSearchParameters

func NewGuestSearchParameters() GuestSearchParameter

type GuestUpdate

type GuestUpdate struct {
	EventType string
	Value     interface{}
}

GuestUpdate carries all update events for guest, let it be new guests, or updated guests

type Guests

type Guests []Guest

type InvitationState

type InvitationState string
const (
	NONE     InvitationState = "NONE"
	NO_REPLY InvitationState = "NO_REPLY"
	ACCEPTED InvitationState = "ACCEPTED"
	DECLINED InvitationState = "DECLINED"
)

type ListenOptions

type ListenOptions func(*Client)

type PaginationParameter

type PaginationParameter struct {
	Size int // optional, size of a page, if <=0 default of 100 is assumed
	Page int // optional, which page should be selected, if <0 default of 0 is assumed
}

func NewPaginationParamter

func NewPaginationParamter() PaginationParameter

type ResponseMetadata

type ResponseMetadata struct {
	Cursor   string   `json:"next_cursor"`
	Messages []string `json:"messages"`
	Warnings []string `json:"warnings"`
}

ResponseMetadata holds pagination metadata

type SortBy

type SortBy string
const (
	CREATED_AT SortBy = "createdAt"
	UPDATED_AT SortBy = "updatedAt"
	START_DATE SortBy = "startDate"
	END_DATE   SortBy = "endDate"
	NAME       SortBy = "name"
)

type SortOrder

type SortOrder string
const (
	ASC  SortOrder = "ASC"
	DESC SortOrder = "DESC"
)

type Status

type Status string
const (
	OK                   Status = "OK"
	BAD_REQUEST          Status = "BAD_REQUEST"
	UNAUTHORIZED         Status = "UNAUTHORIZED"
	VALIDATION_EXCEPTION Status = "VALIDATION_EXCEPTION"
	EXCEPTION            Status = "EXCEPTION"
	WRONG_CREDENTIALS    Status = "WRONG_CREDENTIALS"
	ACCESS_DENIED        Status = "ACCESS_DENIED"
	NOT_FOUND            Status = "NOT_FOUND"
	DUPLICATE_ENTITY     Status = "DUPLICATE_ENTITY"
)

type StatusCodeError

type StatusCodeError struct {
	Code   int
	Status string
}

StatusCodeError represents an http response error. type httpStatusCode interface { HTTPStatusCode() int } to handle it.

func (StatusCodeError) Error

func (t StatusCodeError) Error() string

func (StatusCodeError) HTTPStatusCode

func (t StatusCodeError) HTTPStatusCode() int

func (StatusCodeError) Retryable

func (t StatusCodeError) Retryable() bool

type SweapError

type SweapError struct {
	Error_  string `json:"error"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*SweapError) Error

func (se *SweapError) Error() string

type SweapLibraryError

type SweapLibraryError struct {
	Message string
}

SweapLibraryError represents an internal library error

func (SweapLibraryError) Error

func (se SweapLibraryError) Error() string

type SweapOptions

type SweapOptions func(*Client)

----- Options -------

type SweapResponse

type SweapResponse struct {
	Ok               bool             `json:"ok,omitempty"`
	Error            SweapError       `json:"error,omitempty"`
	ResponseMetadata ResponseMetadata `json:"response_metadata,omitempty"`
}

SweapResponse handles parsing out errors from the web api

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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