# teamsdev.sdkdemo

> Demo SDK for teamsdev

Latest version **1.4.0** (published 2020-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install teamsdev.sdkdemo
pnpm add teamsdev.sdkdemo
yarn add teamsdev.sdkdemo
bun add teamsdev.sdkdemo
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-04-13 |
| First published | 2020-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 38.3 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | Microsoft |
| Maintainers | blackchoey, zhenjiao |

## Links

- npm: https://www.npmjs.com/package/teamsdev.sdkdemo
- Repository: https://mseng@dev.azure.com/mseng/VSIoT/_git/TeamsDev.SDKDemo
- npm.io page: https://npm.io/package/teamsdev.sdkdemo

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.19.2
- [@microsoft/teams-js](https://npm.io/package/@microsoft/teams-js.md) ^1.6.0

## Recent versions

- 1.4.0 (latest) — 2020-04-13
- 1.3.0 — 2020-04-02
- 1.2.0 — 2020-03-25
- 1.1.3 — 2020-03-24
- 1.1.2 — 2020-03-24
- 1.1.1 — 2020-03-23
- 1.1.0 — 2020-03-23
- 1.0.1 — 2020-03-15
- 1.0.0 — 2020-03-15

## README

# 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](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:
- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
- [Chakra Core](https://github.com/Microsoft/ChakraCore)

---
_Source: https://npm.io/package/teamsdev.sdkdemo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
