Menu Sections

Create menu section

import { MenuSectionsApi, MenuSectionBase } from '@flipdish/api-client-typescript'

let menuId: number = <menu id>;

let menuSectionApi = new MenuSectionsApi();

let menuSection = new MenuSectionBase();
menuSection.Name = "Sample item";
menuSection.Description = "Sample menu section";
menuSection.IsAvailable = true;

menuSectionApi.createMenuSection(menuId,  menuSection)
.then(response => {
  if (response.response.statusCode == 201) {
    console.log("Menu section created at: " + response.response.headers.location);
  }
}).catch(error => {
  console.log(error);
})

Edit menu section

import { MenuSectionsApi, MenuSectionBase } from '@flipdish/api-client-typescript'

let menuId: number = <menu id>;
let menuSectionId: number = <section id>;
let menuSectionApi = new MenuSectionsApi();

let menuSection = new MenuSectionBase();
menuSection.Name = "new name";
menuSection.Description = "new description";

menuSectionApi.updateMenuSection(menuId, menuSectionId, menuSection)
.then(response => {
  if (response.response.statusCode == 200) {
    console.log("Menu section updated");
  }
}).catch(error => {
  console.log(error);
})

Delete menu section

import { MenuSectionsApi } from '@flipdish/api-client-typescript'

let menuId: number = <menu id>;
let menuSectionId: number = <section id>;
let menuSectionApi = new MenuSectionsApi();

menuSectionApi.deleteMenuSection(menuId, menuSectionId)
.then(response => {
  if (response.response.statusCode == 200) {
    console.log("Menu section deleted");
  }
}).catch(error => {
  console.log(error);
})