12.0.0 • Published 2 days ago

@eventfarm/javascript-sdk v12.0.0

Weekly downloads
11
License
MIT
Repository
-
Last release
2 days ago

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
    'email', // required string
    'password', // required string
    'loginBaseUrl', // default: 'https://app.eventfarm.com'
    '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"
          }
        }
      }
    }
  ]
}
12.0.1-18

2 days ago

12.0.1-17

6 days ago

12.0.1-16

7 days ago

12.0.1-15

9 days ago

12.0.1-14

14 days ago

12.0.1-13

17 days ago

12.0.1-11

1 month ago

12.0.1-12

1 month ago

12.0.1-10

1 month ago

12.0.1-9

1 month ago

12.0.1-8

2 months ago

12.0.1-7

2 months ago

12.0.1-6

2 months ago

12.0.1-5

3 months ago

12.0.1-4

3 months ago

12.0.1-3

3 months ago

12.0.1-2

3 months ago

12.0.1-0

3 months ago

12.0.1-1

3 months ago

12.0.0

4 months ago

11.3.3-2

4 months ago

11.3.2-13

4 months ago

11.3.2

4 months ago

11.3.3-0

4 months ago

11.3.3-1

4 months ago

11.3.2-9

7 months ago

11.3.2-8

8 months ago

11.3.2-11

6 months ago

11.3.2-10

6 months ago

11.3.2-7

11 months ago

11.2.0

1 year ago

11.3.1-0

1 year ago

11.3.2-5

11 months ago

11.3.2-4

11 months ago

11.3.2-6

11 months ago

11.3.2-1

1 year ago

11.3.2-0

1 year ago

11.3.2-3

11 months ago

11.3.2-2

12 months ago

11.3.1

1 year ago

11.0.10-1

1 year ago

11.0.9-0

1 year ago

11.0.6

1 year ago

11.0.8

1 year ago

11.0.9

1 year ago

11.0.8-1

1 year ago

11.0.8-0

1 year ago

11.0.10-0

1 year ago

11.0.5-0

2 years ago

11.0.5-1

1 year ago

11.0.1-0

2 years ago

11.0.1-1

2 years ago

11.0.5

1 year ago

11.0.0

2 years ago

11.0.6-0

1 year ago

11.0.0-1

2 years ago

11.0.0-3

2 years ago

11.0.0-4

2 years ago

11.0.0-0

2 years ago

10.3.17-1

2 years ago

10.3.16-1

2 years ago

10.3.16-0

2 years ago

10.3.2

2 years ago

10.3.16

2 years ago

10.3.15

2 years ago

10.3.17-0

2 years ago

10.3.1

2 years ago

10.3.2-0

2 years ago

10.3.2-1

2 years ago

10.3.2-2

2 years ago

10.3.1-7

2 years ago

10.3.1-6

2 years ago

10.3.1-1

2 years ago

10.3.1-3

2 years ago

10.3.1-4

2 years ago

10.3.1-5

2 years ago

3.2.2-BETA.0

2 years ago

10.3.1-0

2 years ago

10.3.0

2 years ago

10.3.0-0

2 years ago

10.3.0-1

2 years ago

10.3.0-2

2 years ago

10.3.0-3

2 years ago

10.3.0-4

2 years ago

10.2.0-2

2 years ago

10.2.0-3

2 years ago

10.2.0-1

2 years ago

10.1.1

2 years ago

10.2.0-0

2 years ago

10.0.3-1

2 years ago

10.0.3-2

2 years ago

10.0.3-0

2 years ago

10.1.0

2 years ago

10.0.3-3

2 years ago

10.0.3-BETA1

2 years ago

10.1.0-0

2 years ago

3.2.1-BETA2

3 years ago

3.2.1-b

3 years ago

3.2.0

3 years ago

3.1.8

4 years ago

3.1.7

4 years ago

3.1.6

4 years ago

3.1.5

4 years ago

3.1.4

4 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.4444

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-rc.5

5 years ago

2.0.0-rc.4

5 years ago

2.0.0-rc.3

5 years ago

2.0.0-rc.2

5 years ago

2.0.0-rc.1

5 years ago