Get call/video chat length and members - slack-api

Is there a way to get the length of a slack call from the API? In the app, I can see a call lasted 15 minutes but the API response for calls does not seem to include a time length. We are using the conversations.history endpoint with a user oauth token. We've tried pulling a call up both from a larger list or asking for the call's conversation message by it's timestamp value. Here is an example of a phone call as returned by the Slack API:
0 => JoliCode\Slack\Api\Model\ObjsMessage^ {#2054
#attachments: null
#blocks: null
#botId: null
#clientMsgId: null
#comment: null
#displayAsBot: null
#file: null
#files: null
#icons: null
#inviter: null
#isDelayedMessage: null
#isIntro: null
#isStarred: null
#lastRead: null
#latestReply: null
#name: null
#oldName: null
#parentUserId: null
#permalink: "https://<snip>.slack.com/call/<snip>"
#pinnedTo: null
#purpose: null
#reactions: null
#replies: null
#replyCount: null
#replyUsers: null
#replyUsersCount: null
#sourceTeam: null
#subscribed: null
#subtype: "sh_room_created"
#team: null
#text: "Started a <https://<snip>.slack.com/call/<snip>|call>."
#threadTs: null
#topic: null
#ts: "1589834349.006000"
#type: "message"
#unreadCount: null
#upload: null
#user: "<snip>"
#userProfile: null
#userTeam: null
#username: null
}

Related

realtime firebase database read data from request

So I'm have 3 collections
1- cases
3- owner (inside cases collection)
2- invitations
in normal senario when user add invitation I check if user that tray this action is owner or not by , take caseId from newDate and uid from auth.uid and compare these data by exist in cases collection
but it's always give me permission denied.
// Any one have cases
"cases":{
".write" : "auth.uid != null"
// Store id of owner only when case created first time
"owner" : {
".write": "!data.exists()"
}
}
//only Owner of case can add invitations
"invitations":{
".write" :"root.child('cases').child(newData.child('caseId').val()).child('owner').child(auth.uid).exists()",
},
the data that I'm sending to invitations collection are
Invitation(
endAt: DateTime.now().add(Duration(days: 1)),
id: invitationId,
caseId: caseId,
);
Edit
When I try replace newData.child('caseId').val() with caseId value as static string value , it's working !!
For whom faced this issue , I was wrong due to I used newDate in parent not child that I will write so i put my rules under "$invitationId" and its' working.
//only Owner of case can add invitations
"invitations":{
"$invitationId":{
".write" :"root.child('cases').child(newData.child('caseId').val()).child('owner').child(auth.uid).exists()",
}
},

Get users that a given user is FOLLOWING (not followers) in LinqToTwitter

How can I get UserId and ScreenName of the users that a given user is FOLLOWING (not followers) in LinqToTwitter?
??
The Twitter API uses the terms follower to mean people who follow a user and friends to mean people that a user follows and LINQ to Twitter continues that approach. So, you would use a Friendship/FriendshipType.FriendsList query, like this:
static async Task FriendsListAsync(TwitterContext twitterCtx)
{
Friendship friendship;
long cursor = -1;
do
{
friendship =
await
(from friend in twitterCtx.Friendship
where friend.Type == FriendshipType.FriendsList &&
friend.ScreenName == "JoeMayo" &&
friend.Cursor == cursor &&
friend.Count == 200
select friend)
.SingleOrDefaultAsync();
if (friendship != null &&
friendship.Users != null &&
friendship.CursorMovement != null)
{
cursor = friendship.CursorMovement.Next;
friendship.Users.ForEach(friend =>
Console.WriteLine(
"ID: {0} Name: {1}",
friend.UserIDResponse, friend.ScreenNameResponse));
}
} while (cursor != 0);
}
This example pages through the results in a do/while loop. Notice that the cursor is set to -1, which starts off the query without a Twitter API cursor. Each query assigns the cursor, which gets the next page of users. In the if block, the first statement reads the friendship.CursorMovement.Next to the get cursor for the next page of users. When the next cursor is 0, you've read all of the followers.
After the query executes, the Users property has a List<User> where you can get user information. This demo prints each member of the list.
One of the things you might run into with large friend lists is that Twitter will return an error for exceeding the rate limit. You'll be able to catch this, in a try/catch block, by catching TwitterQueryException and examining properties for the Rate Limit Exceeded. To minimize rate limit propblems, set count to 200, the max. Otherwise count defaults to 20.
You can download samples and view documentation for this on the LINQ to Twitter Web site.

Silex route interchangeable parameters

Given that I had a route that must accept either the code or the id of the object, is there any way in silex that I can detect which was passed to the route (numeric or not numeric) and then send either one variable or the other?
Eg.
/route/1 -> id for USA on the database
I send $id = 1 and $code = null to the controller
/route/US -> code for USA on the database
I send $id = null and $code = 'US' to the controller
I tried something like this, but it won't work
$apiRoutesV2
->get('/route/{code}{id}', 'controllers.myController:getIndex')
->value('id', null)
->assert('id', '[0-9]+')
->value('code', null)
->assert('code', '[a-zA-Z]+');
If both id and code can be empty, you can make one route with default values:
$app
->get('/route/{code}{id}', 'controllers.myController:getIndex')
->value('id', '')
->assert('id', '[0-9]*')
->value('code', '')
->assert('code', '[a-zA-Z]*');
If one of parameters should be filled add 2 routes:
$app
->get('/route/{id}', 'controllers.myController:getIndex')
->assert('id', '[0-9]+');
$app
->get('/route/{code}', 'controllers.myController:getIndex')
->assert('code', '[a-zA-Z]+');

Twitter StatusId

I am using Linq2Twitter in my ASP.net Web Forms application to return recent user tweets
var tweets = await
(from tweet in ctx.Status
where (
(tweet.Type == StatusType.User)
&& (tweet.ScreenName == screenName)
&& (tweet.ExcludeReplies == true)
&& (tweet.IncludeMyRetweet == false)
&& (tweet.Count == 10)
&& (tweet.RetweetCount < 1)
)
select tweet)
.Take(count)
.ToListAsync();
This seems to work well and I get the expected Json return, but...
When I try and construct a link to the original tweet...
“https://twitter.com/” + ScreenName + “/status/” + data.StatusId
I get a "Sorry, page does not exist error".
Upon investigation it appears that the returned StatusId is incorrect. For example, the returned StatusId is:
500244784682774500
When the actual tweet refers to:
500244784682774528
In other words, in this case, the StatusId seem to be 28 adrift.
Can anyone throw any light on what is happening/what I am doing wrong?
IThanks.
After some debugging I found that the ID returned to the LinqtoTwitter application was correct, the problem occurred either in the JSON converter or in JavaScript itself being unable to handle the unsigned-integer id value.
The solution was to create a simple view model from the returned results (using an extension method against the LinqToTwitter.Status object) and passing that to the client instead of the whole data graph.

Twitter4j streaming api: getRetweetCount returns 0

I am using twitter streaming API with twitter4j (twitter4j-stream-3.0.3.jar) and getting retweet count using getRetweetCount. But it always returns 0.
Anything wrong ?
You need to use status.getRetweetedStatus().getRetweetCount()
In order to prevent error you should check null before assign it to a value:
val retweetCount = if (tweet.getRetweetedStatus != null) tweet.getRetweetedStatus.getRetweetCount else 0

Resources