Node.js wrapper for the [MINDBODY Public API](https://developers.mindbodyonline.com/PublicDocumentation/V6)

# How to use?

### Global fetcher

```
import MboFetcher from "mindbody-fetcher";

const mboFetcher = new MboFetcher({
  apiKey: "apiKey",
  siteId: "siteId",
});

const response = await mboFetcher.clientFetcher.getClients(
  { SearchText: "olivier@gymlib.com" },
  token
);

console.log(response.data.Clients);
```

Every request with global fetcher will share the same axios instance.

### Endpoint specific fetcher

```
import { ClientFetcher } from "mindbody-fetcher";

const clientFetcher = new ClientFetcher({
  apiKey: "apiKey",
  siteId: "siteId",
});

const response = await clientFetcher.getClients(
  { SearchText: "olivier@gymlib.com" },
  token
);

console.log(response.data.Clients);
```

# TODO

Not all endpoints are implemented. Feel free to implement the missing endpoints.

- Appointment
  - [ ] ActiveSessionTimes
  - [ ] AppointmentAddOns
  - [ ] AppointmentAvailableDates
  - [ ] AppointmentOptions
  - [ ] BookableItems
  - [ ] ScheduleItems
  - [ ] StaffAppointments
  - [ ] AddAppointment
  - [ ] AddAppointmentAddOn
  - [ ] UpdateAppointment
  - [ ] AppointmentAddOn
- Class
  - [x] Classes
  - [ ] ClassDescriptions
  - [ ] ClassSchedules
  - [ ] ClassVisits
  - [ ] WaitListEntries
  - [x] AddClientToClass
  - [x] RemoveClientFromClass
  - [ ] RemoveClientsFromClasses
  - [ ] RemoveFromWaitlist
  - [ ] SubstituteClassTeacher
- Client
  - [ ] ActiveClientMemberships
  - [ ] ActiveClientsMemberships
  - [ ] ClientAccountBalances
  - [ ] ContactLogs
  - [ ] ClientContracts
  - [ ] ClientDirectDebitInfo
  - [ ] ClientDuplicates
  - [ ] ClientFormulaNotes
  - [ ] ClientIndexes
  - [ ] ClientPurchases
  - [ ] ClientReferralTypes
  - [ ] ClientRewards
  - [x] Clients
  - [ ] ClientCompleteInfo
  - [x] ClientServices
  - [x] ClientVisits
  - [ ] ClientSchedule
  - [ ] CrossRegionalClientAssociations
  - [ ] CustomClientFields
  - [x] RequiredClientFields
  - [ ] ContactLogTypes
  - [ ] AddArrival
  - [x] AddClient
  - [ ] AddClientDirectDebitInfo
  - [ ] AddClientFormulaNote
  - [ ] AddContactLog
  - [ ] SendAutoEmail
  - [x] SendPasswordResetEmail
  - [x] UpdateClient
  - [ ] UpdateClientRewards
  - [ ] UpdateClientService
  - [ ] UpdateClientVisit
  - [ ] UpdateContactLog
  - [ ] UploadClientDocument
  - [ ] UploadClientPhoto
  - [ ] ClientDirectDebitInfo
  - [ ] ClientFormulaNote
  - [ ] ContactLog
- Enrollment
  - [ ] Enrollments
  - [ ] AddClientToEnrollment
- Payroll
  - [ ] Commissions
  - [ ] ScheduledServiceEarnings
  - [ ] TimeCards
  - [ ] Tips
- Sale
  - [ ] AcceptedCardTypes
  - [ ] Contracts
  - [x] CustomPaymentMethods
  - [ ] GiftCardBalance
  - [ ] GiftCards
  - [ ] Packages
  - [ ] Products
  - [ ] ProductsInventory
  - [ ] Sales
  - [x] Services
  - [ ] Transactions
  - [x] CheckoutShoppingCart
  - [ ] PurchaseAccountCredit
  - [ ] PurchaseContract
  - [ ] PurchaseGiftCard
  - [ ] UpdateProductPrice
  - [ ] Products (PUT)
  - [ ] Services (PUT)
  - [ ] SaleDate (PUT)
- Site
  - [ ] ActivationCode
  - [ ] Genders
  - [x] Locations
  - [ ] Memberships
  - [x] Programs
  - [ ] PromoCodes
  - [ ] Resources
  - [ ] SessionTypes
  - [ ] Sites
  - [ ] Categories
  - [ ] PaymentTypes
  - [ ] AddPromoCode
  - [ ] Relationships
- Staff
  - [ ] Staff
  - [ ] StaffPermissions
  - [ ] StaffImageURL
  - [ ] StaffSessionTypes
  - [ ] SalesReps
  - [ ] AddStaff
  - [ ] AddStaffAvailability
  - [ ] AssignStaffSessionType
  - [ ] UpdateStaff
  - [ ] UpdateStaffPermissions

# Shared Resources

Not all shared resources are implemented. Feel free to implement the missings resources.

- [ ] ApplicableItems
- [ ] Appointment
- [x] AssignedClientIndex
- [ ] Availability
- [ ] Category
- [x] Class
- [x] ClassDescription
- [ ] ClassSchedule
- [x] Client
- [x] ClientCreditCard
- [ ] ClientMemberships
- [ ] ClientMembership
- [x] ClientRelationship
- [x] ClientService
- [ ] ClientArrival
- [ ] ContactLogType
- [ ] Contract
- [ ] Course
- [ ] Discount
- [x] Location
- [ ] Membership
- [ ] Package
- [ ] PaymentType
- [ ] PermissionValues
- [ ] Product
- [ ] ProductsInventory
- [x] Program
- [x] Relationship
- [x] Resource
- [x] SalesRep
- [ ] Sale
- [x] Service
- [x] SessionType
- [ ] Site
- [ ] Staff
- [ ] SubCategory
- [ ] Transaction
- [ ] Unavailability
- [ ] UpcomingAutopayEvent
- [x] Visit
