jdolitsky / appdotnetphp Goto Github PK
View Code? Open in Web Editor NEWPHP library for the App.net Stream API
PHP library for the App.net Stream API
//todo describe
public function getUserUnifiedStream($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/stream/unified?'.$this->buildQueryString($params));
}
//todo describe
public function interactions($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/me/interactions?'.$this->buildQueryString($params));
}
I thought that you had added these... anyway I hacked these together but I am getting inconsistent results with Unmute... maybe it needs curl magic.
Cheers
// Mute user
function muteUser($user_id=null) {
return $this->httpPost($this->_baseUrl.'users/'.$user_id.'/mute');
}
//Unmute user
function unmuteUser($user_id=null) {
return $this->httpDelete($this->_baseUrl.'users/'.$user_id.'/unmute');
}
//List Muted
// Returns an array of User objects for users following the specified user.
function getMuted($user_id='me',$count=20,$before_id=null,$since_id=null) {
return $this->httpGet($this->_baseUrl.'users/'.$user_id.'/muted?count='.$count.'&before_id='.$before_id.'&since_id='.$since_id);
}
Any plans to update the lib to support passing the new @mentions flag and the other post options not implemented? I can do it but if someone else can that's good too. Thinking there will be a few API updates this week.
Follow seems to be working but unfollowUser is throwing 404 errors most of the time.. but sometimes I think it gets though. The url and user id(s) look ok.
So I was trying to get Following / Follower pagination working but I think I am confused on how the migration works.
How do I enable the migration(s) .. an example?
The lib needs this update (I think..) (parms)
/**
/**
May or may not be an issue with urls getting cut off, maybe not...
getSession()) { $app -> createPost('This is a test message with a url http://appeio,com?v=post&p=555',null); } ?>Is there currently an API method I am not seeing or undocumented that makes it available to get a User ID from the Username? I don't really want to expose the id for internal app links.
Is this code published under a free license? Which license is it?
Would love to re-use the code but would need at least a BSD compatible license to do so.
Currently, getAccessToken() assumes that the call to access_token always returns a valid token. However, if the code has expired, has been used before, is incorrect or in a range of other cases, an error is returned instead.
I'm using some of the basic code on the readme as well as the core appdotnet.php files.
It keeps going through a redirect loop. It looks as though the function setSession is never actually called, however. So the cookies don't get set and thus the loop is created. I'll see if I can fix this and put in a PR.
It would be great if the user's username was set (either in GLOBAL, _SESSION, or in the cookie).
That makes it easier to spot if a post is a reply, can be deleted, etc.
The getRateLimitRemaining()
and associated functions don't seem to work.
Also need to add getScope.
I'm opening a stream using the ConsumeStream functions, however as soon as it goes 'quiet', i.e. no data is coming through, ADN servers respond every 60 seconds with:
HTTP/1.1 200 OKServer: nginx/1.2.6Date: Mon, 11 Mar 2013 21:29:27 GMTContent-Type: text/html; charset=UTF-8Transfer-Encoding: chunkedConnection: keep-alive
As soon as the class receives this, no new data will come through. I can see ADN objects coming through previous to this message, and can post them myself, but they instantly stop as soon as the keep-alive arrives.
How can we fix this issue?
$ok = $app->createFile($file, array('metadata' => 'file.type'); leaves me with nothing in $ok
$ok2 = $app->getLastResponse(); called afterwards clearly shows expected return data with file id and token.
Has anyone else seen this?
/**
* Star a post
* @param integer $post_id The post ID to star
*/
public function starPost($post_id=null) {
return $this->httpPost($this->_baseUrl.'posts/'.urlencode($post_id).'/star');
}
/**
* Unstar a post
* @param integer $post_id The user ID to unstar
*/
public function unstarPost($post_id=null) {
return $this->httpDelete($this->_baseUrl.'posts/'.urlencode($post_id).'/star');
}
/**
* List the posts started by the current user
* @return array An array of associative arrays, each representing one starred post.
*/
public function getStarred($user_id=null) {
return $this->httpGet($this->_baseUrl.'users/'.$user_id.'/stars');
}
Hi,
Can you show a working example for posting a new message / reply to app.net? I have tried.. but have only gotten 401 unauthorized back. I think I am missing something as I can read streams and login. http://appeio.com
Cheers,
Harold
On createFile(), I get:
Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in AppDotNet.php on line 397
any one have any problems with me converting the files over to using 2 space for indentation instead of tabs?
Was getting errors
Notice: Undefined variable: redirectUri in /EZAppDotNet.php on line 48
Notice: Undefined variable: scope in /EZAppDotNet.php on line 48
Here's the diff, not sure of the best way to submit it
$ diff AppDotNet.php ~/git/AppDotNetPHP/AppDotNet.php
79d78
< global $app_redirectUri;
89c88
< 'redirect_uri'=>$app_redirectUri,
---
> 'redirect_uri'=>$this->_redirectUri,
$ diff EZAppDotNet.php ~/git/AppDotNetPHP/EZAppDotNet.php
34c34
< global $app_redirectUri,$app_scope;
---
>
48c48
< parent::__construct($clientId,$clientSecret,$app_redirectUri,$app_scope);
---
> parent::__construct($clientId,$clientSecret,$redirectUri,$scope);
60c60
< return parent::getAuthUrl($redirectUri);
---
> return parent::getAuthUrl();
The $pm variable is not declared in this scope, and given that the function may not be used to create a PM channel, the ternary clause is unnecessary.
return $this->httpReq('post',$this->_baseUrl.'channels'.($pm?'/pm/messsages':''), $json, 'application/json');
With this version, however:
return $this->httpReq('post',$this->_baseUrl.'channels', $json, 'application/json');
with this data object:
{"type":"ca.roaringsky.group","writers":{"immutable":"0","public":"0","user_ids":"10403","73417"]}}
the call fails to complete. Suggestions?
Hi,
I am right now going to learn how to properly do a pull request so I can do this properly but in case I fail..
I've been trying to get back in line with AppDotNetPHP proper before the Streaming stuff but I've made a couple of small changes since last syncing up.
Mostly I added two functions:
getId, which is an API supported way to get an ID (user object) when you only know the username.
getTokenStream, this is a way to pass in a token other than the authed users to get a different stream.
This was in order to make @teawithcarls "View Accounts" work with Appeio. In order to get this to work I also had to changed httpReq slightly. I realize this is a bit specific but not too bad..
I think that's the only diffs.
Trying out SmartGit and some other softwares.
issue raised by @hxf148
https://github.com/jdolitsky/AppDotNetPHP/blob/master/AppDotNet.php#L360
Currently getting the global stream when it should be getting
https://alpha-api.app.net/stream/0/posts/stream
Line 412: missing a ? mark.
return $this->httpGet($this->_baseUrl.'users/'.$user_id.'/followers'.http_build_query($params));
should be
return $this->httpGet($this->_baseUrl.'users/'.$user_id.'/followers?'.http_build_query($params));
I'm following the instructions in the readme for AppDotNet.php auth. The first part works fine. But when I approve the app and it returns to my callback URL, $_GET['code']
is set but both $token
and $user
are NULL.
Hi,
Can you or anyone confirm that getPost works? I get an internal error?
I'll send you in my changes to AppDotNetPHP asap. It's a bit of a mess right now.
Hey guys,
I know there have been some exchanges on this but what can we do to implement solid cookie session setting support into the library directly? Before I go off and try to hack something together maybe better expertise can do it and help make it standard for apps using this lib.
Cheers,
Harold
Thinking about this. Maybe AppDotNet class should be straight dumb calls and EZ should a smarter wrapper that makes the API easier to deal with. This would give the advantage if you already knew/want to the learn the ADN API you can use straight AppDotNet and anything specific to our upgrade would be in EZ.
This would revert the change to getFile and getFiles to make them 2 different web calls but then EZ would have a function that takes one or more IDs and be smarted enough to make the appropriate backend call.
(vs being hardcoded)
This is mostly a note for myself, but if someone else wants to do it first, cheers! :)
At the moment, the default scope is to get everything
$scope=array('stream','email','write_post','follow','messages','export')) {
I don't disagree with that, but I think it should be moved into EZsettings, so that developers don't overlook it. I've already been burned by someone complaining that I wanted their email.
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.