Skip to content

Instantly share code, notes, and snippets.

View DeeJayTC's full-sized avatar
👋
theres nothing to see here...move along!

Tim Cadenbach DeeJayTC

👋
theres nothing to see here...move along!
View GitHub Profile
install-package Teamwork -IncludePrerelease
using Teamwork;
using Teamwork.Shared;
using Teamwork.Shared.Common;
private async Task<Teamwork.Client> HandleOauthAuthentication(string code, string state)
{
var response = await LoginFlow.TeamworkLoginFlow.GetLoginDataAsync(code);
// Use response to initialize a new instance of the Teamwork APi Client
return Client.GetTeamworkClient(
// Get all people in installation
var people = client.Projects.People.GetPeopleAsync();
// Get status updates by people in installation
var latestStatusMessages = client.Projects.People.GetPeopleStatusAsync();
// Find a person by email
var personByMail = client.Projects.People.GetPersonByMailAsync("max@teamwork.com");
// Get all active Projects
// Create a new TodoItem instance
var newTask = new TodoItem() {
Description = "This is a new task we want to add",
Content = "The Title for my new task"
};
// And add it as task to a project
// tasklist id can be left blank, the task will be added to an "Inbox" tasklist
// also we can add it as a subtask and assign the parenttask
var result = await client.Projects.Projects.AddTodoItem(
// Lets just like a comment
var ok = await client.Projects.Reactions.LikeItem("comment", "commentId");
// we can even send messages on teamwork chat!
var ok = await client.Projects.Chat.SendMessage("the message i want to send", "the RoomId");
// Update your status
var ok = await client.Projects.Me.AddNewStatusMessage("Gone Fishin");
@DeeJayTC
DeeJayTC / adaptivecard.json
Last active February 21, 2019 16:21
Adaptive Cards made easy :)
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
@DeeJayTC
DeeJayTC / status.cs
Last active February 21, 2019 15:36
using AdaptiveCards;
// ...
AdaptiveCard card = new AdaptiveCard();
var container = new AdaptiveContainer();
var column = new AdaptiveColumn(){Width=Auto};
column.Items.Add(new AdaptiveImage(
// Create an adaptive card and send it
var payload = await _cardservice.RenderCard(templateKey, template, data);
var result = await client.PostAsync(url, new StringContent(payload));
//the underlying CardRenderService
public class CardRenderService
{
private RazorLightEngine Engine;
public CardRenderService()
{
Engine = new RazorLightEngineBuilder().UseMemoryCachingProvider().Build();
}
@if(Model.Task.TaskDueDate != null)
{
<text>,
{
"title": "Due Date",
"value": "@Model.Task.TaskDueDate.ToShortDateString()"
}
</text>
}