Socket
Book a DemoInstallSign in
Socket

@eventfarm/javascript-sdk

Package Overview
Dependencies
Maintainers
4
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eventfarm/javascript-sdk

Official Event Farm Javascript SDK

12.0.0
latest
npmnpm
Version published
Weekly downloads
5
66.67%
Maintainers
4
Weekly downloads
 
Created
Source

Event Farm Logo
Official Event Farm TypeScript SDK

Installation

npm install --save @eventfarm/javascript-sdk

Usage

Client Side Application (React, Angular, Vue, etc.)

You are going to need to get an access token JWT using the Event Farm OAuth.

import { FrontEndClient } from '@eventfarm/javascript-sdk/dist/FrontEndClient';
import { ClientAccessToken } from '@eventfarm/javascript-sdk/dist/Rest/Client/ClientAccessToken';

const jwtResponseFromOauth: string = 'crazy-jwt-string-from-ef-oauth-login';

const client = new FrontEndClient(
  ClientAccessToken.createFromJWT(jwtResponseFromOauth)
);

async function listEvents(userId: string): Promise<{}> {
  return await client.useCaseFactory.Event().ListEventsForUser(userId);
}

listEvents('my-user-id').then(apiResponse => console.log(apiResponse));

Server Side (Express, Koa, etc.)

See Example

OAuth is done using the Password Grant. You are going to need a Client Id and Secret that will be provided by Event Farm.

import { BackEndClient } from '@eventfarm/javascript-sdk/dist/BackEndClient';

const client = new BackEndClient(
    'client_id', // required string
    'client_secret', // required string
    'audience', // required string
    'loginBaseUrl', // default: ''https://eventfarm.us.auth0.com/api/v2/oauth/token'
    'apiBaseUrl', // default: 'https://app.eventfarm.com/api'
);

async function listEvents(userId: string): Promise<{}> {
  return await client.useCaseFactory.Event().ListEventsForUser(userId);
}

listEvents('my-user-id').then(apiResponse => console.log(apiResponse));

Responses

Responses are following the Json API Spec. Please see the format/spec guide for further details.

{
  "data": {
    "type": "Event",
    "id": "7fff5387-0000-45a5-ae48-1d05a7175b93",
    "attributes": {
      "name": "Awesome Test Party",
      "email": "party-organizer@example.com",
      "contactEmail": "MyPartySupport@example.com",
      "guestLimit": -1,
      "type": {
        "slug": "eventfarm",
        "name": "Event Farm",
        "description": null,
        "isEventFarm": true,
        "isCio": false,
        "isListly": false,
        "isDnc": false,
        "isRnc": false,
        "isRslc": false,
        "isSundance": false
      },
      "eventAttributes": {
        "hasDistribute": true,
        "hasDonate": true,
        "hasFee": true,
        "hasEditName": true,
        "hasReveal": true,
        "hasAllowNotes": true,
        "hasDuplicateEmails": true,
        "hasNavigation": true,
        "hasSocialMedia": true,
        "hasSocialMediaBar": true,
        "hasMapLocation": true,
        "hasShowDescription": true,
        "hasIPadPurchase": false,
        "hasSimpleLayout": true,
        "hasLabelPrint": false,
        "hasSkipEventAllocateDisplay": true,
        "hasGeoRestrict": true,
        "hasVisaCheckout": true,
        "hasArchived": false,
        "hasGuestCanChangeResponse": true,
        "hasEfxEnabled": false
      },
      "userFields": {
        "hasAddress": false,
        "hasCompany": false,
        "hasPhone": false,
        "hasTitle": false,
        "hasCountry": false,
        "hasPosition": false
      },
      "startTime": {
        "timestamp": 1643400000,
        "timezone": "America/Los_Angeles",
        "locale": "en_US",
        "date": {
          "short": "1/28/22",
          "medium": "January 28, 2022",
          "long": "Friday, January 28, 2022"
        },
        "time": {
          "short": "12:00 PM",
          "medium": "12:00 PM PST",
          "long": "12:00:00 PM PST"
        },
        "short": "1/28/22, 12:00 PM PST",
        "medium": "January 28, 2022 at 12:00 PM PST",
        "long": "Friday, January 28, 2022 at 12:00 PM PST"
      },
      "endTime": {
        "timestamp": 1643486400,
        "timezone": "America/Los_Angeles",
        "locale": "en_US",
        "date": {
          "short": "1/29/22",
          "medium": "January 29, 2022",
          "long": "Saturday, January 29, 2022"
        },
        "time": {
          "short": "12:00 PM",
          "medium": "12:00 PM PST",
          "long": "12:00:00 PM PST"
        },
        "short": "1/29/22, 12:00 PM PST",
        "medium": "January 29, 2022 at 12:00 PM PST",
        "long": "Saturday, January 29, 2022 at 12:00 PM PST"
      },
      "altKeyword": "mediumeventp1",
      "venue": {
        "name": null,
        "address": null,
        "artistName": null,
        "artistDeposit": 0,
        "checkName": null,
        "flatPercentage": 0,
        "flatFee": 0,
        "memo": null
      },
      "isEFxEnabled": false,
      "defaultSitePage": null,
      "created": {
        "createdAt": 1516128284,
        "ip4Created": "127.0.0.1"
      },
      "modified": {
        "modifiedAt": 1516128284,
        "ip4Modified": null
      },
      "mapSourceType": {
        "slug": "google",
        "name": "Google",
        "description": "Google Maps",
        "isGoogle": true,
        "isYahoo": false,
        "isBing": false
      }
    },
    "meta": {
      "isInitialized": true
    },
    "links": {
      "self": "https://eventfarm.com/api/v2/Event/UseCase/GetEvent?eventId=7fff5387-0000-45a5-ae48-1d05a7175b93"
    },
    "relationships": {
      "pool": {
        "type": "Pool",
        "id": "7fff1f7a-0000-45a5-a6b7-9123da6f4aff",
        "meta": {
          "isInitialized": false
        },
        "links": {
          "self": "https://eventfarm.com/api/v2/Pool/UseCase/GetPool?poolId=7fff1f7a-0000-45a5-a6b7-9123da6f4aff"
        }
      },
      "stacks": [
        {
          "type": "Stack",
          "id": "7fffb628-0000-45a5-ae48-4a001dbd6d01",
          "attributes": {
            "id": "7fffb628-0000-45a5-ae48-4a001dbd6d01",
            "send": "invite,confirm,decline",
            "inviteEmailId": "7fff3d1a-0000-45a5-ae48-4e08d86c122b",
            "confirmEmailId": "7fff3d1a-0000-45a5-ae48-4e0f60015a83",
            "declineEmailId": "7fff3d1a-0000-45a5-ae48-4f03e0c52a9f",
            "serviceFee": 0,
            "price": 0,
            "quantity": 300,
            "maxQuantity": 10,
            "openingAt": 1516041900,
            "closingAt": 1643485500,
            "isTransferable": true,
            "isDeleted": false,
            "deletedAt": null,
            "stackMethodType": {
              "slug": "invite-to-rsvp-fcfs",
              "name": "Invite to RSVP (FCFS)",
              "description": null,
              "isPublicRegistration": false,
              "isPublicPurchase": false,
              "isInviteToRegister": false,
              "isInviteToPurchase": false,
              "isInviteToRSVP": false,
              "isInviteToRegisterFCFS": false,
              "isInviteToPurchaseFCFS": false,
              "isInviteToRSVPFCFS": true,
              "isInvitation": true,
              "isFirstComeFirstServe": true,
              "isAnyInviteToPurchase": false,
              "isAnyInviteToRegister": false,
              "isAnyInviteToRSVP": true
            },
            "created": {
              "createdAt": 1516128329,
              "ip4Created": "172.18.0.1"
            },
            "modified": {
              "modifiedAt": 1516128337,
              "ip4Modified": "172.18.0.1"
            }
          },
          "extraAttributes": {
            "availabilityCounts": {
              "totalQuantity": 300,
              "totalUsed": 0,
              "totalUnused": 300,
              "totalAvailable": 300,
              "percentUsed": 0,
              "percentUnused": 100,
              "totalAffirmed": 0,
              "totalUnaffirmed": 300,
              "percentAffirmed": 0,
              "percentUnaffirmed": 100,
              "total": 0,
              "assigned": 0,
              "purchased": 0,
              "confirmed-by-rsvp": 0,
              "declined-by-rsvp": 0,
              "left-behind": 0,
              "not-yet-purchased": 0,
              "registered": 0,
              "unconfirmed": 0,
              "recycled": 0,
              "not-yet-registered": 0
            }
          },
          "meta": {
            "isInitialized": true
          },
          "links": {
            "self": "https://eventfarm.com/api/v2/Stack/UseCase/GetStack?stackId=7fffb628-0000-45a5-ae48-4a001dbd6d01"
          },
          "relationships": {
            "ticketType": {
              "type": "TicketType",
              "id": "7fff36ce-0000-45a5-ae48-3918d3759d9d",
              "attributes": {
                "id": "7fff36ce-0000-45a5-ae48-3918d3759d9d",
                "name": "VIP",
                "code": "",
                "description": null,
                "quantity": 300,
                "sortOrder": 1,
                "isDeleted": false,
                "deletedAt": null,
                "created": {
                  "createdAt": 1516128313,
                  "ip4Created": "172.18.0.1"
                },
                "modified": {
                  "modifiedAt": 1516128313,
                  "ip4Modified": null
                }
              },
              "meta": {
                "isInitialized": true
              },
              "links": {
                "self": "https://eventfarm.com/api/v2/Stack/UseCase/GetTicketType?ticketTypeId=7fff36ce-0000-45a5-ae48-3918d3759d9d"
              }
            }
          }
        }
      ],
      "ticketBlocks": [
        {
          "type": "TicketBlock",
          "id": "7fff6ce5-0000-45a5-ae49-390fe1d99c88",
          "attributes": {
            "name": "Medium Event P1 - TB2",
            "emailText": null,
            "isBlacklistEnabled": false,
            "isDeleted": false,
            "deletedAt": null,
            "created": {
              "createdAt": 1516128569,
              "ip4Created": "127.0.0.1"
            },
            "modified": {
              "modifiedAt": 1516128569,
              "ip4Modified": null
            }
          },
          "extraAttributes": {
            "allotmentCounts": [
              {
                "allotmentId": "7fffa0bd-0000-45a5-ae49-3918e32c0a59",
                "stackId": "7fffb628-0000-45a5-ae48-4a001dbd6d01",
                "ticketBlockId": "7fff6ce5-0000-45a5-ae49-390fe1d99c88",
                "ticketTypeName": "VIP",
                "stackMethodType": {
                  "slug": "invite-to-rsvp-fcfs",
                  "name": "Invite to RSVP (FCFS)",
                  "description": null,
                  "isPublicRegistration": false,
                  "isPublicPurchase": false,
                  "isInviteToRegister": false,
                  "isInviteToPurchase": false,
                  "isInviteToRSVP": false,
                  "isInviteToRegisterFCFS": false,
                  "isInviteToPurchaseFCFS": false,
                  "isInviteToRSVPFCFS": true,
                  "isInvitation": true,
                  "isFirstComeFirstServe": true,
                  "isAnyInviteToPurchase": false,
                  "isAnyInviteToRegister": false,
                  "isAnyInviteToRSVP": true
                },
                "invitationCounts": {
                  "totalUsed": 0,
                  "firstComeFirstServeOutstanding": 0,
                  "totalQuantity": 10,
                  "totalRemaining": 10
                }
              },
              {
                "allotmentId": "7fffa0bd-0000-45a5-ae49-3920c5604384",
                "stackId": "7fffb628-0000-45a5-ae48-6c08880cbd00",
                "ticketBlockId": "7fff6ce5-0000-45a5-ae49-390fe1d99c88",
                "ticketTypeName": "GA",
                "stackMethodType": {
                  "slug": "invite-to-rsvp-fcfs",
                  "name": "Invite to RSVP (FCFS)",
                  "description": null,
                  "isPublicRegistration": false,
                  "isPublicPurchase": false,
                  "isInviteToRegister": false,
                  "isInviteToPurchase": false,
                  "isInviteToRSVP": false,
                  "isInviteToRegisterFCFS": false,
                  "isInviteToPurchaseFCFS": false,
                  "isInviteToRSVPFCFS": true,
                  "isInvitation": true,
                  "isFirstComeFirstServe": true,
                  "isAnyInviteToPurchase": false,
                  "isAnyInviteToRegister": false,
                  "isAnyInviteToRSVP": true
                },
                "invitationCounts": {
                  "totalUsed": 0,
                  "firstComeFirstServeOutstanding": 0,
                  "totalQuantity": 300,
                  "totalRemaining": 300
                }
              }
            ]
          },
          "meta": {
            "isInitialized": true
          },
          "links": {
            "self": "https://eventfarm.com/api/v2/TicketBlock/UseCase/GetTicketBlock?ticketBlockId=7fff6ce5-0000-45a5-ae49-390fe1d99c88"
          }
        }
      ]
    }
  }
}

Paginated

{
  "meta": {
    "totalPages": 2,
    "totalResults": 2,
    "totalResultsReturned": 1,
    "currentPage": 1,
    "itemsPerPage": 1,
    "executedAt": 1526599136
  },
  "links": {
    "self": "https://eventfarm.com/api/v2/Event/UseCase/ListEventsForUser?eventDateFilterType=current-future\u0026itemsPerPage=1\u0026userId=7fff1483-0000-4578-ad31-f6114a033eb7",
    "first": "https://eventfarm.com/api/v2/Event/UseCase/ListEventsForUser?eventDateFilterType=current-future\u0026itemsPerPage=1\u0026userId=7fff1483-0000-4578-ad31-f6114a033eb7\u0026page=1",
    "last": "https://eventfarm.com/api/v2/Event/UseCase/ListEventsForUser?eventDateFilterType=current-future\u0026itemsPerPage=1\u0026userId=7fff1483-0000-4578-ad31-f6114a033eb7\u0026page=2",
    "next": "https://eventfarm.com/api/v2/Event/UseCase/ListEventsForUser?eventDateFilterType=current-future\u0026itemsPerPage=1\u0026userId=7fff1483-0000-4578-ad31-f6114a033eb7\u0026page=1"
  },
  "data": [
    {
      "type": "Event",
      "id": "7fff5387-0000-4578-ae9c-921df4f75d90",
      "attributes": {
        "name": "Awesome Test Party",
        "email": "party-organizer@example.com",
        "contactEmail": "MyPartySupport@example.com",
        "guestLimit": -1,
        "type": {
          "slug": "eventfarm",
          "name": "Event Farm",
          "description": null,
          "isEventFarm": true,
          "isCio": false,
          "isListly": false,
          "isDnc": false,
          "isRnc": false,
          "isRslc": false,
          "isSundance": false
        },
        "eventAttributes": {
          "hasDistribute": false,
          "hasDonate": false,
          "hasFee": false,
          "hasEditName": false,
          "hasReveal": false,
          "hasAllowNotes": false,
          "hasDuplicateEmails": true,
          "hasNavigation": true,
          "hasSocialMedia": true,
          "hasSocialMediaBar": true,
          "hasMapLocation": false,
          "hasShowDescription": true,
          "hasIPadPurchase": false,
          "hasSimpleLayout": true,
          "hasLabelPrint": false,
          "hasSkipEventAllocateDisplay": true,
          "hasGeoRestrict": false,
          "hasVisaCheckout": false,
          "hasArchived": false,
          "hasGuestCanChangeResponse": true,
          "hasEfxEnabled": false
        },
        "userFields": {
          "hasAddress": false,
          "hasCompany": false,
          "hasPhone": false,
          "hasTitle": false,
          "hasCountry": false,
          "hasPosition": false
        },
        "startTime": {
          "timestamp": 1659043920,
          "timezone": "America/Los_Angeles",
          "locale": "en_US",
          "date": {
            "short": "7/28/22",
            "medium": "July 28, 2022",
            "long": "Thursday, July 28, 2022"
          },
          "time": {
            "short": "2:32 PM",
            "medium": "2:32 PM PST",
            "long": "2:32:00 PM PDT"
          },
          "short": "7/28/22, 2:32 PM PST",
          "medium": "July 28, 2022 at 2:32 PM PST",
          "long": "Thursday, July 28, 2022 at 2:32 PM PST"
        },
        "endTime": {
          "timestamp": 1659130320,
          "timezone": "America/Los_Angeles",
          "locale": "en_US",
          "date": {
            "short": "7/29/22",
            "medium": "July 29, 2022",
            "long": "Friday, July 29, 2022"
          },
          "time": {
            "short": "2:32 PM",
            "medium": "2:32 PM PST",
            "long": "2:32:00 PM PDT"
          },
          "short": "7/29/22, 2:32 PM PST",
          "medium": "July 29, 2022 at 2:32 PM PST",
          "long": "Friday, July 29, 2022 at 2:32 PM PST"
        },
        "altKeyword": "awesome-test-party",
        "venue": {
          "name": "Event Farm HQ",
          "address": "2403 Main Street, Santa Monica, CA",
          "artistName": null,
          "artistDeposit": 0,
          "checkName": null,
          "flatPercentage": 0,
          "flatFee": 0,
          "memo": null
        },
        "isEFxEnabled": false,
        "defaultSitePage": null,
        "created": {
          "createdAt": 1468963985,
          "ip4Created": "172.18.0.1"
        },
        "modified": {
          "modifiedAt": 1516139911,
          "ip4Modified": "172.18.0.1"
        },
        "mapSourceType": {
          "slug": "google",
          "name": "Google",
          "description": "Google Maps",
          "isGoogle": true,
          "isYahoo": false,
          "isBing": false
        }
      },
      "meta": {
        "isInitialized": true
      },
      "links": {
        "self": "https://eventfarm.com/api/v2/Event/UseCase/GetEvent?eventId=7fff5387-0000-4578-ae9c-921df4f75d90"
      },
      "relationships": {
        "pool": {
          "type": "Pool",
          "id": "7fff1f7a-0000-4578-ad49-681e5374350c",
          "meta": {
            "isInitialized": false
          },
          "links": {
            "self": "https://eventfarm.com/api/v2/Pool/UseCase/GetPool?poolId=7fff1f7a-0000-4578-ad49-681e5374350c"
          }
        }
      }
    }
  ]
}

FAQs

Package last updated on 16 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.