Options
All
  • Public
  • Public/Protected
  • All
Menu

Module business-objects

@dvelop-sdk/business-objects

npm (scoped) npm bundle size (scoped) GitHub license

This package contains functionality for the BusinessObjects-App in the d.velop cloud.

Explore the docs »
Install via npm »
Check us out on GitHub »

Index

Functions

  • Create a business object entity.

    example
    import { createBoEntity } from "@dvelop-sdk/business-objects";

    await createBoEntity({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    entity: {
    employeeId: "1",
    firstName: "John Micheal",
    lastName: "Dorian",
    jobTitel: "senior physician"
    }
    });

    You can also use generics:

    example
    import { createBoEntity } from "@dvelop-sdk/business-objects";

    interface Employee {
    employeeId: string;
    firstName: string;
    lastName: string;
    jobTitel: string;
    }

    await create<Employee>({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    entity: {
    employeeId: "1",
    firstName: "John Micheal",
    lastName: "Dorian",
    jobTitel: "senior physician"
    }
    });

    Type parameters

    • E = any

      Type for Entity. Defaults to any.

    Parameters

    Returns Promise<void>

  • Delete a business object entity.

    example
    import { deleteBoEntity } from "@dvelop-sdk/business-objects";

    await deleteBoEntity({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    keyPropertyType: "number", //"string", "number" or "guid"
    entityKeyValue: 1
    });

    You can also write your own function, for example to get a notification, if the entity requested for deletion doesn't exist.

    example
    import { deleteBoEntity } from "@dvelop-sdk/business-objects";

    const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response: HttpResponse) => {
    if(response.status === 204) {
    return "Entity does not exist.";
    } else {
    return "Entity was deleted.";
    }
    });

    const responseMessage: string = await myDeleteFunction({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    keyPropertyType: "number", //"string", "number" or "guid"
    entityKeyValue: 3
    });

    console.log(responseMessage); // Entity does not exist.

    Parameters

    Returns Promise<void>

  • Returns all specified entities from a model.

    example
    import { getBoEntities } from "@dvelop-sdk/business-objects";

    const employees = await getBoEntities({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    });
    console.log(employees); // [{ employeeId: '1', firstName: 'John Micheal', lastName: 'Dorian', jobTitel: 'senior physician' }, { employeeId: '2', firstName: 'Christopher', lastName: 'Turk', jobTitel: 'chief surgeon' }]

    You can also use generics:

    example
    import { getBoEntities } from "@dvelop-sdk/business-objects";

    interface Employee {
    employeeId: string;
    firstName: string;
    lastName: string;
    jobTitel: string;
    }

    const employees: Employee[] = await getBoEntities<Employee>({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees"
    });

    employees.forEach(e => console.log(e.lastName));
    // Dorian
    // Turk

    Type parameters

    • E = any

      Type for Entity. Defaults to any.

    Parameters

    Returns Promise<E[]>

  • Returns one specified entity from a model.

    example
    import { getBoEntity } from "@dvelop-sdk/business-objects";

    const jd = await getBoEntity({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    keyPropertyType: "string", //"string", "number" or "guid"
    keyPropertyValue: "1"
    });
    console.log(jd); // { employeeId: '1', firstName: 'John Micheal', lastName: 'Dorian', jobTitel: 'senior physician' }

    You can also use generics:

    example
    import { getBoEntity } from "@dvelop-sdk/business-objects";

    interface Employee {
    employeeId: string;
    firstName: string;
    lastName: string;
    jobTitel: string;
    }

    const jd: Employee = await getBoEntity<Employee>({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    keyPropertyType: "string", //"string", "number" or "guid"
    keyPropertyValue: "1"
    });

    console.log(jd.lastName); // Dorian

    Type parameters

    • E = any

      Type for Entity. Defaults to any.

    Parameters

    Returns Promise<E>

  • Update a business object entity.

    example
    import { updateBoEntity } from "@dvelop-sdk/business-objects";

    await updateBoEntity({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    keyPropertyType: "number", //"string", "number" or "guid"
    keyPropertyValue: 1,
    entityChange: {
    "firstName": "J.D."
    }
    });

    You can also use generics:

    example
    import { updateBoEntity } from "@dvelop-sdk/business-objects";

    interface Employee {
    employeeId: string;
    firstName: string;
    lastName: string;
    jobTitel: string;
    }

    await updateBoEntity<Employee>({
    systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
    authSessionId: "3f3c428d452"
    },{
    modelName: "HOSPITALBASEDATA",
    pluralEntityName: "employees",
    keyPropertyType: "number", //"string", "number" or "guid"
    keyPropertyValue: 1,
    entityChange: {
    "firstName": "John Micheal (J.D.)"
    }
    });

    Type parameters

    • E = any

      Type for Entity. Defaults to any.

    Parameters

    Returns Promise<void>

Generated using TypeDoc