thrzn41 / webexteamsapiclient Goto Github PK
View Code? Open in Web Editor NEWWebex Teams API Client for .NET
License: MIT License
Webex Teams API Client for .NET
License: MIT License
Enums for Resources or Operations.
For examples:
TeamsResource.Message;
TeamsResource.Space;
TeamsOperation.List;
TeamsOperation.Get;
TeamsOperation.Create;
In addition, this resource and operation can be retrieved from result.
Code snippet for this enhancement:
var r = await teams.ListSpaces();
// For example, "Operation: ListSpace" is output to log.
Log.Info("Operation: {0}", r.ResourceOperation);
Feature to decode multi byte file name in GetFileInfo/Data() methods.
In current design, Adaptive Cards 1.2 schema should be supported.
Need to add test cases for Adaptive Cards 1.2 schema.
The URI https://api.ciscospark.com
has changed to https://webexapis.com
. The code still calls the old API-URI api.ciscospark.com
as stated in TeamsAPIClient.cs
:
protected const string TEAMS_API_PATH = "https://api.ciscospark.com/v1/";
While this is still working for most of the scenarios, the File-URI's in messages return the new URI. Subsequent calls to GetFileInfoAsync
with the new URI returned fail with 401 "Unauthorized", because the Authentication header will not be passed to the API due to this check in TeamsHttpClient.cs:
if (this.teamsAuthentication != null && !reusableRequest.HasAuthentication && this.teamsAPIUriPattern != null && this.teamsAPIUriPattern.IsMatch(reusableRequest.Uri.AbsoluteUri)) // <-- no Match!
{
reusableRequest.Authentication = this.teamsAuthentication;
}
Support for Audit Events:
GET /v1/adminAudit/events
.
In Release 1.6.1, TeamsRetryHandler
implemented.
If a TeamsRetryHandler
was set to TeamsAPIClient instance, no need to use TeamsListResult.GetListResultEnumerator(TeamsRetry, TeamsListResultFunc)
.
To list direct messages by /v1/messages/direct
.
To create message as thread or list messages from thread,
new methods or parameters are needed.
There are some unnecessary await Tasks.
For example:
some await Stream.CopyToAsync()
can be replaced with simply Stream.CopyTo()
.
For some methods, it will be better:
Stream.CopyTo();
return Task.CompletedTask;
is it any possibility to send message to Personal through email not to Space ?
This is mainly for logging.
Code snippet for this enhancement:
var r = await teams.ListSpaces();
// For example, "GET /v1/rooms HTTP/1.1 - OK" is output to log.
Log.Info("{0} - {1}", r.RequestLine, r.HttpStatusCode);
Auto refresh OAuth2 access token if the token is expired.
For logging in apps,
it is better that there are consistent Guid per request even there are retries.
Code snippet for this enhancement:
// RetryExecutor.One requests with 1 time retry at most.
var result = await RetryExecutor.One.ListAsync(
() =>
{
// This function will be executed again if needed.
return teams.ListSpacesAsync();
},
(r, retryCount) =>
{
// This function will be executed before evry retry request.
// You can output logs or other things at this point.
Log.Info("Retry is required: delta = {0}, counter = {1}, guid = {2}", r.RetryAfter.Delta, retryCount, r.Guid);
// Return 'true' when you want to proceed retry.
return true;
}
);
// the Guid is the same as logging on a retry.
Log.Info("guid = {0}",result.Guid);
Provide json deserialization error info for TeamsObject
.
Enhancement to post Adaptive cards.
Implement features for Devices, Places and xAPI.
Add Meetings, Recordings, MeetingInvitees and MeetingPreferences.
Do you have any example on how to use this API with the Cisco oAuth workflow?
Feature to customize datetime format on serializing to json text.
For now, TeamsResultInfo.IsSuccessStatus
is checked first in Unit test cases.
It will be better to check TeamsResultInfo.HttpStatusCode
first.
phoneNumbers propertie for Person info.
Features to encrypt and/or decrypt TeamsData again and again.
Especially for token related data.
Code sinipped(may be changed):
using(var ltdp = TeamsLocalDataProtect.Create())
{
var encrypted = ltdp.Encrypt(teamsdata);
// some stream ops.
await ltdp.WriteToStreamAsync(stream);
}
using(var ptdp = TeamsPBEDataProtect.Create())
{
var encrypted = ptdp.Encrypt(teamsdata);
// some stream ops.
await ptdp.WriteToStreamAsync(stream);
}
Feature to get SpaceMeetingInfo(Room meeting info).
Add PersonStatus static field for call, meeting, presenting, pending status.
Supoort for new properties:
SpaceMemberships.SpaceType
for roomType
in Memberships.
SpaceMemberships.IsSpaceHidden
for isRoomHidden
in Memberships.
Person.LastModified
for lastModified
in People.
Currently, retry feature works per request.
For easy use, it is better that the feature works per Teams API Client.
Code snippet for this enhancement:
var teams = TeamsAPI.CreateVersion1Client(token, RetryExecutor.One);
// This request will be invoked with retry option.
var r = await teams.ListSpaces();
An enhancement to get ContentLength info of request/response.
It will be a hint when AdaptiveCards attachment was attached and got size exceeded error.
An enhancement to get Current page index in paging.
If a large file(example, 2 GB or 4 GB) will be downloaded, CopyFileDataToStreamAsync() throws OutOfMemoryException.
In this issue,
HttpClient.SendAsync(request)
throws OutOfMemoryException after retrieving large Content-Length header value.
To use HttpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead)
and stream download will avoid the exception.
For now paging feature is supported by enumerating TeamsListResult
:
// Gets Enumerator to list all the Group spaces.
var e = (await teams.ListSpacesAsync(
type: SpaceType.Group,
max: 50)
).GetListResultEnumerator();
// Iterates until getting all the spaces.
while (await e.MoveNextAsync())
{
var r = e.CurrentResult;
if (r.IsSuccessStatus && r.Data.HasItems)
{
// Each result has space list.
foreach (var space in r.Data.Items)
{
// Say "Hello" to the specific named space.
if (space.Title == "Demo space for Webex Teams API Client(Thrzn41.WebexTeams)")
{
await teams.CreateMessageAsync(space, "Hello, Webex Teams!!");
}
}
}
}
To avoid nested while of for/foreach loop
, it will be better there is enumeration feature of TeamsResult
:
// Gets Enumerator to list all the Group spaces.
var e = (await teams.ListSpacesAsync(
type: SpaceType.Group,
max: 50)
).GetResultEnumerator();
// Iterates until getting all the spaces.
while (await e.MoveNextAsync())
{
var r = e.CurrentResult;
if (r.IsSuccessStatus)
{
var space = r.Data;
// Say "Hello" to the specific named space.
if (space.Title == "Demo space for Webex Teams API Client(Thrzn41.WebexTeams)")
{
await teams.CreateMessageAsync(space, "Hello, Webex Teams!!");
}
}
}
Supports for .NET Core 3.0 and .NET Framework 4.8.
DetectPersonIdType() throws Exception in case of personId == null.
If personId == null, the default type should be returned.
Add call control feature for Webex calling.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.