1.4.0 • Published 4 years ago

teamsdev.sdkdemo v1.4.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

Dev platform for Teams prototype SDK

Notice:

This SDK is just for demo purpose to demonstrate the functionalities of dev platform, the SDK need to be redesigned for production

Install

Run npm install teamsdev.sdkdemo to install the SDK

Initialize SDK

import { TeamsCloud } from 'teamsdev.sdkdemo';

let inTeams: boolean = true; // Add your logic here to detect whether application is running in Teams
await TeamsCloud.init({
    environment: "{env_name}",
    appId:"{teams_app_id}"
}, inTeams);

Database APIs

Add items to DB

let insertedItemsId = await TeamsCloud.database().container('{container_name}').add([
    {
        "LastName": "Andersen",
        "Parents": [
            "Thomas",
            "Mary Kay"
        ]
    },
    {
        "LastName": "Steve",
        "Parents": [
            "John",
            "Potter"
        ]
    }
]);

Query DB

let queryResult = await TeamsCloud.database().container('{container_name}').where({
    LastName: QueryCommand.eq('Andersen')
}).get();

Query DB with raw query string

let rawQueryResult = await TeamsCloud.database().container('{container_name}')
                                .fromRaw("select * from c where c.userId = 'chyuan@microsoft.com'")
                                .get();

Replace item

//itemToUpdate must already exists and contains id property
await TeamsCloud.database().container('{container_name}').replace(itemToUpdate);

Delete item

await TeamsCloud.database().container('{container_name}').delete(id_of_item);

Storage APIs

Upload

let file = fs.readFileSync("README.md", 'utf8');
let fileId = await TeamsCloud.storage().upload(file, "text/plain");

Download

let fileContent = await TeamsCloud.storage().download("{file_id}");

Get public URL

let publicUrl = await TeamsCloud.storage().getPublicUrl("{file_id}");

Function APIs

Call Function

let postFunctionResponse = await TeamsCloud.function().callFunction({
    functionName: "{function_name}",
    method: FunctionHttpMethod.POST,
    customHeaders: { header1: "header1_value" },
    data: { name: "chaoyi" },
    contentType: "application/json"
});

Speech APIs

let recognizeResult = await TeamsCloud.speech().recognize("{url_for_audio_file}");

Build and Test

TODO: Describe and show how to build your code and run the tests.

Contribute

TODO: Explain how other users and developers can contribute to make your code better.

If you want to learn more about creating good readme files then refer the following guidelines. You can also seek inspiration from the below readme files:

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago