UNPKG

bam-ticketing-sdk

Version:

SDK for B.A.M Ticketing API

503 lines 24 kB
import { AxiosInstance } from 'axios'; import { HealthStatus, IdParam, ListInfo, QRCodePayload, StringIdParam } from '../common/types'; import { BlockchainFunctionParams } from '../blockchain/types'; import { TicketConfigId, Event, OrganizerSpecificId, NewEvent, OrganizerName, UpdatableEvent, TicketConfig, ListEventsQuery, SingleEventQuery, MyEventsQuery, PublicKey, TicketCount, QrCodeTicketConfig, CreateNftDrop, NftDrop, NftDropQuery, SingleNftDropQuery, UpdateNftDrop, NftDropFilterId, ListOrganizerEventsQuery, ListOrganizerEventTicketConfigsQuery, SingleOrganizerEventQuery, TicketDiscount, CreateTicketDiscount, UpdateTicketDiscount, SingleTicketDiscountQuery, CreateDiscountBatch, ListTicketDiscountQuery, TicketDiscountIdParam, CreatePromoSection, PromoSectionId, UpdatePromoSection, PromoSection, PrivateEventQuery, CreateTicketConfig, Sector, CreateSector, UpdateSector, SectorId, SingleSectorQuery, ListSectorQuery, Timeslot, CreateTimeslot, TimeslotId, UpdateTimeslot, SingleTimeslotQuery, ListTimeslotsQuery, ListInformationEmailQuery, InformationEmail, SingleInformationEmailQuery, CreateInformationEmail, UpdateInformationEmail, InformationEmailId, TicketFormat, Category, ListCategoryQuery, EventHolderList, ListQuestionnaireQuery, Questionnaire, CreateQuestionnaire, QuestionnaireQuery, UpdateQuestionnaire, ListQuestionQuery, Question, CreateQuestion, SendTicketsData, SendTicketsResponse } from './types'; /** * Service class for event API calls. Requires an organizer to be set (call to `useOrganizer`) */ export declare class EventService { readonly client: AxiosInstance; readonly version: string; constructor(client: AxiosInstance, version: string); /** * Returns true if the service is reachable * * @returns Services' online status */ health(): Promise<HealthStatus>; /** * Creates a new event. Subobjects except for the subcategory can be added later. * `endAt` needs to be after `startAt` and both need to be in the future. * After an event is created, it needs to be published to be available for purchase. * To publish an event, it needs to have at least one ticket configuration. * * @returns new Event */ createEvent(name: OrganizerName, newEvent: NewEvent): Promise<Event>; /** * Updates existing event. * @param id Org ID and event ID of the event you want to update * @param updatedEventFields Fields on the event to be updated * @returns new Event */ updateEvent(id: OrganizerSpecificId, updatedEventFields: UpdatableEvent): Promise<Event>; /** * Deletes existing event. * @param id Org ID and event ID of the event you want to delete */ deleteEvent(id: OrganizerSpecificId): Promise<any>; /** * Cancels existing event. * @param id Org ID and event ID of the event you want to cancel */ cancelEvent(id: OrganizerSpecificId): Promise<any>; /** * @param id Org ID and event ID of the event you want to publish * @returns Publish event payload */ getEventPublishingPayload(id: OrganizerSpecificId): Promise<BlockchainFunctionParams>; /** * Returns payload when creating an event on the blockchain. * * @param id Org ID and event ID of the event you want to publish * @returns payload to be when creating it on the blockchain */ getEventPublishPayload(id: OrganizerSpecificId): Promise<Event>; /** * Returns QR Code payload when creating an event on the blockchain. * * @param id Org ID and event ID of the event you want to publish * @returns QR Code payload */ getEventPublishQRCodePayload(id: OrganizerSpecificId): Promise<QRCodePayload>; /** * Returns payload when updating an event on the blockchain. * * @param id Org ID and event ID of the event you want to publish * @returns payload when updating an even on the blockchain */ getEventUpdatePayload(id: OrganizerSpecificId): Promise<Event>; /** * Returns QR Code payload when updating an event on the blockchain. * * @param id Org ID and event ID of the event you want to publish * @returns QR Code payload */ getEventUpdateQRCodePayload(id: OrganizerSpecificId): Promise<QRCodePayload>; /** * Returns the public key for ticket signature validation * * @param id Org ID and event ID of the tickets * @returns Public key for signature validation */ getTicketSigningKey(id: OrganizerSpecificId): Promise<PublicKey>; /** * Returns an event by its ID. * * @param req ID and additional query params * @returns Event object */ getEvent(req: SingleEventQuery): Promise<Event>; /** * Returns an unpublished event by its ID. * * @param req ID and access_token of the event and additional query params * @returns Event object */ getPrivateEvent(req: PrivateEventQuery): Promise<Event>; /** * Returns a list of active events. * * @param req.q String value for text-based search on event * @param req.start_at Date range where the event start_at field is filtered * @param req.include_occurrences If true, in case of recurring events it includes occurrences * @param req.with Field selector query attribute * @returns */ listEvents(req?: ListEventsQuery): Promise<ListInfo<Event>>; listOrganizerEvents(id: OrganizerName, req?: ListOrganizerEventsQuery): Promise<ListInfo<Event>>; getOrganizerEvent(id: OrganizerSpecificId, req?: SingleOrganizerEventQuery): Promise<Event>; listOrganizerEventTicketConfigs(id: OrganizerSpecificId, req?: ListOrganizerEventTicketConfigsQuery): Promise<ListInfo<TicketConfig>>; /** * Returns a ticket configuration. * * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config * @returns */ getTicketConfig(id: TicketConfigId): Promise<TicketConfig>; /** * Returns newly created ticket configuration. * * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.id ID of the event to which the ticket config belongs to * @param ticketConfig data based on which ticket config should be created * @returns new ticket config */ createTicketConfig(id: OrganizerSpecificId, ticketConfig: CreateTicketConfig): Promise<TicketConfig>; /** * Returns updated ticket configuration. * * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config to be updated * @param ticketConfig data based on which ticket config should be updated * @returns new ticket config */ updateTicketConfig(id: TicketConfigId, ticketConfig: Partial<CreateTicketConfig>): Promise<TicketConfig>; /** * Deletes ticket config. * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config to be deleted */ deleteTicketConfig(id: TicketConfigId): Promise<void>; /** * Returns payload when publishing a ticket config on the blockchain. * * @param id Org ID, event ID and ID of the ticket config you want to publish * @returns payload when publishing a ticket config on the blockchain. */ getTicketConfigPublishPayload(id: TicketConfigId): Promise<TicketConfig>; /** * Returns QR Code payload when publishing a ticket config on the blockchain. * * @param id Org ID, event ID and ID of the ticket config you want to publish * @returns QR Code payload */ getTicketConfigPublishQRCodePayload(id: TicketConfigId): Promise<QRCodePayload>; /** * Returns payload when updating a ticket config on the blockchain. * * @param id Org ID, event ID and ID of the ticket config you want to update * @returns payload when updating a ticket config on the blockchain. */ getTicketConfigUpdatePayload(id: TicketConfigId): Promise<TicketConfig>; /** * Returns QR Code payload when updating a ticket config on the blockchain. * * @param id Org ID, event ID and ID of the ticket config you want to update * @returns QR Code payload */ getTicketConfigUpdateQRCodePayload(id: TicketConfigId): Promise<QRCodePayload>; /** * Returns events with secure tickets for the authorized enrolled user. * * @param req.date Filter events by `end_at` date comparing with `midnight`. Expected values are `future`, `past` and `all`. * @returns */ getMyEvents(req: MyEventsQuery): Promise<any>; /** * Returns ticket counts for a given event (one entry per ticket-configuration) * * @param req * @returns */ getTicketCount(req: SingleEventQuery): Promise<TicketCount[]>; /** * Returns all qr-codes (for unused tickets) for a given event * * @param req * @returns */ getQrCodes(req: SingleEventQuery): Promise<QrCodeTicketConfig[]>; createNftDrop(nftDrop: CreateNftDrop): Promise<NftDrop>; updateNftDrop(nftDrop: UpdateNftDrop): Promise<NftDrop>; sendNftDrop(id: OrganizerSpecificId): Promise<void>; deleteNftDrop(id: OrganizerSpecificId): Promise<void>; deleteNftDropFilter(id: NftDropFilterId): Promise<void>; /** * Returns a specific NFT collection with the given relations */ getNftDrop(id: OrganizerSpecificId, req?: SingleNftDropQuery): Promise<NftDrop>; listNftDrops(id: OrganizerName, req?: NftDropQuery): Promise<ListInfo<NftDrop>>; /** * Creates a ticket discount. * @param id.organizerId Name of the organizer to whom the ticket discount belongs to * @param id.eventId ID of the event to which the ticket discount belongs to * @returns new TicketDiscount */ createTicketDiscount(id: OrganizerSpecificId, ticketDiscount: CreateTicketDiscount): Promise<TicketDiscount>; /** * Updates ticket discount. * @param id.organizerId Name of the organizer to whom the ticket discount belongs to * @param id.eventId ID of the event to which the ticket discount belongs to * @param id.id ID of the ticket discount to update * @returns updated ticket discount */ updateTicketDiscount(id: TicketDiscountIdParam, ticketDiscount: UpdateTicketDiscount): Promise<TicketDiscount>; /** * Deletes ticket discount. * @param id.organizerId Name of the organizer to whom the ticket discount belongs to * @param id.eventId ID of the event to which the ticket discount belongs to * @param id.id ID of the ticket discount to be deleted */ deleteTicketDiscount(id: TicketDiscountIdParam): Promise<void>; /** * Fetches ticket discount. * @param id.organizerId Name of the organizer to whom the ticket discount belongs to * @param id.eventId ID of the event to which the ticket discount belongs to * @param id.id ID of the ticket discount to be fetched */ getTicketDiscount(id: TicketDiscountIdParam, req?: SingleTicketDiscountQuery): Promise<TicketDiscount>; /** * Creates discounts in batches. * @param id.organizerId Name of the organizer to whom the ticket discount belongs to * @param id.eventId ID of the event to which the ticket discount belongs to * @param id.id ID of the ticket discount to be duplicated */ createDiscountBatch(id: TicketDiscountIdParam, discountBatch: CreateDiscountBatch): Promise<TicketDiscount>; listTicketDiscounts(id: OrganizerSpecificId, req?: ListTicketDiscountQuery): Promise<ListInfo<TicketDiscount>>; /** * Create a single promo section * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.TicketConfigId ID of the ticket config which the promo section should belong to * @param promoSection Created promo section * @returns The created promo section */ createPromoSection(id: TicketConfigId, promoSection: CreatePromoSection): Promise<PromoSection>; /** * Update a single promo section * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config which the promo section belongs to * @param id.id ID of the promo section * @param promoSection Updated promo section * @returns The updated promo section */ updatePromoSection(id: PromoSectionId, promoSection: UpdatePromoSection): Promise<PromoSection>; /** * Get a single promo section * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config which the promo section belongs to * @param id.id ID of the promo section * @returns Single promo section */ getPromoSection(id: PromoSectionId): Promise<PromoSection>; /** * List promo sections * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config which the promo section belongs to * @returns List of the promo sections */ listPromoSections(id: TicketConfigId): Promise<ListInfo<PromoSection>>; /** * Delete a single promo section * @param id.organizerId Name of the organizer to whom the ticket config belongs to * @param id.eventId ID of the event to which the ticket config belongs to * @param id.ticketConfigId ID of the ticket config which the promo section belongs to * @param id.id ID of the promo section */ deletePromoSection(id: PromoSectionId): Promise<void>; /** * Create a sector on an event. * @param id.id ID of the event the sector should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param sector The sector that should be created * @param sector.ticketConfig IDs of the ticket configs that should be applied to the sector */ createSector(id: OrganizerSpecificId, sector: CreateSector): Promise<Sector>; /** * Update a sector on an event. * @param id.eventId ID of the event which the sector belongs to * @param id.organizerId Name of the organizer the event is belonging to * @param id.id ID of the sector that should be updated * @param sector.ticketConfig IDs of the ticket configs that should be applied to the sector */ updateSector(id: SectorId, sector: UpdateSector): Promise<Sector>; /** * List sectors on an event * @param id.id ID of the event the sector should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param query.with Allows fetching the associated ticket configs with the sector */ listSectors(id: OrganizerSpecificId, query?: ListSectorQuery): Promise<ListInfo<Sector>>; /** * Get a sector on an event * @param id.eventId ID of the event which the sector belongs to * @param id.organizerId Name of the organizer the event is belonging to * @param id.id ID of the sector that should be fetched * @param query Allows fetching the associated ticket configs with the sector */ getSector(id: SectorId, query?: SingleSectorQuery): Promise<Sector>; /** * Delete a sector from an event * @param id.eventId ID of the event which the sector belongs to * @param id.organizerId Name of the organizer the event is belonging to * @param id.id ID of the sector that should be deleted */ deleteSector(id: SectorId): Promise<void>; /** * Create a timeslot on an event. * @param id.id ID of the event the timeslot should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param timeslot The timeslot that should be created * @param timeslot.ticketConfig IDs of the ticket configs that should be applied to the timeslot */ createTimeslot(id: OrganizerSpecificId, timeslot: CreateTimeslot): Promise<Timeslot>; /** * Update a timeslot on an event. * @param id.eventId ID of the event which the timeslot belongs to * @param id.organizerId Name of the organizer the event is belonging to * @param id.id ID of the timeslot that should be updated * @param timeslot.ticketConfig IDs of the ticket configs that should be applied to the timeslot */ updateTimeslot(id: TimeslotId, timeslot: UpdateTimeslot): Promise<Timeslot>; /** * Get a timeslot on an event * @param id.eventId ID of the event which the timeslot belongs to * @param id.organizerId Name of the organizer the event is belonging to * @param id.id ID of the timeslot that should be fetched * @param query Allows fetching the associated ticket configs with the timeslot */ getTimeslot(id: TimeslotId, query?: SingleTimeslotQuery): Promise<Timeslot>; /** * Delete a timeslot from an event * @param id.eventId ID of the event which the timeslot belongs to * @param id.organizerId Name of the organizer the event is belonging to * @param id.id ID of the timeslot that should be deleted */ deleteTimeslot(id: TimeslotId): Promise<void>; /** * List timeslots on an event * @param id.id ID of the event the timeslot should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param query.with Allows fetching the associated ticket configs with the timeslots */ listTimeslots(id: OrganizerSpecificId, query?: ListTimeslotsQuery): Promise<ListInfo<Timeslot>>; /** * List all emails in all states for an event. * @param id.id ID of the event the emails should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param query.with Allows fetching the associated ticket configs for the information email filter */ listInformationEmails(id: OrganizerSpecificId, query?: ListInformationEmailQuery): Promise<ListInfo<InformationEmail>>; /** * Get one information email. * @param id.id ID of the event the emails should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param emailId ID of the information email that should be fetched */ getInformationEmail(id: InformationEmailId, query?: SingleInformationEmailQuery): Promise<InformationEmail>; /** * Saves an information email. * @param id.id ID of the event the emails should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param informationEmail Information email data that should be saved */ saveInformationEmail(id: OrganizerSpecificId, informationEmail: CreateInformationEmail): Promise<InformationEmail>; /** * Update an information email. * @param id.eventId ID of the event the emails should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param id.id ID of the information email that should be updated * @param informationEmail Information email data that should be updated */ updateInformationEmail(id: InformationEmailId, informationEmail: UpdateInformationEmail): Promise<InformationEmail>; /** * Send an information email to all recipients. * @param id.eventId ID of the event the emails should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param id.id ID of the information email that should be sent */ sendInformationEmail(id: InformationEmailId): Promise<void>; /** * Delete an information email. * @param id.eventId ID of the event the emails should belong to * @param id.organizerId Name of the organizer whom the event belongs to * @param id.id ID of the information email that should be sent */ deleteInformationEmail(id: InformationEmailId): Promise<void>; /** * List ticket formats * @returns Array of ticket formats */ listTicketFormats(): Promise<ListInfo<TicketFormat>>; /** * Fetch ticket format * @param id.id ID of the ticket format * @returns ticket format */ getTicketFormat(id: IdParam): Promise<TicketFormat>; /** * List event categories * @returns Array of categories */ listEventCategories(req?: ListCategoryQuery): Promise<ListInfo<Category>>; /** * Returns a per-ticket-config array of enrollment IDs for ticket holders * * @param id Org ID and event ID of the tickets * @returns Public key for signature validation */ getHolderList(id: OrganizerSpecificId): Promise<EventHolderList>; /** * Returns all questionnaires for given organizer * * @param id.id Organizer ID */ listOrganizerQuestionnaires(id: StringIdParam, query?: ListQuestionnaireQuery): Promise<ListInfo<Questionnaire>>; /** * Creates new questionnaire * * @param id.id Organizer ID * @param questionnaireData Data based on which new questionnaire is created */ createQuestionnaire(id: StringIdParam, questionnaireData: CreateQuestionnaire): Promise<Questionnaire>; /** * Fetches queried questionnaire * * @param id.id Questionnaire ID * @param id.organizerId Organizer ID */ getOrganizerQuestionnaire(id: OrganizerSpecificId, query?: QuestionnaireQuery): Promise<Questionnaire>; /** * Updates existing questionnaire * * @param id.id Questionnaire ID * @param id.organizerId Organizer ID * @param questionnaireData Data based on which questionnaire is updated */ updateQuestionnaire(id: OrganizerSpecificId, questionnaireData: UpdateQuestionnaire): Promise<Questionnaire>; /** * Deletes questionnaire with specified ID * * @param id.id Questionnaire ID * @param id.organizerId Organizer ID */ deleteQuestionnaire(id: OrganizerSpecificId): Promise<void>; /** * Fetches queried questionnaire * * @param id.id Questionnaire ID */ getQuestionnaire(id: StringIdParam, query?: QuestionnaireQuery): Promise<Questionnaire>; /** * Returns all questions for given organizer * * @param id.id Organizer ID */ listOrganizerQuestions(id: StringIdParam, query?: ListQuestionQuery): Promise<ListInfo<Question>>; /** * Creates new question * * @param id.id Organizer ID * @param questionData Data based on which new question is created */ createQuestion(id: StringIdParam, questionData: CreateQuestion): Promise<Question>; /** * Fetches queried question * * @param id.id Question ID * @param id.organizerId Organizer ID */ getQuestion(id: OrganizerSpecificId): Promise<Question>; /** * Deletes question with specified ID * * @param id.id Question ID * @param id.organizerId Organizer ID */ deleteQuestion(id: OrganizerSpecificId): Promise<void>; /** * Sends tickets to users with provided emails * * @param ticketsData Data based on which the tickets are sent */ sendTickets(ticketsData: SendTicketsData): Promise<SendTicketsResponse>; } //# sourceMappingURL=service.d.ts.map