This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
24 |
25 | Link toNon-frame version.
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/docs/print.css:
--------------------------------------------------------------------------------
1 | /*
2 | ////////////////////////////////////////////////////////////////////////////////
3 | //
4 | // ADOBE SYSTEMS INCORPORATED
5 | // Copyright 2005-2007 Adobe Systems Incorporated
6 | // All Rights Reserved.
7 | //
8 | // NOTICE: Adobe permits you to use, modify, and distribute this file
9 | // in accordance with the terms of the license agreement accompanying it.
10 | //
11 | ////////////////////////////////////////////////////////////////////////////////
12 | */
13 |
14 | body {
15 | color: #000000;
16 | background: #ffffff;
17 | font-family: "Times New Roman", Times, serif;
18 | font-size: 12pt;
19 | }
20 | a {
21 | text-decoration: none;
22 | color: #000000;
23 | }
24 | pre {
25 | white-space: -moz-pre-wrap; /* Mozilla */
26 | white-space: -pre-wrap; /* Opera 4-6 */
27 | white-space: -o-pre-wrap; /* Opera 7 */
28 | word-wrap: break-word; /* IE */
29 | }
30 | .titleTableTopNav, .titleTableSubNav, .logoImage {
31 | display: none;
32 | }
33 | .packageFrame {
34 | display: none;
35 | }
36 | .titleTableSubTitle {
37 | font-weight: bold;
38 | }
39 | .classHeaderTableLabel {
40 | padding-right: 10px;
41 | vertical-align: top;
42 | }
43 | .showHideLinks {
44 | display: none;
45 | }
46 | html>body code {
47 | font-size: 10pt;
48 | }
49 | .summaryTableTitle, .detailSectionHeader {
50 | font-size: 14pt;
51 | font-weight: bold;
52 | padding-top: 15px;
53 | padding-bottom: 5px;
54 | }
55 | .summaryTable {
56 | border: 1px solid #000000;
57 | border-collapse: collapse;
58 | width: 100%;
59 | }
60 | .summaryTableDescription {
61 | padding-bottom: 20px;
62 | }
63 | .summaryTableSignatureCol, .summaryTableOwnerCol, .summaryTableLastCol, .summaryTableCol {
64 | border: 1px solid #000000;
65 | }
66 | .summaryTablePaddingCol {
67 | border: 1px solid #000000;
68 | border-right: 0px;
69 | }
70 | .summaryTableInheritanceCol, .summaryTableOperatorCol, .summaryTableStatementCol, .summaryTableSecondCol {
71 | border: 1px solid #000000;
72 | border-left: 0px;
73 | }
74 | .summaryTableLastCol {
75 | vertical-align: top;
76 | }
77 | .detailHeader {
78 | font-size: 13pt;
79 | padding-top: 100px;
80 | }
81 | .detailHeaderName {
82 | font-weight: bold;
83 | }
84 | .detailHeaderType {
85 | padding-left: 5px;
86 | }
87 | .detailHeaderRule {
88 | background: #FF0000;
89 | }
90 | .seeAlso {
91 | padding-bottom: 20px;
92 | margin-top: -20px;
93 | }
94 | .innertable {
95 | border-collapse: collapse;
96 | }
97 | .innertable td,.innertable th {
98 | border: 1px solid #000000;
99 | padding-left: 5px;
100 | padding-right: 5px;
101 | }
102 | .listing {
103 | font-size: 10pt;
104 | }
105 | .feedbackLink {
106 | display: none;
107 | }
108 | .copyright {
109 | font-size: 10pt;
110 | }
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex3/.actionScriptProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex3/.flexProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex3/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TwitterAIRDemo
4 |
5 |
6 |
7 |
8 |
9 | com.adobe.flexbuilder.project.flexbuilder
10 |
11 |
12 |
13 |
14 | com.adobe.flexbuilder.project.apollobuilder
15 |
16 |
17 |
18 |
19 |
20 | com.adobe.flexbuilder.project.apollonature
21 | com.adobe.flexbuilder.project.flexnature
22 | com.adobe.flexbuilder.project.actionscriptnature
23 |
24 |
25 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex3/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | #Thu Mar 18 12:13:42 NOVT 2010
2 | eclipse.preferences.version=1
3 | encoding/=utf-8
4 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex3/libs/TwitterAPI_v1.2.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bigosmallm/twitter-actionscript-api/3935242292b37cb7c1c0fecf128b123d5a92ab81/examples/TwitterAirDemo_Flex3/libs/TwitterAPI_v1.2.swc
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex4.5/.actionScriptProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex4.5/.flexProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex4.5/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TwitterAirDemo_Flex4.5
4 |
5 |
6 |
7 |
8 |
9 | com.adobe.flexbuilder.project.flexbuilder
10 |
11 |
12 |
13 |
14 | com.adobe.flexbuilder.project.apollobuilder
15 |
16 |
17 |
18 |
19 |
20 | com.adobe.flexbuilder.project.apollonature
21 | com.adobe.flexbuilder.project.flexnature
22 | com.adobe.flexbuilder.project.actionscriptnature
23 |
24 |
25 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex4.5/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | #Sun Mar 27 00:01:43 NOVT 2011
2 | eclipse.preferences.version=1
3 | encoding/=utf-8
4 |
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex4.5/libs/TwitterAPI.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bigosmallm/twitter-actionscript-api/3935242292b37cb7c1c0fecf128b123d5a92ab81/examples/TwitterAirDemo_Flex4.5/libs/TwitterAPI.swc
--------------------------------------------------------------------------------
/examples/TwitterAirDemo_Flex4.5/src/TweetItemRenderer.mxml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
24 |
27 |
30 |
31 |
32 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/library/TwitterAPI/.actionScriptProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/library/TwitterAPI/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TwitterAPI
4 |
5 |
6 |
7 |
8 |
9 | com.adobe.flexbuilder.project.flexbuilder
10 |
11 |
12 |
13 |
14 |
15 | com.adobe.flexbuilder.project.flexlibnature
16 | com.adobe.flexbuilder.project.actionscriptnature
17 |
18 |
19 |
--------------------------------------------------------------------------------
/library/TwitterAPI/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | #Tue Dec 08 16:27:12 NOVT 2009
2 | eclipse.preferences.version=1
3 | encoding/=utf-8
4 |
--------------------------------------------------------------------------------
/library/TwitterAPI/libs/Crypto.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bigosmallm/twitter-actionscript-api/3935242292b37cb7c1c0fecf128b123d5a92ab81/library/TwitterAPI/libs/Crypto.swc
--------------------------------------------------------------------------------
/library/TwitterAPI/libs/as3corelib.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bigosmallm/twitter-actionscript-api/3935242292b37cb7c1c0fecf128b123d5a92ab81/library/TwitterAPI/libs/as3corelib.swc
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/Operation.as:
--------------------------------------------------------------------------------
1 | /** Operation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Copyright (c) 2009.
6 | */
7 | package com.dborisenko.api
8 | {
9 | import com.dborisenko.api.interfaces.IOperation;
10 |
11 | import flash.events.EventDispatcher;
12 |
13 | import mx.rpc.IResponder;
14 |
15 | /**
16 | * Base Operation class.
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public class Operation extends EventDispatcher implements IResponder, IOperation
21 | {
22 | public function execute():void {}
23 |
24 | public function result(data:Object):void {}
25 | public function fault(info:Object):void {}
26 | }
27 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/delegates/IServiceDelegate.as:
--------------------------------------------------------------------------------
1 | /** IServiceDelegate.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | */
7 | package com.dborisenko.api.delegates
8 | {
9 | import flash.events.IEventDispatcher;
10 |
11 | [Event(name="result",type="mx.rpc.events.ResultEvent")]
12 | [Event(name="fault",type="mx.rpc.events.FaultEvent")]
13 | public interface IServiceDelegate extends IEventDispatcher
14 | {
15 | function get url():String;
16 | function set url(value:String):void;
17 |
18 | function get headers():Object;
19 | function set headers(value:Object):void;
20 |
21 | function get method():String;
22 | function set method(value:String):void;
23 |
24 | function get params():Object;
25 | function set params(value:Object):void;
26 |
27 | function get resultFormat():String;
28 | function set resultFormat(value:String):void;
29 |
30 | function get lastResult():Object;
31 |
32 | function send():void;
33 | }
34 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/enums/ResultFormat.as:
--------------------------------------------------------------------------------
1 | /** ResultFormat.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | */
7 | package com.dborisenko.api.enums
8 | {
9 | public class ResultFormat
10 | {
11 | public static const XML:String = "xml";
12 | public static const JSON:String = "json";
13 | }
14 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/events/DataEvent.as:
--------------------------------------------------------------------------------
1 | /** DataEvent.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Copyright (c) 2009.
6 | */
7 | package com.dborisenko.api.events
8 | {
9 | import flash.events.Event;
10 |
11 | public class DataEvent extends Event
12 | {
13 | public var data:Object;
14 |
15 | public function DataEvent(type:String, data:Object=null, bubbles:Boolean=false, cancelable:Boolean=false)
16 | {
17 | super(type, bubbles, cancelable);
18 | this.data = data;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/events/StatusEvent.as:
--------------------------------------------------------------------------------
1 | /** StatusEvent.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | */
7 | package com.dborisenko.api.events
8 | {
9 | import flash.events.Event;
10 |
11 | public class StatusEvent extends Event
12 | {
13 | public static const STATUS_CHANGE:String = "statusChange";
14 |
15 | public var oldStatus:String;
16 | public var newStatus:String;
17 |
18 | public function StatusEvent(type:String, oldStatus:String, newStatus:String, bubbles:Boolean=false, cancelable:Boolean=false)
19 | {
20 | super(type, bubbles, cancelable);
21 | this.oldStatus = oldStatus;
22 | this.newStatus = newStatus;
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/interfaces/IOperation.as:
--------------------------------------------------------------------------------
1 | /** IOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.interfaces
9 | {
10 | import flash.events.IEventDispatcher;
11 |
12 | public interface IOperation extends IEventDispatcher
13 | {
14 | function execute():void;
15 | }
16 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/account/RateLimitStatus.as:
--------------------------------------------------------------------------------
1 | /** RateLimitStatus.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.account
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.data.TwitterRateLimit;
12 | import com.dborisenko.api.twitter.net.HashOperation;
13 |
14 | import flash.events.Event;
15 | import flash.utils.Dictionary;
16 |
17 | /**
18 | * Returns the remaining number of API requests available to the requesting user before the API limit is reached
19 | * for the current hour. Calls to rate_limit_status do not count against the rate limit. If authentication
20 | * credentials are provided, the rate limit status for the authenticating user is returned. Otherwise, the
21 | * rate limit status for the requester's IP address is returned.
22 | * Learn more about the REST API rate limiting here:
23 | * http://apiwiki.twitter.com/Rate-limiting
24 | *
25 | * @author Denis Borisenko
26 | * @see http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0rate_limit_status
27 | * @see http://apiwiki.twitter.com/Rate-limiting
28 | */
29 | public class RateLimitStatus extends HashOperation
30 | {
31 | /**
32 | * @private
33 | */
34 | protected static const URL:String = "http://api.twitter.com/1.1/account/rate_limit_status.json";
35 |
36 | public function RateLimitStatus()
37 | {
38 | super(URL);
39 | resultFormat = ResultFormat.JSON;
40 | method = METHOD_GET;
41 | _requiresAuthentication = true;
42 | _apiRateLimited = false;
43 | }
44 |
45 | public function get rateLimit():TwitterRateLimit
46 | {
47 | return data as TwitterRateLimit;
48 | }
49 | public function set rateLimit(value:TwitterRateLimit):void
50 | {
51 | data = value;
52 | }
53 |
54 | /**
55 | *
56 | * @private
57 | *
58 | */
59 | override protected function handleResult(event:Event) : void
60 | {
61 | var json:Object = getJSON();
62 | rateLimit = new TwitterRateLimit(json);
63 | super.handleResult(event);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/account/VerifyCredentials.as:
--------------------------------------------------------------------------------
1 | /** VerifyCredentials.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.account
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UserOperation;
12 |
13 | /**
14 | * Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful;
15 | * returns a 401 status code and an error message if not.
16 | * Use this method to test if supplied user credentials are valid.
17 | *
18 | * @author Denis Borisenko
19 | * @see https://dev.twitter.com/docs/api/1/get/account/verify_credentials
20 | */
21 | public class VerifyCredentials extends UserOperation
22 | {
23 | /**
24 | * @private
25 | *
26 | * @param entities Optional. Whether or not to include tweet entities in the response status.
27 | *
28 | * @param skipStatus Optional. Whether or not to skip the status in the user response.
29 | *
30 | */
31 | protected static const URL:String = "http://api.twitter.com/1.1/account/verify_credentials.json";
32 |
33 | public function VerifyCredentials(entities:Boolean = true, skipStatus:Boolean = false)
34 | {
35 | super(URL);
36 | resultFormat = ResultFormat.JSON;
37 | method = METHOD_GET;
38 | _requiresAuthentication = true;
39 | _apiRateLimited = false;
40 | this.parameters = {include_entities:entities, skip_status:skipStatus};
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/block/CreateBlock.as:
--------------------------------------------------------------------------------
1 | /** CreateBlock.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.block
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UserOperation;
12 |
13 | /**
14 | * Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the
15 | * blocked user if it exists. Returns the blocked user in the requested format when successful.
16 | * You can find out more about blocking in the Twitter Support Knowledge Base:
17 | * http://help.twitter.com/forums/10711/entries/15355
18 | *
19 | * @author Denis Borisenko
20 | * @see https://dev.twitter.com/docs/api/1/post/blocks/create
21 | * @see http://help.twitter.com/forums/10711/entries/15355
22 | */
23 | public class CreateBlock extends UserOperation
24 | {
25 | /**
26 | * @private
27 | */
28 | protected static const URL:String = "https://api.twitter.com/1.1/blocks/create.json";
29 |
30 | /**
31 | * One of the following parameters is required
32 | * @param userId Required. Specfies the ID of the potentially blocked user.
33 | * Helpful for disambiguating when a valid user ID is also a valid screen name.
34 | * Example: user_id=1401881
35 | * @param screenName Optional. Specfies the screen name of the potentially blocked user.
36 | * Helpful for disambiguating when a valid screen name is also a user ID.
37 | * Example: screen_name=101010
38 | *
39 | * @param entities Optional. Whether or not to return entities in the response.
40 | *
41 | * @param skip_status Optional. Whether or not to include statuses with the returned user object.
42 | *
43 | */
44 | public function CreateBlock(userId:String, screenName:String = null, entities:Boolean = true, skipStatus:Boolean = false)
45 | {
46 | super(URL);
47 | resultFormat = ResultFormat.JSON;
48 | method = METHOD_POST;
49 | _requiresAuthentication = true;
50 | _apiRateLimited = false;
51 | parameters = {user_id: userId, screen_name: screenName, include_entities:entities, skip_status:skipStatus};
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/block/DestroyBlock.as:
--------------------------------------------------------------------------------
1 | /** DestroyBlock.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.block
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UserOperation;
12 |
13 | /**
14 | * Un-blocks the user specified in the ID parameter for the authenticating user.
15 | * Returns the un-blocked user in the requested format when successful.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/blocks/destroy
19 | */
20 | public class DestroyBlock extends UserOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/blocks/destroy.json";
26 |
27 | /**
28 | * One of the following parameters is required
29 | * @param userId Optional. Specfies the ID of the potentially blocked user.
30 | * Helpful for disambiguating when a valid user ID is also a valid screen name.
31 | * Example: user_id=1401881
32 | * @param screenName Optional. Specfies the screen name of the potentially blocked user.
33 | * Helpful for disambiguating when a valid screen name is also a user ID.
34 | * Example: screen_name=101010
35 | *
36 | * @param entities Optional. Whether or not to return entities in the response.
37 | *
38 | * @param skip_status Optional. Whether or not to include statuses with the returned user object.
39 | *
40 | */
41 | public function DestroyBlock(userId:String, screenName:String = null, entities:Boolean = true, skipStatus:Boolean = false)
42 | {
43 | super(URL);
44 | resultFormat = ResultFormat.JSON;
45 | method = METHOD_POST;
46 | _requiresAuthentication = true;
47 | _apiRateLimited = false;
48 | parameters = {user_id: userId, screen_name: screenName, include_entities:entities, skip_status:skipStatus};
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/block/LoadBlockedUsers.as:
--------------------------------------------------------------------------------
1 | /** LoadBlockedUsers.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.block
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UsersOperation;
12 |
13 | /**
14 | * Returns an array of user objects that the authenticating user is blocking.
15 | *
16 | * @author Denis Borisenko
17 | * @see https://dev.twitter.com/docs/api/1/get/blocks/blocking
18 | */
19 | public class LoadBlockedUsers extends UsersOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "http://api.twitter.com/1.1/blocks/blocking.json";
25 |
26 | /**
27 | *
28 | * @param page Optional. Specifies the page number of the results beginning at 1.
29 | * A single page contains 20 ids.
30 | * Example: page=1
31 | *
32 | * @param perPage Optional. Number of results per page. Docs don't specify a limit...
33 | *
34 | * @param entities Optional. Whether or not to include entities in response.
35 | *
36 | * @param skipStatus Optional. Whether or not to skip user statuses in response.
37 | *
38 | *
39 | *
40 | */
41 | public function LoadBlockedUsers(page:int = -1, perPage:int = 20, entities:Boolean = true, skipStatus:Boolean = false)
42 | {
43 | super(URL, false, true);
44 | resultFormat = ResultFormat.JSON;
45 | method = METHOD_GET;
46 | _requiresAuthentication = true;
47 | _apiRateLimited = true;
48 | parameters = {page: page, per_page:perPage, include_entities:entities, skip_status:skipStatus};
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/directMessage/DestroyDirectMessage.as:
--------------------------------------------------------------------------------
1 | /** DestroyDirectMessage.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.directMessage
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.DirectMessageOperation;
12 |
13 | /**
14 | * Destroys the direct message specified in the required ID parameter.
15 | * The authenticating user must be the recipient of the specified direct message.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/direct_messages/destroy/%3Aid
19 | */
20 | public class DestroyDirectMessage extends DirectMessageOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "http://api.twitter.com/1.1/direct_messages/destroy/{id}.json";
26 |
27 | /**
28 | *
29 | * @param id Required. The ID of the direct message to destroy.
30 | *
31 | * @param entities Optional. Returns entity metadata in the destroyed tweet body.
32 | */
33 | public function DestroyDirectMessage(id:String, entities:Boolean = true)
34 | {
35 | super(URL.replace(/\{id\}/gi, id));
36 | resultFormat = ResultFormat.JSON;
37 | method = METHOD_POST;
38 | _requiresAuthentication = true;
39 | _apiRateLimited = false;
40 | parameters = {id: id, include_entities:entities};
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/directMessage/LoadDirectMessages.as:
--------------------------------------------------------------------------------
1 | /** LoadDirectMessages.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.directMessage
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.DirectMessagesOperation;
12 |
13 | /**
14 | * Returns a list of the 20 most recent direct messages sent to the authenticating user.
15 | * The XML and JSON versions include detailed information about the sending and recipient users.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/get/direct_messages
19 | */
20 | public class LoadDirectMessages extends DirectMessagesOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/direct_messages.json";
26 |
27 | /**
28 | *
29 | * @param sinceId Optional. Returns only direct messages with an ID greater than
30 | * (that is, more recent than) the specified ID.
31 | * Example: since_id=12345
32 | * @param maxId Optional.Returns only statuses with an ID less than (that is, older than)
33 | * or equal to the specified ID.
34 | * Example: max_id=54321
35 | * @param count Optional. Specifies the number of statuses to retrieve. May not be greater than 200.
36 | * Example: count=200
37 | *
38 | * @param entities Optional. Whether or not to include entities in the response.
39 | *
40 | * @param skipStatus Optional. Whether or not to return statuses within the user objects.
41 | *
42 | * Though it doesn't say so in the documentation, I believe 'page' has been deprecated everywhere and so I'll remove it here.
43 | *
44 | */
45 | public function LoadDirectMessages(sinceId:String = null, maxId:String = null, count:int = -1,
46 | entities:Boolean = true, skipStatus:Boolean = false)
47 | {
48 | super(URL);
49 | resultFormat = ResultFormat.JSON;
50 | method = METHOD_GET;
51 | _requiresAuthentication = true;
52 | _apiRateLimited = true;
53 | parameters = {since_id: sinceId, max_id: maxId, count: count, include_entities:entities, skip_status:skipStatus};
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/directMessage/LoadSentDirectMessages.as:
--------------------------------------------------------------------------------
1 | /** LoadSentDirectMessages.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.directMessage
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.DirectMessagesOperation;
12 |
13 | /**
14 | * Returns a list of the 20 most recent direct messages sent by the authenticating user.
15 | * The XML and JSON versions include detailed information about the sending and recipient users.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/get/direct_messages/sent
19 | */
20 | public class LoadSentDirectMessages extends DirectMessagesOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/direct_messages/sent.json";
26 |
27 | /**
28 | *
29 | * @param sinceId Optional. Returns only direct messages with an ID greater than
30 | * (that is, more recent than) the specified ID.
31 | * Example: since_id=12345
32 | * @param maxId Optional. Returns only statuses with an ID less than (that is, older than)
33 | * or equal to the specified ID.
34 | * Example: max_id=54321
35 | * @param count Optional. Specifies the number of direct messages to retrieve. May not be greater than 200.
36 | * Example: count=5
37 | *
38 | * @param entities Optional. Whether or not to include entities in the response statuses.
39 | *
40 | */
41 | public function LoadSentDirectMessages(sinceId:String=null, maxId:String=null, count:int=-1, entities:Boolean = true)
42 | {
43 | super(URL, true);
44 | resultFormat = ResultFormat.JSON;
45 | method = METHOD_GET;
46 | _requiresAuthentication = true;
47 | _apiRateLimited = true;
48 | parameters = {since_id: sinceId, max_id: maxId, count: count, include_entities:entities};
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/directMessage/NewDirectMessage.as:
--------------------------------------------------------------------------------
1 | /** NewDirectMessage.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.directMessage
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.DirectMessageOperation;
12 |
13 | /**
14 | * Sends a new direct message to the specified user from the authenticating user.
15 | * Requires both the user and text parameters. Request must be a POST.
16 | * Returns the sent message in the requested format when successful.
17 | *
18 | * @author Denis Borisenko
19 | * @see https://dev.twitter.com/docs/api/1/post/direct_messages/new
20 | */
21 | public class NewDirectMessage extends DirectMessageOperation
22 | {
23 | /**
24 | * @private
25 | */
26 | protected static const URL:String = "https://api.twitter.com/1.1/direct_messages/new.json";
27 |
28 | /**
29 | * One of either the userId or the screenName must be sent.
30 | *
31 | * @param userId Optional. The Id of the User to send the tweet to.
32 | *
33 | * @param screenName Optional. The screen name of the User to sent the tweet to.
34 | *
35 | * @param text Required. The text of your direct message. Be sure to URL encode as necessary,
36 | * and keep it under 140 characters.
37 | *
38 | */
39 | public function NewDirectMessage(userId:String = null, screenName:String = null, text:String = "")
40 | {
41 | super(URL, true, null, true);
42 | resultFormat = ResultFormat.JSON;
43 | method = METHOD_POST;
44 | _requiresAuthentication = true;
45 | _apiRateLimited = false;
46 | parameters = { user_id:userId, screen_name: screenName, text: text};
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/favorite/CreateFavorite.as:
--------------------------------------------------------------------------------
1 | /** CreateFavorite.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.favorite
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusOperation;
12 |
13 | /**
14 | * Favorites the status specified in the ID parameter as the authenticating user.
15 | * Returns the favorite status when successful.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/favorites/create/%3Aid
19 | */
20 | public class CreateFavorite extends StatusOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/favorites/create/{id}.json";
26 |
27 | /**
28 | *
29 | * @param id Required. The ID of the status to favorite.
30 | *
31 | * @param entities Optional. Whether or not to return entities with the status.
32 | *
33 | */
34 | public function CreateFavorite(id:String, entities:Boolean = true)
35 | {
36 | super(URL.replace(/\{id\}/gi, id));
37 | resultFormat = ResultFormat.JSON;
38 | method = METHOD_POST;
39 | _requiresAuthentication = true;
40 | _apiRateLimited = false;
41 | parameters = {id: id, include_entities:entities};
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/favorite/DestroyFavorite.as:
--------------------------------------------------------------------------------
1 | /** DestroyFavorite.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.favorite
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusOperation;
12 |
13 | /**
14 | * Un-favorites the status specified in the ID parameter as the authenticating user.
15 | * Returns the un-favorited status in the requested format when successful.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/favorites/destroy/%3Aid
19 | */
20 | public class DestroyFavorite extends StatusOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/favorites/destroy/{id}.json";
26 |
27 | /**
28 | *
29 | * @param id Required. The ID of the status to un-favorite.
30 | *
31 | */
32 | public function DestroyFavorite(id:String)
33 | {
34 | super(URL.replace(/\{id\}/gi, id));
35 | resultFormat = ResultFormat.JSON;
36 | method = METHOD_POST;
37 | _requiresAuthentication = true;
38 | _apiRateLimited = false;
39 | parameters = {id: id};
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/favorite/LoadFavorites.as:
--------------------------------------------------------------------------------
1 | /** LoadFavorites.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.favorite
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusesOperation;
12 |
13 | /**
14 | * Returns the 20 most recent favorite statuses for the authenticating user or user
15 | * specified by the ID parameter in the requested format.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/get/favorites
19 | */
20 | public class LoadFavorites extends StatusesOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/favorites.json";
26 |
27 | /**
28 | *
29 | * @param id Optional. The ID or screen name of the user for whom to request a list of favorite statuses.
30 | * @param page Optional. Specifies the page of favorites to retrieve.
31 | *
32 | */
33 | public function LoadFavorites(userId:String = null, screenName:String = null, count:int = 200, sinceId:String = null,
34 | maxId:String = null, entities:Boolean = true)
35 | {
36 | super(URL);
37 | resultFormat = ResultFormat.JSON;
38 | method = METHOD_GET;
39 | _requiresAuthentication = true;
40 | _apiRateLimited = true;
41 | parameters = {user_id: userId, screen_name:screenName, count:count, since_id:sinceId, max_id:maxId, include_entities:entities};
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/friendship/CreateFriendships.as:
--------------------------------------------------------------------------------
1 | /** CreateFriendships.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.friendship
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UserOperation;
12 |
13 | /**
14 | * Allows the authenticating users to follow the user specified in the ID parameter.
15 | * Returns the befriended user in the requested format when successful.
16 | * Returns a string describing the failure condition when unsuccessful.
17 | * If you are already friends with the user an HTTP 403 will be returned.
18 | *
19 | * @author Denis Borisenko
20 | * @see https://dev.twitter.com/docs/api/1/post/friendships/create
21 | * @see http://apiwiki.twitter.com/HTTP-Response-Codes-and-Errors
22 | */
23 | public class CreateFriendships extends UserOperation
24 | {
25 | /**
26 | * @private
27 | */
28 | protected static const URL:String = "http://api.twitter.com/1.1/friendships/create.json";
29 |
30 | /**
31 | * One of the user_id or screen_name is required
32 | * @param userId Required. Specfies the ID of the user to befriend.
33 | * Helpful for disambiguating when a valid user ID is also a valid screen name.
34 | * Example: user_id=1401881
35 | * @param screenName Required. Specfies the screen name of the user to befriend.
36 | * Helpful for disambiguating when a valid screen name is also a user ID.
37 | * Example: screen_name=101010
38 | * @param follow Optional. Enable notifications for the target user in addition to becoming friends.
39 | * Example: follow=true
40 | *
41 | */
42 | public function CreateFriendships(userId:String = null, screenName:String = null, follow:Boolean = false)
43 | {
44 | super(URL);
45 | resultFormat = ResultFormat.JSON;
46 | method = METHOD_POST;
47 | _requiresAuthentication = true;
48 | _apiRateLimited = false;
49 | parameters = {user_id: userId, screen_name: screenName, follow:follow};
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/friendship/DestroyFriendships.as:
--------------------------------------------------------------------------------
1 | /** DestroyFriendships.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.friendship
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UserOperation;
12 |
13 | /**
14 | * Allows the authenticating users to unfollow the user specified in the ID parameter.
15 | * Returns the unfollowed user in the requested format when successful.
16 | * Returns a string describing the failure condition when unsuccessful.
17 | *
18 | * @author Denis Borisenko
19 | * @see https://dev.twitter.com/docs/api/1/post/friendships/destroy
20 | */
21 | public class DestroyFriendships extends UserOperation
22 | {
23 | /**
24 | * @private
25 | */
26 | protected static const URL:String = "http://api.twitter.com/1.1/friendships/destroy.json";
27 |
28 | /**
29 | * One of userId or screenName is required:
30 | * @param userId Optional. Specfies the ID of the user to unfollow.
31 | * Helpful for disambiguating when a valid user ID is also a valid screen name.
32 | * Example: user_id=1401881
33 | *
34 | * @param screenName Optional. Specfies the screen name of the user to unfollow.
35 | * Helpful for disambiguating when a valid screen name is also a user ID.
36 | * Example: screen_name=101010
37 | *
38 | * @param entities Optional. Whether or not to include entities in the status tweets returned.
39 | *
40 | */
41 | public function DestroyFriendships(userId:String = null, screenName:String = null, entities:Boolean = true)
42 | {
43 | super(URL);
44 | resultFormat = ResultFormat.JSON;
45 | method = METHOD_POST;
46 | _requiresAuthentication = true;
47 | _apiRateLimited = false;
48 | parameters = {user_id: userId, screen_name: screenName, include_entities:entities};
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/list/CreateList.as:
--------------------------------------------------------------------------------
1 | /** CreateList.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.list
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Creates a new list for the authenticated user. Accounts are limited to 20 lists.
15 | *
16 | * @author Denis Borisenko
17 | * @see https://dev.twitter.com/docs/api/1/post/lists/create
18 | */
19 | public class CreateList extends ListOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "https://api.twitter.com/1.1/lists/create.json";
25 |
26 | /**
27 | *
28 | * @param name Required. The name of the list you are creating.
29 | * @param mode Optional. Whether your list is public or private.
30 | * Values can be public or private. Lists are public by default if no mode is specified.
31 | * @param description Optional. The description of the list you are creating.
32 | *
33 | */
34 | public function CreateList(name:String, mode:String = null, description:String = null)
35 | {
36 | super(URL);
37 | resultFormat = ResultFormat.JSON;
38 | method = METHOD_POST;
39 | _requiresAuthentication = true;
40 | _apiRateLimited = false;
41 | parameters = {name: name, mode: mode, description: description};
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/list/DestroyList.as:
--------------------------------------------------------------------------------
1 | /** DestroyList.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.list
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Deletes the specified list. Must be owned by the authenticated user.
15 | *
16 | * @author Denis Borisenko
17 | * @see https://dev.twitter.com/docs/api/1/post/lists/destroy
18 | */
19 | public class DestroyList extends ListOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "https://api.twitter.com/1.1/lists/destroy.json";
25 |
26 | /**
27 | * Requires either a listId or a slug. If using the slug, you must pass either the ownerId or the ownerScreenName as well.
28 | *
29 | * @param listId Optional. The id or slug of the list.
30 | * @param slug Optional. The slug of the list.
31 | * @param ownerId Optional. The id of the Owner. needed if using a slug instead of a listId.
32 | * @param ownerScreenName Optional. The owner of the list. Needed if using slug instead of listId.
33 | *
34 | */
35 | public function DestroyList(listId:String = null, slug:String = null, ownerId:String = null, ownerScreenName:String = null)
36 | {
37 | super(URL);
38 | resultFormat = ResultFormat.JSON;
39 | method = METHOD_DELETE;
40 | _requiresAuthentication = true;
41 | _apiRateLimited = false;
42 |
43 | this.parameters = {list_id:listId, slug:slug, owner_id:ownerId, owner_screen_name:ownerScreenName};
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/list/LoadListSubscriptions.as:
--------------------------------------------------------------------------------
1 | /** GetListSubscriptions.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.list
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.interfaces.IPagingOperation;
12 | import com.dborisenko.api.twitter.net.ListsOperation;
13 |
14 | /**
15 | * List the lists the specified user follows.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/get/lists/subscriptions
19 | */
20 | public class LoadListSubscriptions extends ListsOperation implements IPagingOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/lists/memberships.json";
26 |
27 | /**
28 | *
29 | * @param userId Optional. The id of the user for whom to return results for. If blank, defaults to authenticated user.
30 | *
31 | * @param screenName Optional. The screen name of the whom to return results for. If blank, defaults to authenticated user.
32 | *
33 | * @param count Optional. the amount of results per page. Defaults to 20, maximum of 1,000.
34 | *
35 | * @param cursor Optional. Breaks the results into pages. A single page contains 20 lists.
36 | * Provide a value of -1 to begin paging. Provide values as returned to in the response
37 | * body's next_cursor and previous_cursor attributes to page back and forth in the list.
38 | * Example: cursor=-1
39 | * Example: cursor=-1300794057949944903
40 | *
41 | *
42 | *
43 | */
44 | public function LoadListSubscriptions(userId:String = null, screenName:String = null, count:int = -1, cursor:String="-1")
45 | {
46 | super(URL);
47 | resultFormat = ResultFormat.JSON;
48 | method = METHOD_GET;
49 | _requiresAuthentication = true;
50 | _apiRateLimited = true;
51 | parameters = {user_id:userId, screen_name:screenName, cursor: cursor};
52 | }
53 |
54 | /**
55 | *
56 | * Optional. Breaks the results into pages. A single page contains 20 lists.
57 | * Provide a value of -1 to begin paging. Provide values as returned to in the response
58 | * body's next_cursor and previous_cursor attributes to page back and forth in the list.
59 | * Example: cursor=-1
60 | * Example: cursor=-1300794057949944903
61 | *
62 | */
63 | public function get cursor():String
64 | {
65 | return parameters["cursor"];
66 | }
67 | public function set cursor(value:String):void
68 | {
69 | if (value)
70 | {
71 | parameters["cursor"] = value;
72 | }
73 | else if (parameters["cursor"])
74 | {
75 | delete parameters["cursor"];
76 | }
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/list/LoadListsOfUser.as:
--------------------------------------------------------------------------------
1 | /** LoadListsOfUser.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.list
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.interfaces.IPagingOperation;
12 | import com.dborisenko.api.twitter.net.ListsOperation;
13 |
14 | /**
15 | * List the lists of the specified user.
16 | * Private lists will be included if the authenticated user is the same as the user whose lists are being returned.
17 | *
18 | * @author Denis Borisenko
19 | * @see https://dev.twitter.com/docs/api/1/get/lists
20 | */
21 | public class LoadListsOfUser extends ListsOperation implements IPagingOperation
22 | {
23 | /**
24 | * @private
25 | */
26 | protected static const URL:String = "https://api.twitter.com/1.1/lists.json";
27 |
28 | /**
29 | *
30 | * Either screenName or userId is required.
31 | *
32 | * @param userId Optional. The ID of the user for whom to return results for.
33 | *
34 | * @param screenName Optional. The screen name of the user for whom to return results for.
35 | *
36 | * @param cursor Optional. Breaks the results into pages. A single page contains 20 lists.
37 | * Provide a value of -1 to begin paging. Provide values as returned to in the
38 | * response body's next_cursor and previous_cursor attributes to page back and forth
39 | * in the list.
40 | * Example: cursor=-1
41 | * Example: cursor=-1300794057949944903
42 | *
43 | */
44 | public function LoadListsOfUser(userId:String = null, screenName:String = null, cursor:String = "-1")
45 | {
46 | super(URL);
47 | resultFormat = ResultFormat.JSON;
48 | method = METHOD_GET;
49 | _requiresAuthentication = true;
50 | _apiRateLimited = true;
51 | parameters = {user_id:userId, screen_name:screenName, cursor: cursor};
52 | }
53 |
54 | /**
55 | *
56 | * Optional. Breaks the results into pages. A single page contains 20 lists.
57 | * Provide a value of -1 to begin paging. Provide values as returned to in the
58 | * response body's next_cursor and previous_cursor attributes to page back and forth
59 | * in the list.
60 | * Example: cursor=-1
61 | * Example: cursor=-1300794057949944903
62 | *
63 | */
64 | public function get cursor():String
65 | {
66 | return parameters["cursor"];
67 | }
68 | public function set cursor(value:String):void
69 | {
70 | if (value)
71 | {
72 | parameters["cursor"] = value;
73 | }
74 | else if (parameters["cursor"])
75 | {
76 | delete parameters["cursor"];
77 | }
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/list/ShowList.as:
--------------------------------------------------------------------------------
1 | /** ShowList.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.list
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
15 | *
16 | * @author Denis Borisenko
17 | * @see https://dev.twitter.com/docs/api/1/get/lists/show
18 | */
19 | public class ShowList extends ListOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "https://api.twitter.com/1.1/lists/show.json";
25 |
26 | /**
27 | * Requires either a listId or a slug. If using the slug, you must pass either the ownerId or the ownerScreenName as well.
28 | *
29 | * @param listId Optional. The id or slug of the list.
30 | * @param slug Optional. The slug of the list.
31 | * @param ownerId Optional. The id of the Owner. needed if using a slug instead of a listId.
32 | * @param ownerScreenName Optional. The owner of the list. Needed if using slug instead of listId.
33 | *
34 | */
35 | public function ShowList(listId:String = null, slug:String = null, ownerId:String = null, ownerScreenName:String = null)
36 | {
37 | super(URL);
38 | resultFormat = ResultFormat.JSON;
39 | method = METHOD_GET;
40 | _requiresAuthentication = true;
41 | _apiRateLimited = false;
42 | parameters = {list_id:listId, slug:slug, owner_id:ownerId, owner_screen_name:ownerScreenName};
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/list/UpdateList.as:
--------------------------------------------------------------------------------
1 | /** UpdateList.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.list
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Updates the specified list.
15 | *
16 | * @author Denis Borisenko
17 | * @see https://dev.twitter.com/docs/api/1/post/lists/update
18 | */
19 | public class UpdateList extends ListOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "https://api.twitter.com/1.1/lists/update.json";
25 |
26 |
27 | /**
28 | * Requires either a listId or a slug. If using the slug, you must pass either the ownerId or the ownerScreenName as well.
29 | *
30 | * @param listId Optional. The id or slug of the list.
31 | * @param slug Optional. The slug of the list.
32 | * @param ownerId Optional. The id of the Owner. needed if using a slug instead of a listId.
33 | * @param ownerScreenName Optional. The owner of the list. Needed if using slug instead of listId.
34 | * @param name Optional. What you'd like to change the lists name to.
35 | * @param mode Optional. Whether your list is public or private. Values can be public or private.
36 | * Lists are public by default if no mode is specified.
37 | * @param description Optional. What you'd like to change the list description to.
38 | *
39 | */
40 |
41 | public function UpdateList(listId:String = null, slug:String = null, ownerId:String = null, ownerScreenName:String = null,
42 | name:String = null, mode:String = null, description:String = null)
43 | {
44 | super(URL);
45 | resultFormat = ResultFormat.JSON;
46 | method = METHOD_POST;
47 | _requiresAuthentication = true;
48 | _apiRateLimited = false;
49 | parameters = {list_id:listId, slug:slug, owner_screen_name:ownerScreenName, owner_id:ownerId,
50 | name: name, mode: mode, description: description};
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/listMembers/AddListMember.as:
--------------------------------------------------------------------------------
1 | /** PostListMembers.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.listMembers
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Add a member to a list. The authenticated user must own the list to be able to add members to it.
15 | * Lists are limited to having 500 members.
16 | *
17 | * API Docs don't document what is returned here. I'm assuming the list that the user was added to.
18 | *
19 | * @author Denis Borisenko
20 | * @see https://dev.twitter.com/docs/api/1/post/lists/members/create
21 | */
22 | public class AddListMember extends ListOperation
23 | {
24 | /**
25 | * @private
26 | */
27 | protected static const URL:String = "https://api.twitter.com/1.1/lists/members/create.json";
28 |
29 | /**
30 | * Either userId or userScreen name is required.
31 | * Either listId or slug is required. If using slug, the ownerId or ownerScreenName must also be passed.
32 | *
33 | * @param userId Optional. The id of the user to add as a member of the list.
34 | *
35 | * @param userScreenName Optional. The screenName of the user to add to the list.
36 | *
37 | * @param listId Optional. The id or slug of the list.
38 | *
39 | * @param slug Optional. The slug of the list. If used, ownerScreenName or ownerId is required.
40 | *
41 | * @param ownerScreenName Optional. The screen name of the owner.
42 | *
43 | * @param ownerId Optional. The id of the owner.
44 | *
45 | */
46 | public function AddListMember(userId:String = null, userScreenName:String = null, listId:String = null, slug:String = null,
47 | ownerScreenName:String = null, ownerId:String = null)
48 | {
49 | super(URL);
50 | resultFormat = ResultFormat.JSON;
51 | method = METHOD_POST;
52 | _requiresAuthentication = true;
53 | _apiRateLimited = false;
54 | parameters = {list_id:listId, slug:slug, user_id:userId, screen_name:userScreenName,
55 | owner_screen_name:ownerScreenName, owner_id:ownerId};
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/listMembers/DeleteListMember.as:
--------------------------------------------------------------------------------
1 | /** DeleteListMembers.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.listMembers
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Removes the specified member from the list. The authenticated user must be the list's owner
15 | * to remove members from the list.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/lists/members/destroy
19 | */
20 | public class DeleteListMember extends ListOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "https://api.twitter.com/1.1/lists/members/destroy.json";
26 |
27 | /**
28 | * Either userId or userScreen name is required.
29 | * Either listId or slug is required. If using slug, the ownerId or ownerScreenName must also be passed.
30 | *
31 | * @param userId Optional. The id of the user to add as a member of the list.
32 | *
33 | * @param userScreenName Optional. The screenName of the user to add to the list.
34 | *
35 | * @param listId Optional. The id or slug of the list.
36 | *
37 | * @param slug Optional. The slug of the list. If used, ownerScreenName or ownerId is required.
38 | *
39 | * @param ownerScreenName Optional. The screen name of the owner.
40 | *
41 | * @param ownerId Optional. The id of the owner.
42 | *
43 | */
44 | public function DeleteListMember(userId:String = null, userScreenName:String = null, listId:String = null, slug:String = null,
45 | ownerScreenName:String = null, ownerId:String = null)
46 | {
47 | super(URL);
48 | resultFormat = ResultFormat.JSON;
49 | method = METHOD_POST;
50 | _requiresAuthentication = true;
51 | _apiRateLimited = false;
52 | parameters = {list_id:listId, slug:slug, user_id:userId, screen_name:userScreenName,
53 | owner_screen_name:ownerScreenName, owner_id:ownerId};
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/listSubscribers/SubscribeList.as:
--------------------------------------------------------------------------------
1 | /** SubscribeList.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.listSubscribers
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.ListOperation;
12 |
13 | /**
14 | * Make the authenticated user follow the specified list.
15 | *
16 | * @author Denis Borisenko
17 | * @see https://dev.twitter.com/docs/api/1/post/lists/subscribers/create
18 | */
19 | public class SubscribeList extends ListOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "https://api.twitter.com/1.1/lists/subscribers/create.json";
25 |
26 | /**
27 | * Either a listId or a slug is required. If providing a slug, an ownerScreenName or ownerId is also required.
28 | *
29 | * @param listId Optional. The id or slug of the list.
30 | *
31 | * @param slug Optional. The slug of the list. If used, ownerScreenName or ownerId is required.
32 | *
33 | * @param ownerScreenName Optional. The screen name of the owner.
34 | *
35 | * @param ownerId Optional. The id of the owner.
36 | *
37 | */
38 | public function SubscribeList(listId:String = null, slug:String = null, ownerScreenName:String = null, ownerId:String = null)
39 | {
40 | super(URL);
41 | resultFormat = ResultFormat.JSON;
42 | method = METHOD_POST;
43 | _requiresAuthentication = true;
44 | _apiRateLimited = false;
45 | parameters = {list_id: listId, slug:slug, owner_screen_name:ownerScreenName, owner_id:ownerId};
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/status/DestroyStatus.as:
--------------------------------------------------------------------------------
1 | /** DestroyStatus.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.status
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusOperation;
12 |
13 | /**
14 | * Destroys the status specified by the required ID parameter.
15 | * The authenticating user must be the author of the specified status.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/statuses/destroy/%3Aid
19 | */
20 | public class DestroyStatus extends StatusOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "http://twitter.com/statuses/destroy/{id}.json";
26 |
27 | /**
28 | *
29 | * @param id Required. The ID of the status to destroy.
30 | *
31 | */
32 | public function DestroyStatus(id:String)
33 | {
34 | super(URL.replace(/\{id\}/gi, id));
35 | resultFormat = ResultFormat.JSON;
36 | method = METHOD_POST;
37 | _requiresAuthentication = true;
38 | _apiRateLimited = false;
39 | parameters = {id: id};
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/status/Retweet.as:
--------------------------------------------------------------------------------
1 | /** Retweet.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.status
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusOperation;
12 |
13 | /**
14 | * Retweets a tweet. Requires the id parameter of the tweet you are retweeting. Request must be a POST or PUT.
15 | * Returns the original tweet with retweet details embedded.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/post/statuses/retweet/%3Aid
19 | */
20 | public class Retweet extends StatusOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "http://api.twitter.com/1.1/statuses/retweet/{id}.json";
26 |
27 | /**
28 | *
29 | * @param id Required. The numerical ID of the tweet you are retweeting.
30 | *
31 | */
32 | public function Retweet(id:String)
33 | {
34 | super(URL.replace(/\{id\}/gi, id));
35 | resultFormat = ResultFormat.JSON;
36 | method = METHOD_POST;
37 | _requiresAuthentication = true;
38 | _apiRateLimited = false;
39 | parameters = {id: id};
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/status/ShowStatus.as:
--------------------------------------------------------------------------------
1 | /** ShowStatus.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.status
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusOperation;
12 |
13 | /**
14 | * Returns a single status, specified by the id parameter below. The status's author will be returned inline.
15 | *
16 | * @author Denis Borisenko
17 | * @see http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses%C2%A0show
18 | */
19 | public class ShowStatus extends StatusOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "http://api.twitter.com/1.1/statuses/show/{id}.json";
25 |
26 | /**
27 | *
28 | * @param id Required. The numerical ID of the status to retrieve.
29 | *
30 | */
31 | public function ShowStatus(id:String)
32 | {
33 | super(URL.replace(/\{id\}/gi, id));
34 | resultFormat = ResultFormat.JSON;
35 | method = METHOD_GET;
36 | _requiresAuthentication = true;
37 | _apiRateLimited = true;
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/status/UpdateStatus.as:
--------------------------------------------------------------------------------
1 | /** UpdateStatus.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.status
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusOperation;
12 |
13 | /**
14 | * Updates the authenticating user's status. Requires the status parameter specified below. Request must be a POST.
15 | * A status update with text identical to the authenticating user's current status will be ignored to prevent
16 | * duplicates.
17 | *
18 | * There are other options that are not implemented here yet. Mostly geolocation. There is also an update_with_media
19 | * API method to upload a picture as well.
20 | *
21 | * @author Denis Borisenko
22 | * @see https://dev.twitter.com/docs/api/1/post/statuses/update
23 | */
24 | public class UpdateStatus extends StatusOperation
25 | {
26 | /**
27 | * @private
28 | */
29 | protected static const URL:String = "https://api.twitter.com/1.1/statuses/update.json";
30 | /**
31 | *
32 | * @param statusText Required. The text of your status update. URL encode as necessary.
33 | * Statuses over 140 characters will be forceably truncated.
34 | * @param inReplyToStatusId Optional. The ID of an existing status that the update is in reply to.
35 | * Note: This parameter will be ignored unless the author of the tweet this parameter
36 | * references is mentioned within the status text. Therefore, you must include @username,
37 | * where username is the author of the referenced tweet, within the update.
38 | *
39 | * @param entities Optional. Whether or not to include an entities object in the response.
40 | *
41 | * see: https://dev.twitter.com/docs/api/1/post/statuses/update
42 | *
43 | */
44 | public function UpdateStatus(statusText:String, inReplyToStatusId:String = null, entities:Boolean = true,lat:String=null,long:String=null)
45 | {
46 | resultFormat = ResultFormat.JSON;
47 | super(URL);
48 | method = METHOD_POST;
49 | _requiresAuthentication = true;
50 | _apiRateLimited = false;
51 |
52 | statusText = statusText.replace(/\r\n/g, " ");
53 | statusText = statusText.replace(/\n/g, " ");
54 | statusText = statusText.replace(/\r/g, " ");
55 |
56 | if(lat == null || long == null)
57 | {
58 | parameters = {status: statusText, in_reply_to_status_id: inReplyToStatusId, include_entities:entities};
59 | }
60 | else
61 | {
62 | parameters = {status: statusText, in_reply_to_status_id: inReplyToStatusId, include_entities:entities, lat:lat, long:long, display_coordinates:true};
63 | }
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/streaming/UserStream.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.commands.streaming
2 | {
3 | import com.dborisenko.api.twitter.net.TwitterStreamingOperation;
4 |
5 | public class UserStream extends TwitterStreamingOperation
6 | {
7 | /**
8 | * This loads a stream of the user's content. Unlike the normal REST API this is done via a URLStream socket that continuously returns data as
9 | * it is received.
10 | *
11 | * Details here: https://dev.twitter.com/docs/api/2/get/user
12 | **/
13 |
14 | protected static const URL:String = "https://userstream.twitter.com/2/user.json";
15 |
16 | /**
17 | *
18 | * /2/user.json?replies=all&stall_warnings=true&with=followings&delimited=false
19 | *
20 | * @param delimited optional. Specifies whether messages should be length-delimited.
21 | * See the delimited parameter documentation for more information. values: "length", null
22 | *
23 | * @param stallWarnings optional Specifies whether stall warnings should be delivered.
24 | *
25 | * @param withType optional. Specifies whether to return information for just the authenticating user,
26 | * or include messages from accounts the user follows. values: "followings" or "user"
27 | *
28 | * @param replies optional. Specifies whether to return additional @replies. values: "all" or null.
29 | *
30 | * @param follow optional. Includes additional public Tweets from the supplied array of user IDs.
31 | *
32 | * @param track optional. Includes additional Tweets matching the specified keywords in an array.
33 | * Phrases of keywords are specified by a comma-separated list.
34 | * @param locations optional. Includes additional Tweets falling within the specified bounding boxes.
35 | * This needs improvement.
36 | *
37 | * More on Parameters: https://dev.twitter.com/docs/streaming-apis/parameters
38 | **/
39 | public function UserStream(delimited:String = null, stallWarnings:Boolean = true, withType:String = "followings",
40 | replies:String = "all", follow:Array = null, track:Array = null, locations:String = null)
41 | {
42 | super(URL);
43 | this.method = METHOD_GET;
44 | this._requiresAuthentication = true;
45 | this._apiRateLimited = true;
46 |
47 | var followIds:String = null;
48 | var trackWords:String = null;
49 | if(follow != null){
50 | followIds = follow.join(",");
51 | }
52 |
53 | if(track != null){
54 | trackWords = track.join(",");
55 | }
56 |
57 | this.parameters = {'delimited': delimited, 'stall_warnings':stallWarnings, 'with':withType, 'replies':replies,
58 | 'follow':followIds, 'track': trackWords, 'locations':locations};
59 |
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/timeline/LoadMentions.as:
--------------------------------------------------------------------------------
1 | /** LoadMentions.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.timeline
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.StatusesOperation;
12 |
13 | /**
14 | * Returns the 20 most recent mentions (status containing @username) for the authenticating user.
15 | *
16 | * @author Denis Borisenko
17 | * @see http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-mentions
18 | */
19 | public class LoadMentions extends StatusesOperation
20 | {
21 | /**
22 | * @private
23 | */
24 | protected static const URL:String = "http://api.twitter.com/1.1/statuses/mentions.json";
25 |
26 | /**
27 | *
28 | * @param sinceId Optional. Returns only statuses with an ID greater than (that is, more
29 | * recent than) the specified ID.
30 | * Example: since_id=12345
31 | *
32 | * @param maxId Optional.Returns only statuses with an ID less than (that is, older than)
33 | * or equal to the specified ID.
34 | * Example: max_id=54321
35 | *
36 | * @param count Optional. Specifies the number of statuses to retrieve. May not be greater than 200.
37 | * Example: count=200
38 | *
39 | * @param entities Optional. Includes the entities array for things like URLs.
40 | * Example: true
41 | *
42 | * @param includeRetweets Optional. Includes native retweets within the response.Using this will cause the Count parameter
43 | * to receive up-to count tweets -- because the count parameter retrieves that many tweets before
44 | * filtering out retweets and replies.
45 | * Example: true
46 | *
47 | * https://dev.twitter.com/docs/api/1/get/statuses/mentions
48 | */
49 | public function LoadMentions(sinceId:String=null, maxId:String=null, count:int=-1, entities:Boolean = true, includeRetweets:Boolean = true)
50 | {
51 | super(URL, true, null, true);
52 | resultFormat = ResultFormat.JSON;
53 | method = METHOD_GET;
54 | _requiresAuthentication = true;
55 | _apiRateLimited = true;
56 | parameters = {since_id: sinceId, max_id: maxId, count: count, include_entities:entities, include_rts:includeRetweets};
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/user/LoadUserInfo.as:
--------------------------------------------------------------------------------
1 | /** LoadUserInfo.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.user
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UserOperation;
12 |
13 | /**
14 | * Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
15 | * The author's most recent status will be returned inline.
16 | *
17 | * @author Denis Borisenko
18 | * @see https://dev.twitter.com/docs/api/1/get/users/show
19 | */
20 | public class LoadUserInfo extends UserOperation
21 | {
22 | /**
23 | * @private
24 | */
25 | protected static const URL:String = "http://api.twitter.com/version/users/show.json";
26 |
27 | /**
28 | * userId or screenName is required.
29 | *
30 | * @param userId Specfies the ID of the user to return. Helpful for disambiguating
31 | * when a valid user ID is also a valid screen name.
32 | * Example: user_id=1401881
33 | * @param screenName Specfies the screen name of the user to return. Helpful for disambiguating
34 | * when a valid screen name is also a user ID.
35 | * Example: screen_name=101010
36 | *
37 | * @param entities Optional. Whether or not to include entities in the user's status.
38 | */
39 | public function LoadUserInfo(userId:String = null, screenName:String = null, entities:Boolean = true)
40 | {
41 | super(URL);
42 | resultFormat = ResultFormat.JSON;
43 | method = METHOD_GET;
44 | _requiresAuthentication = true;
45 | _apiRateLimited = true;
46 | parameters = {user_id: userId, screen_name: screenName, include_entities:entities};
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/user/LookupUsers.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.commands.user
2 | {
3 | import com.dborisenko.api.enums.ResultFormat;
4 | import com.dborisenko.api.twitter.net.UsersOperation;
5 |
6 | /**
7 | *Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.
8 | *The author's most recent status (if the authenticating user has permission) will be returned inline.
9 | *
10 | *This method is crucial for consumers of the Streaming API. It's also well suited for use in tandem with friends/ids and followers/ids.
11 | *
12 | *
13 | *@author Charlie Szymanski
14 | *@see https://dev.twitter.com/docs/api/1/get/users/lookup
15 | */
16 |
17 | public class LookupUsers extends UsersOperation
18 | {
19 |
20 | /**
21 | * @private
22 | */
23 | protected static const URL:String = "http://api.twitter.com/1.1/users/lookup.json";
24 |
25 |
26 | /**
27 | * An array of either userIds or screenNames is necessary.
28 | *
29 | * @param userIds Optional. An Array of up to 100 screen names.
30 | *
31 | * @param screenNames Optional. An Array of up to 100 User IDs.
32 | *
33 | * @param entities Optional. Whether or not to include entities in the response statuses.
34 | *
35 | */
36 | public function LookupUsers(userIds:Array = null, screenNames:Array = null, entities:Boolean = true)
37 | {
38 | super(URL);
39 | resultFormat = ResultFormat.JSON;
40 | method = METHOD_GET;
41 | _requiresAuthentication = true;
42 | _apiRateLimited = true;
43 |
44 | var ids:String = null;
45 | var names:String = null;
46 |
47 | if(userIds){
48 | ids = userIds.join(",");
49 | }
50 |
51 | if(screenNames){
52 | names = screenNames.join(",");
53 | }
54 |
55 | parameters = {user_id:ids, screen_name:names, include_entities:entities};
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/commands/user/SearchUsers.as:
--------------------------------------------------------------------------------
1 | /** SearchUsers.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.commands.user
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.net.UsersOperation;
12 |
13 | /**
14 | * Run a search for users similar to Find People
15 | * button on Twitter.com; the same results returned by people search on
16 | * Twitter.com will be returned by using this API
17 | * (about being listed in the People Search).
18 | * It is only possible to retrieve the first 1000 matches from this API.
19 | *
20 | * @author Denis Borisenko
21 | * @see https://dev.twitter.com/docs/api/1/get/users/search
22 | */
23 | public class SearchUsers extends UsersOperation
24 | {
25 | /**
26 | * @private
27 | */
28 | protected static const URL:String = "http://api.twitter.com/1.1/users/search.json";
29 |
30 | /**
31 | *
32 | * @param query The query to run against people search.
33 | * Example: q=Doug%20Williams
34 | * @param perPage Optional. Specifies the number of statuses to retrieve. May not be greater than 20.
35 | * Example: q=Doug%20Williams&per_page=5
36 | * @param page Optional. Specifies the page of results to retrieve.
37 | * Example: q=Doug%20Williams&page=3
38 | *
39 | * @param entities Optional. Whether or not to include entities in the response statuses.
40 | *
41 | */
42 | public function SearchUsers(query:String, perPage:int = -1, page:int = -1, entities:Boolean = true)
43 | {
44 | super(URL);
45 | resultFormat = ResultFormat.JSON;
46 | method = METHOD_GET;
47 | _requiresAuthentication = true;
48 | _apiRateLimited = true;
49 | parameters = {q: query, per_page: perPage, page: page, include_entities:entities};
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingControl.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingControl
4 | {
5 |
6 | public var uri:String; // /:version/site/c/:stream_id
7 | public var version:String;
8 | public var streamId:String;
9 | public var infoURI:String; // /:version/site/c/:stream_id/info.json
10 | public var addUserURI:String; // /:version/site/c/:stream_id/add_user.json (message body: user_id:[USER_ID])
11 | public var removeUserURI:String; // /:version/site/c/:stream_id/remove_user.json (message body: user_id:[USER_ID])
12 | public var userInfoURI:String; // /:version/site/c/:stream_id/friends/ids.json (message body: user_id:[USER_ID]) -- gets user followings / friends
13 |
14 |
15 | /**
16 | * Upon establishing a Site Streams connection, Twitter will send a preamble before starting regular message delivery.
17 | * This preamble will contain a control message which may be used to modify the Site Streams connection without reconnecting
18 | *
19 | * https://dev.twitter.com/docs/streaming-apis/streams/site/control
20 | **/
21 | public function StreamingControl(data:Object = null)
22 | {
23 | if(data)
24 | parseData(data);
25 | }
26 |
27 |
28 | /**
29 | * {
30 | "control":{
31 | "control_uri": "/2b/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50"
32 | }
33 | }
34 | **/
35 | public function parseData(data:Object):void
36 | {
37 | if(data['control'] == null){
38 | return;
39 | }
40 |
41 | this.uri = data['control']['control_uri'];
42 | var uriParts:Array = this.uri.substring(1).split('/'); // get rid of the first slash and then split into pieces
43 | this.version = uriParts[0]; // the first part is the version number
44 | this.streamId = this.uri.split('/')[uriParts.length - 1]; // the last part is the stream id.
45 | this.infoURI = "/" + this.version + "/site/c/" + this.streamId + "/info.json";
46 | this.addUserURI = "/" + this.version + "/site/c/" + this.streamId + "/add_user.json";
47 | this.removeUserURI = "/" + this.version + "/site/c/" + this.streamId + "/remove_user.json";
48 | this.userInfoURI = "/" + this.version + "/site/c/" + this.streamId + "/friends/ids.json";
49 |
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingDelete.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingDelete
4 | {
5 |
6 | public var statusId:String;
7 | public var userId:String;
8 |
9 | /**
10 | * These messages indicate that a given Tweet has been deleted. Client code must honor these messages
11 | * by clearing the referenced Tweet from memory and any storage or archive, even in the rare case where
12 | * a deletion message arrives earlier in the stream that the Tweet it references.
13 | **/
14 | public function StreamingDelete(data:Object = null)
15 | {
16 | if(data)
17 | parseData(data);
18 | }
19 |
20 |
21 |
22 |
23 | /**
24 | * {
25 | "delete":{
26 | "status":{
27 | "id":1234,
28 | "id_str":"1234",
29 | "user_id":3,
30 | "user_id_str":"3"
31 | }
32 | }
33 | }
34 | **/
35 | public function parseData(data:Object):void
36 | {
37 | if((data['delete'] == null) || (data['delete']['status'] == null)){
38 | return
39 | }
40 |
41 | this.statusId = data['delete']['status']['id_str'];
42 | this.userId = data['delete']['status']['user_id_str'];
43 |
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingFriends.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingFriends
4 | {
5 |
6 | public var ids:Array;
7 |
8 | /**
9 | * Upon establishing a User Stream connection, Twitter will send a preamble before starting regular message delivery.
10 | * This preamble contains a list of the user’s friends. This is represented as an array of user ids, for example:
11 | **/
12 | public function StreamingFriends(data:Object = null)
13 | {
14 | if(data)
15 | parseData(data);
16 | }
17 |
18 | /**
19 | *{
20 | "friends":[
21 | 1497,
22 | 169686021,
23 | 790205,
24 | 15211564,
25 | ...
26 | ]
27 | }
28 | **/
29 | public function parseData(data:Object):void
30 | {
31 | if(data['friends'] == null){
32 | return
33 | }
34 |
35 | this.ids = data['friends'];
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingLimit.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingLimit
4 | {
5 |
6 | public var track:Number;
7 |
8 | /**
9 | * These messages indicate that a filtered stream has matched more Tweets than its
10 | * current rate limit allows to be delivered. Limit notices contain a total count of the
11 | * number of undelivered Tweets since the connection was opened, making them useful for
12 | * tracking counts of track terms, for example. Note that the counts do not specify which
13 | * filter predicates undelivered messages matched.
14 | **/
15 | public function StreamingLimit(data:Object = null)
16 | {
17 | if(data)
18 | parseData(data);
19 | }
20 |
21 | /**
22 | * {
23 | "limit":{
24 | "track":1234
25 | }
26 | }
27 | **/
28 | public function parseData(data:Object):void
29 | {
30 | if(data['limit'] == null){
31 | return;
32 | }
33 |
34 | this.track = data['limit']['track'];
35 |
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingMessage.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | import com.dborisenko.api.twitter.commands.streaming.StreamingParser;
4 |
5 | public class StreamingMessage
6 | {
7 |
8 | public var forUserId:String;
9 | public var message:StreamingObject;
10 |
11 |
12 | /**
13 | * Site Streams are sent the same messages as User Streams (including friends lists in the preamble),
14 | * but for multiple users instead of a single user. The same types of messages are streamed, but to
15 | * identify the target of each message, an additional wrapper is placed around every message, except
16 | * for blank keep-alive lines. The Site Streams messages for two friends lists would look like:
17 | **/
18 | public function StreamingMessage(data:Object = null)
19 | {
20 | if(data)
21 | parseData(data);
22 | }
23 |
24 | /**
25 | * {
26 | "for_user":"1888",
27 | "message":{"friends":[]}
28 | }
29 | {
30 | "for_user":"9160152",
31 | "message":{"friends":[]}
32 | }
33 | **/
34 | public function parseData(data:Object):void
35 | {
36 | var parser:StreamingParser = new StreamingParser();
37 | if(data['for_user'] == null){
38 | return;
39 | }
40 |
41 | this.forUserId = data['for_user'].toString();
42 | this.message = parser.parseData(data['message']);
43 |
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingObject.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingObject
4 | {
5 |
6 | public static const TYPE_STATUS:String = "twitterStatus";
7 | public static const TYPE_DELETE:String = "delete";
8 | public static const TYPE_SCRUB_GEO:String = "scrubGeo";
9 | public static const TYPE_LIMIT:String = "limit";
10 | public static const TYPE_STATUS_WITHHELD:String = "statusWithheld";
11 | public static const TYPE_USER_WITHHELD:String = "userWithheld";
12 | public static const TYPE_FRIENDS:String = "friends";
13 | public static const TYPE_EVENT:String = "event";
14 | public static const TYPE_CONTROL:String = "control";
15 | public static const TYPE_MESSAGE:String = "message";
16 | public static const TYPE_EMPTY:String = "empty";
17 | public static const TYPE_UNKNOWN:String = "unknown";
18 |
19 |
20 | public var data:Object;
21 | public var type:String = TYPE_EMPTY;
22 |
23 | public function StreamingObject(data:Object, type:String)
24 | {
25 | this.data = data;
26 | this.type = type;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingScrubGeo.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingScrubGeo
4 | {
5 |
6 | public var userId:String;
7 | public var upToStatusId:String;
8 |
9 | /**
10 | *These messages indicate that geolocated data must be stripped from a range of Tweets.
11 | * Clients must honor these messages by deleting geocoded data from Tweets which fall before
12 | * the given status ID and belong to the specified user. These messages may also arrive before a
13 | * Tweet which falls into the specified range, although this is rare.
14 | **/
15 | public function StreamingScrubGeo(data:Object = null)
16 | {
17 | if(data)
18 | parseData(data);
19 | }
20 |
21 | /**
22 | * {
23 | "scrub_geo":{
24 | "user_id":14090452,
25 | "user_id_str":"14090452",
26 | "up_to_status_id":23260136625,
27 | "up_to_status_id_str":"23260136625"
28 | }
29 | }
30 | **/
31 | public function parseData(data:Object):void
32 | {
33 | if(data['scrub_geo'] == null){
34 | return
35 | }
36 |
37 | this.userId = data['scrub_geo']['user_id_str'];
38 | this.upToStatusId = data['scrub_geo']['up_to_status_id_str'];
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingStatusWithheld.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingStatusWithheld
4 | {
5 |
6 | public var statusId:String;
7 | public var userId:String;
8 | public var withheldInCountries:Array;
9 |
10 | /**
11 | * These events contain an id field indicating the status ID, a user_id indicating the user,
12 | * and a collection of withheld_in_countries two-letter country codes. This example illustrates
13 | * a hypothetical tweet that has been withheld in Germany and Argentina.
14 | **/
15 | public function StreamingStatusWithheld(data:Object = null)
16 | {
17 | if(data)
18 | parseData(data);
19 | }
20 |
21 | /**
22 | * {
23 | "status_withheld":{
24 | "id":1234567890,
25 | "user_id":123456,
26 | "withheld_in_countries":["de", "ar"]
27 | }
28 | }
29 | **/
30 | public function parseData(data:Object):void
31 | {
32 | if(data['status_withheld'] == null){
33 | return;
34 | }
35 |
36 | this.statusId = data['status_withheld']['id'].toString();
37 | this.userId = data['status_withheld']['user_id'].toString();
38 | this.withheldInCountries = data['status_withheld']['withheld_in_countries'];
39 | }
40 |
41 | }
42 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/StreamingUserWithheld.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class StreamingUserWithheld
4 | {
5 |
6 | public var userId:String;
7 | public var withheldInCountries:Array;
8 | /**
9 | * These events contain an id field indicating the user ID and a collection of withheld_in_countries
10 | * two-letter country codes. This example illustrates a hypothetical user who has been withheld in
11 | * Germany and Argentina.
12 | **/
13 | public function StreamingUserWithheld(data:Object = null)
14 | {
15 | if(data)
16 | parseData(data);
17 | }
18 |
19 | /**
20 | * {
21 | "user_withheld":{
22 | "id":123456,
23 | "withheld_in_countries":["de","ar"]
24 | }
25 | }
26 | **/
27 | public function parseData(data:Object):void
28 | {
29 | if(data['user_withheld'] == null)
30 | {
31 | return;
32 | }
33 |
34 | this.userId = data['user_withheld']['id'].toString();
35 | this.withheldInCountries = data['user_withheld']['withheld_in_countries'];
36 |
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/TwitterDirectMessage.as:
--------------------------------------------------------------------------------
1 | /** TwitterDirectMessage.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data
9 | {
10 | import com.dborisenko.api.vo.ValueObject;
11 |
12 | [Bindable]
13 | /**
14 | * Twitter Direct message
15 | * @author Denis Borisenko
16 | *
17 | */
18 | public class TwitterDirectMessage extends ValueObject
19 | {
20 | public var createdAt:Date;
21 | public var id:String;
22 | public var text:String;
23 | public var senderId:String;
24 | public var recipientId:String;
25 | public var senderScreenName:String;
26 | public var recipientScreenName:String;
27 | public var sender:TwitterUser;
28 | public var recipient:TwitterUser;
29 |
30 | public var isSent:Boolean = false;
31 |
32 | public function TwitterDirectMessage(directMessage:Object, isXML:Boolean = false)
33 | {
34 | super();
35 |
36 | if(isXML){
37 | parseXML(directMessage);
38 | }else{
39 | parseJSON(directMessage);
40 | }
41 | }
42 |
43 | public function parseJSON(dm:Object):void{
44 | createdAt = new Date(Date.parse(dm['created_at'].toString()));//CreatedAtDate.parse(directMessage.created_at);
45 | id = dm['id'];
46 | text = dm['text'];
47 | senderId = dm['sender_id'];
48 | recipientId = dm['recipient_id'];
49 | senderScreenName = dm['sender_screen_name'];
50 | recipientScreenName = dm['recipient_screen_name'];
51 | sender = new TwitterUser(dm['sender']);
52 | recipient = new TwitterUser(dm['recipient']);
53 | }
54 |
55 | public function parseXML(dm:Object):void{
56 |
57 | createdAt = new Date(Date.parse(dm.created_at.toString()));//CreatedAtDate.parse(directMessage.created_at);
58 | id = dm.id;
59 | senderId = dm.sender_id;
60 | text = dm.text;
61 | recipientId = dm.recipient_id;
62 | senderScreenName = dm.sender_screen_name;
63 | recipientScreenName = dm.recipient_screen_name;
64 | sender = new TwitterUser(dm.sender);
65 | recipient = new TwitterUser(dm.recipient);
66 | }
67 |
68 | }
69 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/TwitterEntity.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class TwitterEntity
4 | {
5 | //as far as I can tell these are the only three types of entities so far.
6 | public static const ENTITY_TYPE_URL:String = "url";
7 | public static const ENTITY_TYPE_HASHTAG:String = "hashtag";
8 | public static const ENTITY_TYPE_MENTION:String = "usermention";
9 | public static const ENTITY_TYPE_MEDIA:String = "media";
10 |
11 |
12 | public var rawData:Object;
13 | public var type:String;
14 | //url specific
15 | public var expandedURL:String;
16 | public var url:String;
17 | public var displayURL:String;
18 | //hashtag
19 | public var hashText:String;
20 | //user
21 | public var name:String;
22 | public var mentionId:String; // int also available.
23 | public var screenName:String;
24 | //media
25 | public var mediaId:String;
26 | public var mediaURL:String;
27 | public var mediaURLHttps:String;
28 | public var mediaSizes:Object;
29 | public var mediaType:String;
30 | // general
31 | public var indices:Array;
32 | //derived
33 | public var startIndex:int;
34 | public var endIndex:int;
35 |
36 |
37 |
38 | public function TwitterEntity():void{
39 |
40 | }
41 |
42 | public function parseJSON(data:Object, type:String):void{
43 |
44 | if((type == TwitterEntity.ENTITY_TYPE_URL) || (type == TwitterEntity.ENTITY_TYPE_MEDIA)){
45 | expandedURL = data['expanded_url'];
46 | url = data['url'];
47 | displayURL = data['display_url'];
48 | }else if(type == TwitterEntity.ENTITY_TYPE_HASHTAG){
49 | hashText = data['text'];
50 | }else if(type == TwitterEntity.ENTITY_TYPE_MENTION){
51 | name = data['name'];
52 | mentionId = data['id'];
53 | screenName = data['screen_name'];
54 | }
55 |
56 | if(type == TwitterEntity.ENTITY_TYPE_MEDIA){
57 | mediaId = data['id_str'];
58 | mediaURL = data['media_url'];
59 | mediaURLHttps = data['media_url_https'];
60 | mediaSizes = data['sizes'];
61 | mediaType = data['type'];
62 | }
63 |
64 | indices = data['indices'];
65 | startIndex = indices[0];
66 | endIndex = indices[1];
67 | this.type = type;
68 |
69 |
70 | }
71 |
72 |
73 | }
74 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/TwitterList.as:
--------------------------------------------------------------------------------
1 | /** TwitterList.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data
9 | {
10 | import com.dborisenko.api.vo.ValueObject;
11 |
12 | import mx.events.FlexEvent;
13 |
14 | [Bindable]
15 | [Event(name="dataChange", type="mx.events.FlexEvent")]
16 | /**
17 | * Twitter List
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class TwitterList extends ValueObject
22 | {
23 | public static const MODE_PRIVATE:String = "private";
24 | public static const MODE_PUBLIC:String = "public";
25 |
26 | private var _name:String;
27 |
28 | public var createdAt:Date;
29 | public var id:String;
30 | public var fullName:String;
31 | public var slug:String;
32 | public var description:String;
33 | public var subscriberCount:int;
34 | public var memberCount:int;
35 | public var uri:String;
36 | public var mode:String = MODE_PUBLIC;
37 | public var user:TwitterUser;
38 | public var following:Boolean = false;
39 |
40 |
41 | [Bindable("dataChange")]
42 | public function get name():String
43 | {
44 | return _name;
45 | }
46 | public function set name(value:String):void
47 | {
48 | if (_name == value)
49 | return;
50 | _name = value;
51 | dispatchDataChangeEvent();
52 | }
53 |
54 |
55 | public function TwitterList(list:Object, isXML:Boolean = false)
56 | {
57 | super();
58 | if(isXML){
59 | parseXML(list);
60 | }else{
61 | parseJSON(list)
62 | }
63 | }
64 |
65 |
66 | public function parseJSON(json:Object):void{
67 | this.createdAt = new Date(Date.parse(json['created_at']));
68 | this.slug = json['slug'];
69 | this.name = json['name'];
70 | this.fullName = json['full_name'];
71 | this.description = json['description'];
72 | this.mode = json['mode'];
73 | this.following = json['following'];
74 | this.memberCount = json['member_count'];
75 | this.id = json['id_str'];
76 | this.subscriberCount = json['subscriber_count'];
77 | this.uri = json['uri'];
78 | this.user = new TwitterUser(json['user']);
79 | }
80 |
81 | public function parseXML(list:Object):void
82 | {
83 | if (!list)
84 | return;
85 |
86 | id = list.id;
87 | name = list.name;
88 | fullName = list.full_name;
89 | slug = list.slug;
90 | description = list.description;
91 | subscriberCount = int(list.subscriber_count);
92 | memberCount = int(list.member_count);
93 | uri = list.uri;
94 | mode = list.mode;
95 | user = new TwitterUser(list.user);
96 | }
97 |
98 | protected function dispatchDataChangeEvent():void
99 | {
100 | dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
101 | }
102 | }
103 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/TwitterPlace.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.data
2 | {
3 | public class TwitterPlace
4 | {
5 | public var rawData:Object;
6 | public var name:String;
7 | public var countryCode:String;
8 | public var country:String;
9 | public var attributes:Object;
10 | public var url:String;
11 | public var id:String;
12 | public var boundingBox:Object;
13 | public var fullName:String;
14 | public var type:String;
15 |
16 |
17 | public function TwitterPlace(data:Object = null)
18 | {
19 | if(data){
20 | parseJSON(data);
21 | this.rawData = data;
22 | }
23 | }
24 |
25 | public function parseJSON(data:Object):void{
26 |
27 | name = data['name'];
28 | countryCode = data['country_code'];
29 | country = data['country'];
30 | attributes = data['attributes'];
31 | url = data['url'];
32 | id = data['id'];
33 | boundingBox = data['bounding_box']; // contains coords and types. Not sure what's available here. Docs are laaaame.
34 | fullName = data['full_name'];
35 | type = data['place_type'];
36 |
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/TwitterRateLimit.as:
--------------------------------------------------------------------------------
1 | /** TwitterRateLimit.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data
9 | {
10 | import com.dborisenko.api.vo.ValueObject;
11 |
12 | /**
13 | * Twitter Rate Limit
14 | * @author Denis Borisenko
15 | *
16 | */
17 | public class TwitterRateLimit extends ValueObject
18 | {
19 | public var remainingHits:int;
20 | public var hourlyLimit:int;
21 | public var resetTime:Date;
22 | public var resetTimeInSeconds:int;
23 | public var photoRemainingHits:int;
24 | public var photoResetTimeInSeconds:int;
25 | public var photoResetTime:Date;
26 | public var photoDailyLimit:int;
27 |
28 | public function TwitterRateLimit(json:Object = null)
29 | {
30 | super();
31 | if(json)
32 | parseJSON(json);
33 |
34 | //this.remainingHits = remainingHits;
35 | //this.hourlyLimit = hourlyLimit;
36 | //this.resetTime = new Date(resetTimeInSeconds * 1000);
37 | }
38 |
39 | public function parseJSON(json:Object):void{
40 | this.remainingHits = json['remaining_hits'];
41 | this.resetTimeInSeconds = json['remaining_time_in_seconds'];
42 | this.hourlyLimit = json['hourly_limit'];
43 | this.resetTime = new Date(Date.parse(json['reset_time'].toString()));
44 | //photos
45 | if(json['photos']){
46 | var p:Object = json['photos'];
47 | this.photoRemainingHits = p['remaining_hits'];
48 | this.photoResetTimeInSeconds = p['reset_time_in_seconds'];
49 | this.photoResetTime = new Date(Date.parse(p['reset_time'].toString()));
50 | this.photoDailyLimit = p['daily_limit'];
51 | }
52 |
53 |
54 | }
55 |
56 |
57 | }
58 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/TwitterSearch.as:
--------------------------------------------------------------------------------
1 | /** TwitterSearch.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data
9 | {
10 | import mx.collections.ArrayCollection;
11 | import com.dborisenko.api.vo.ValueObject;
12 |
13 | /**
14 | * Twitter Search
15 | * @author Denis Borisenko
16 | *
17 | */
18 | public class TwitterSearch extends ValueObject
19 | {
20 | public var results:ArrayCollection;
21 | public var query:String;
22 | public var maxResultId:String;
23 | public var nextPage:String;
24 | public var page:int;
25 | public var refreshURL:String;
26 | }
27 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/collections/DirectMessagesCollection.as:
--------------------------------------------------------------------------------
1 | /** DirectMessagesCollection.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data.collections
9 | {
10 | import mx.collections.ArrayCollection;
11 |
12 | /**
13 | * Collection of Twitter Direct Messages
14 | * @author Denis Borisenko
15 | *
16 | */
17 | public class DirectMessagesCollection extends ArrayCollection
18 | {
19 | public function DirectMessagesCollection(source:Array=null)
20 | {
21 | super(source);
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/collections/ListsCollection.as:
--------------------------------------------------------------------------------
1 | /** ListsCollection.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data.collections
9 | {
10 | import com.dborisenko.api.twitter.interfaces.IPagingCollection;
11 |
12 | import mx.collections.ArrayCollection;
13 |
14 | /**
15 | * Collection of Twitter Lists. Can be broken into pages. In this case, nextCursor and previousCursor -
16 | * cursors of next and previous pages.
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public class ListsCollection extends ArrayCollection implements IPagingCollection
21 | {
22 | private var _nextCursor:String;
23 | private var _previousCursor:String;
24 |
25 | public function ListsCollection(source:Array=null)
26 | {
27 | super(source);
28 | }
29 |
30 | /**
31 | *
32 | * Cursor of the next page.
33 | *
34 | */
35 | public function get previousCursor():String
36 | {
37 | return _previousCursor;
38 | }
39 | public function set previousCursor(value:String):void
40 | {
41 | _previousCursor = value;
42 | }
43 |
44 | /**
45 | *
46 | * Cursor of the previous page.
47 | *
48 | */
49 | public function get nextCursor():String
50 | {
51 | return _nextCursor;
52 | }
53 | public function set nextCursor(value:String):void
54 | {
55 | _nextCursor = value;
56 | }
57 |
58 | }
59 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/collections/StatusesCollection.as:
--------------------------------------------------------------------------------
1 | /** StatusesCollection.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data.collections
9 | {
10 | import mx.collections.ArrayCollection;
11 |
12 | /**
13 | * Collection of Twitter Statuses
14 | * @author Denis Borisenko
15 | *
16 | */
17 | public class StatusesCollection extends ArrayCollection
18 | {
19 | public function StatusesCollection(source:Array=null)
20 | {
21 | super(source);
22 | }
23 |
24 | }
25 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/data/collections/UsersCollection.as:
--------------------------------------------------------------------------------
1 | /** UsersCollection.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.data.collections
9 | {
10 | import com.dborisenko.api.twitter.interfaces.IPagingCollection;
11 |
12 | import mx.collections.ArrayCollection;
13 |
14 | [Bindable]
15 | /**
16 | * Collection of Twitter Users. Can be broken into pages. In this case, nextCursor and previousCursor -
17 | * cursors of next and previous pages.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class UsersCollection extends ArrayCollection implements IPagingCollection
22 | {
23 | private var _nextCursor:String;
24 | private var _previousCursor:String;
25 |
26 | public function UsersCollection(source:Array=null)
27 | {
28 | super(source);
29 | }
30 |
31 | /**
32 | *
33 | * Cursor of the next page.
34 | *
35 | */
36 | public function get previousCursor():String
37 | {
38 | return _previousCursor;
39 | }
40 |
41 | public function set previousCursor(value:String):void
42 | {
43 | _previousCursor = value;
44 | }
45 |
46 | /**
47 | *
48 | * Cursor of the previous page.
49 | *
50 | */
51 | public function get nextCursor():String
52 | {
53 | return _nextCursor;
54 | }
55 |
56 | public function set nextCursor(value:String):void
57 | {
58 | _nextCursor = value;
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/events/TwitterEvent.as:
--------------------------------------------------------------------------------
1 | /** TwitterEvent.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.events
9 | {
10 | import com.dborisenko.api.events.DataEvent;
11 |
12 | /**
13 | * Event is dispatched by TwitterOperation
14 | * @author Denis Borisenko
15 | * @see com.dborisenko.api.twitter.net.TwitterOperation
16 | */
17 | public class TwitterEvent extends DataEvent
18 | {
19 | /**
20 | * When operation complete, TwitterOperation dispatches TwitterEvent.COMPLETE event.
21 | * @see com.dborisenko.api.twitter.net.TwitterOperation
22 | */
23 | public static const COMPLETE:String = "complete";
24 |
25 | /**
26 | * The result of Twitter Operation.
27 | * true, if operation is completed successfully (data contains result).
28 | * false, in other case (data contains description of the error).
29 | * @see com.dborisenko.api.twitter.net.TwitterOperation
30 | */
31 | public var success:Boolean;
32 |
33 | public function TwitterEvent(type:String, data:Object=null, success:Boolean=false, bubbles:Boolean=false, cancelable:Boolean=false)
34 | {
35 | super(type, data, bubbles, cancelable);
36 | this.success = success;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/events/TwitterStreamingEvent.as:
--------------------------------------------------------------------------------
1 | package com.dborisenko.api.twitter.events
2 | {
3 | import com.dborisenko.api.twitter.data.StreamingObject;
4 |
5 | public class TwitterStreamingEvent extends TwitterEvent
6 | {
7 |
8 | public static const PROGRESS:String = "progress";
9 | public static const STREAM_ERROR:String = "streamError";
10 |
11 | public var streamObject:StreamingObject;
12 |
13 | public function TwitterStreamingEvent(type:String, streamObject:StreamingObject = null,
14 | success:Boolean=false, info:Object = null, bubbles:Boolean=false, cancelable:Boolean=false)
15 | {
16 | this.streamObject = streamObject;
17 | super(type, info, success, bubbles, cancelable);
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/interfaces/IPagingCollection.as:
--------------------------------------------------------------------------------
1 | /** IPagingCollection.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.interfaces
9 | {
10 | /**
11 | * Collection with many pages. The collection is broken into pages. nextCursor and previousCursor -
12 | * cursors of next and previous pages.
13 | * @author Denis Borisenko
14 | *
15 | */
16 | public interface IPagingCollection
17 | {
18 | /**
19 | *
20 | * Cursor of the next page.
21 | *
22 | */
23 | function get nextCursor():String;
24 | function set nextCursor(value:String):void;
25 |
26 | /**
27 | *
28 | * Cursor of the previous page.
29 | *
30 | */
31 | function get previousCursor():String;
32 | function set previousCursor(value:String):void;
33 | }
34 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/interfaces/IPagingOperation.as:
--------------------------------------------------------------------------------
1 | /** IPagingOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.interfaces
9 | {
10 | import com.dborisenko.api.interfaces.IOperation;
11 |
12 | /**
13 | * Interface for the multipage collection operations.
14 | * @author Denis Borisenko
15 | *
16 | */
17 | public interface IPagingOperation extends IOperation
18 | {
19 | /**
20 | *
21 | * Cursor of the current page.
22 | *
23 | */
24 | function get cursor():String;
25 | function set cursor(value:String):void;
26 | }
27 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/interfaces/ISinceIdOperation.as:
--------------------------------------------------------------------------------
1 | /** ISinceIdOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.interfaces
9 | {
10 | /**
11 | * Interface with sinceId value.
12 | * @author Denis Borisenko
13 | *
14 | */
15 | public interface ISinceIdOperation
16 | {
17 | function get sinceId():String;
18 | function set sinceId(value:String):void;
19 | }
20 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/interfaces/ITwitterOperation.as:
--------------------------------------------------------------------------------
1 | /** ITwitterOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.interfaces
9 | {
10 | import com.dborisenko.api.interfaces.IOperation;
11 | import com.dborisenko.api.twitter.TwitterAPI;
12 | import com.dborisenko.api.twitter.twitter_internal;
13 |
14 | /**
15 | *
16 | * Interface for the Twitter Operations.
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public interface ITwitterOperation extends IOperation
21 | {
22 | /**
23 | *
24 | * Is operation requests authentication.
25 | *
26 | */
27 | function get requiresAuthentication():Boolean;
28 |
29 | /**
30 | *
31 | * Is operation rate limited.
32 | *
33 | */
34 | function get apiRateLimited():Boolean;
35 |
36 | function setTwitterAPI(api:TwitterAPI):void
37 | }
38 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/DirectMessageOperation.as:
--------------------------------------------------------------------------------
1 | /** DirectMessageOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterDirectMessage;
11 |
12 | import flash.events.Event;
13 |
14 | /**
15 | *
16 | * Base operation for work with Twitter Direct Message
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public class DirectMessageOperation extends TwitterOperation
21 | {
22 | private var isSent:Boolean = true;
23 |
24 | public function DirectMessageOperation(url:String, requiresAuthentication:Boolean=true,
25 | params:Object=null, isSent:Boolean=true)
26 | {
27 | super(url, requiresAuthentication, params);
28 |
29 | this.isSent = isSent;
30 | }
31 |
32 | /**
33 | *
34 | * Twitter Direct Message, received by the operation.
35 | *
36 | */
37 | [Bindable]
38 | public function get directMessage():TwitterDirectMessage
39 | {
40 | return data as TwitterDirectMessage;
41 | }
42 | public function set directMessage(value:TwitterDirectMessage):void
43 | {
44 | data = value;
45 | }
46 |
47 | /**
48 | *
49 | * @private
50 | *
51 | */
52 | override protected function handleResult(event:Event) : void
53 | {
54 | var json:Object = getJSON();
55 | directMessage = new TwitterDirectMessage(json);
56 | directMessage.isSent = isSent;
57 |
58 | super.handleResult(event);
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/DirectMessagesOperation.as:
--------------------------------------------------------------------------------
1 | /** DirectMessagesOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterDirectMessage;
11 | import com.dborisenko.api.twitter.data.collections.DirectMessagesCollection;
12 |
13 | import flash.events.Event;
14 |
15 | /**
16 | *
17 | * Base operation for work with Collection of Twitter Direct Messages
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class DirectMessagesOperation extends TwitterOperation
22 | {
23 | private var isSent:Boolean = false;
24 |
25 | public function DirectMessagesOperation(url:String, isSent:Boolean=false,
26 | requiresAuthentication:Boolean=true)
27 | {
28 | super(url, requiresAuthentication);
29 |
30 | this.isSent = isSent;
31 | }
32 |
33 | /**
34 | *
35 | * Collection of Twitter Direct Messages, received by the operation.
36 | *
37 | */
38 | [Bindable]
39 | public function get directMessages():DirectMessagesCollection
40 | {
41 | return data as DirectMessagesCollection;
42 | }
43 | public function set directMessages(value:DirectMessagesCollection):void
44 | {
45 | data = value;
46 | }
47 |
48 | /**
49 | *
50 | * @private
51 | *
52 | */
53 | override protected function handleResult(event:Event) : void
54 | {
55 |
56 | var json:Object = getJSON(); //array of dm objects.
57 | directMessages = new DirectMessagesCollection();
58 |
59 | for each (var item:Object in json)
60 | {
61 | var dm:TwitterDirectMessage = new TwitterDirectMessage(item);
62 | dm.isSent = isSent;
63 | directMessages.addItem(dm);
64 | }
65 |
66 | super.handleResult(event);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/HashOperation.as:
--------------------------------------------------------------------------------
1 | /** HashOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 |
12 | import flash.events.Event;
13 | import flash.utils.Dictionary;
14 |
15 | /**
16 | *
17 | * Base operation for work with Twitter Hash results
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class HashOperation extends TwitterOperation
22 | {
23 | public function HashOperation(url:String, requiresAuthentication:Boolean=true,
24 | params:Object=null, resultFormat:String=ResultFormat.XML)
25 | {
26 | super(url, requiresAuthentication, params, resultFormat);
27 | }
28 |
29 | /**
30 | *
31 | * Hash dictionary, received by the operation.
32 | *
33 | */
34 | [Bindable]
35 | public function get hash():Dictionary
36 | {
37 | return data as Dictionary;
38 | }
39 | public function set hash(value:Dictionary):void
40 | {
41 | data = value;
42 | }
43 |
44 | /**
45 | *
46 | * @private
47 | *
48 | */
49 | override protected function handleResult(event:Event) : void
50 | {
51 | if (!data)
52 | {
53 | hash = parseHash(getXML());
54 | }
55 | super.handleResult(event);
56 | }
57 |
58 | /**
59 | * Parser for the hash dictionary
60 | *
61 | */
62 | protected function parseHash(xml:XML):Dictionary
63 | {
64 | var result:Dictionary;
65 | if (xml.name() == "hash")
66 | {
67 | result = new Dictionary();
68 | for each (var item:XML in xml.children())
69 | {
70 | var name:String = item.name().toString();
71 | var type:String = item.@type.toString();
72 | var value:Object;
73 | var str:String = item.text().toString();
74 | switch (type)
75 | {
76 | case "integer":
77 | value = int(str);
78 | break;
79 | case "datetime":
80 | value = new Date(Date.parse(str.replace(/-/g, "/").replace("T", " ").replace("+", " +")));
81 | break;
82 | default:
83 | value = str;
84 | break;
85 | }
86 | result[name] = value;
87 | }
88 | }
89 | return result;
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/ListOperation.as:
--------------------------------------------------------------------------------
1 | /** ListOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterList;
11 |
12 | import flash.events.Event;
13 |
14 | /**
15 | *
16 | * Base operation for work with Twitter List
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public class ListOperation extends TwitterOperation
21 | {
22 | public function ListOperation(url:String, requiresAuthentication:Boolean=true,
23 | params:Object=null)
24 | {
25 | super(url, requiresAuthentication, params);
26 | }
27 |
28 | /**
29 | *
30 | * Twitter List, received by the operation.
31 | *
32 | */
33 | [Bindable]
34 | public function get list():TwitterList
35 | {
36 | return data as TwitterList;
37 | }
38 | public function set list(value:TwitterList):void
39 | {
40 | data = value;
41 | }
42 |
43 | /**
44 | *
45 | * @private
46 | *
47 | */
48 | override protected function handleResult(event:Event) : void
49 | {
50 | var json:Object = getJSON();
51 | list = new TwitterList(json);
52 | super.handleResult(event);
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/ListsOperation.as:
--------------------------------------------------------------------------------
1 | /** ListsOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterList;
11 | import com.dborisenko.api.twitter.data.collections.ListsCollection;
12 |
13 | import flash.events.Event;
14 |
15 | /**
16 | *
17 | * Base operation for work with Collection of Twitter Lists
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class ListsOperation extends TwitterOperation
22 | {
23 | public function ListsOperation(url:String, requiresAuthentication:Boolean=true, params:Object=null)
24 | {
25 | super(url, requiresAuthentication, params, resultFormat);
26 | }
27 |
28 | /**
29 | *
30 | * Collection of the Twitter Lists, received by the operation.
31 | *
32 | */
33 | [Bindable]
34 | public function set lists(value:ListsCollection):void
35 | {
36 | data = value;
37 | }
38 | public function get lists():ListsCollection
39 | {
40 | return data as ListsCollection;
41 | }
42 |
43 | /**
44 | *
45 | * @private
46 | *
47 | */
48 | override protected function handleResult(event:Event) : void
49 | {
50 |
51 | var json:Object = getJSON();
52 |
53 | if(json['lists']){
54 | lists = new ListsCollection();
55 | lists.nextCursor = json['next_cursor_str'];
56 | lists.previousCursor = json['previous_cursor_str'];
57 |
58 | for each (var item:Object in json['lists']){
59 | var list:TwitterList = new TwitterList(item);
60 | lists.addItem(list);
61 | }
62 | }
63 |
64 | super.handleResult(event);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/SearchOperation.as:
--------------------------------------------------------------------------------
1 | /** SearchOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.enums.ResultFormat;
11 | import com.dborisenko.api.twitter.data.TwitterSearch;
12 | import com.dborisenko.api.twitter.data.TwitterStatus;
13 |
14 | import flash.events.Event;
15 |
16 | import mx.collections.ArrayCollection;
17 |
18 | /**
19 | *
20 | * Base operation for work with Twitter Search
21 | * @author Denis Borisenko
22 | *
23 | */
24 | public class SearchOperation extends TwitterOperation
25 | {
26 | public function SearchOperation(url:String)
27 | {
28 | super(url, false, params, ResultFormat.JSON);
29 | }
30 |
31 | /**
32 | *
33 | * Twitter Search result, received by the operation.
34 | *
35 | */
36 | [Bindable]
37 | public function get searchData():TwitterSearch
38 | {
39 | return data as TwitterSearch;
40 | }
41 | public function set searchData(value:TwitterSearch):void
42 | {
43 | data = value;
44 | }
45 |
46 |
47 |
48 | /**
49 | *
50 | * @private
51 | *
52 | */
53 | override protected function handleResult(event:Event) : void
54 | {
55 | var json:Object = getJSON();
56 | searchData = new TwitterSearch();
57 | if ("statuses" in json)
58 | {
59 | var res:ArrayCollection = new ArrayCollection();
60 | var array:Array = json["statuses"] as Array;
61 | for each (var item:Object in array)
62 | {
63 | var status:TwitterStatus = new TwitterStatus(item, null, false, true); //last param is if it is a search.
64 | res.addItem(status);
65 | }
66 | searchData.results = res;
67 | }
68 | if ("query" in json)
69 | {
70 | searchData.query = json["query"].toString();
71 | searchData.maxResultId = json['max_id_str'];
72 | searchData.nextPage = json['next_page'];
73 | searchData.page = json['page'];
74 | searchData.refreshURL = json['refresul_url'];
75 | // searchData.query = data.query.replace(/%40/g, "@");
76 | // searchData.query = data.query.replace(/%23/g, "#");
77 | }
78 | super.handleResult(event);
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/StatusOperation.as:
--------------------------------------------------------------------------------
1 | /** StatusOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterStatus;
11 |
12 | import flash.events.Event;
13 |
14 | /**
15 | *
16 | * Base operation for work with Twitter Status
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public class StatusOperation extends TwitterOperation
21 | {
22 | public function StatusOperation(url:String, requiresAuthentication:Boolean=true,
23 | params:Object=null)
24 | {
25 | super(url, requiresAuthentication, params);
26 | }
27 |
28 | /**
29 | *
30 | * Twitter Status, received by the operation.
31 | *
32 | */
33 | [Bindable]
34 | public function get status():TwitterStatus
35 | {
36 | return data as TwitterStatus;
37 | }
38 | public function set status(value:TwitterStatus):void
39 | {
40 | data = value;
41 | }
42 |
43 | /**
44 | *
45 | * @private
46 | *
47 | */
48 | override protected function handleResult(event:Event) : void
49 | {
50 | var json:Object = getJSON();
51 | try{
52 | status = new TwitterStatus(json);
53 | }
54 | catch(e:Error)
55 | {
56 | trace("Error parsing Twitter Status object" + e.message);
57 | }
58 | super.handleResult(event);
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/StatusesOperation.as:
--------------------------------------------------------------------------------
1 | /** StatusesOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterStatus;
11 | import com.dborisenko.api.twitter.data.collections.StatusesCollection;
12 |
13 | import flash.events.Event;
14 |
15 | /**
16 | *
17 | * Base operation for work with Collection of Twitter Statuses
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class StatusesOperation extends TwitterOperation
22 | {
23 | private var isMention:Boolean = false;
24 |
25 | public function StatusesOperation(url:String, requiresAuthentication:Boolean = true,
26 | params:Object=null, isMentions:Boolean=false)
27 | {
28 | super(url, requiresAuthentication, params);
29 | this.isMention = isMentions;
30 | }
31 |
32 | /**
33 | *
34 | * Collection of Twitter Statuses, received by the operation.
35 | *
36 | */
37 | [Bindable]
38 | public function get statuses():StatusesCollection
39 | {
40 | return data as StatusesCollection;
41 | }
42 | public function set statuses(value:StatusesCollection):void
43 | {
44 | data = value;
45 | }
46 |
47 | /**
48 | *
49 | * @private
50 | *
51 | */
52 | override protected function handleResult(event:Event) : void
53 | {
54 | //trace(this.serviceDelegate.url);
55 | //trace(getResult().toString());
56 | var json:Array = getJSON() as Array;
57 | statuses = new StatusesCollection();
58 |
59 | for each (var item:Object in json)
60 | {
61 | var status:TwitterStatus = new TwitterStatus(item);
62 | status.isMention = isMention;
63 | statuses.addItem(status);
64 | }
65 |
66 | super.handleResult(event);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/net/UserOperation.as:
--------------------------------------------------------------------------------
1 | /** UserOperation.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.net
9 | {
10 | import com.dborisenko.api.twitter.data.TwitterUser;
11 |
12 | import flash.events.Event;
13 |
14 | /**
15 | *
16 | * Base operation for work with Twitter User
17 | * @author Denis Borisenko
18 | *
19 | */
20 | public class UserOperation extends TwitterOperation
21 | {
22 | public function UserOperation(url:String, requiresAuthentication:Boolean=true, params:Object=null)
23 | {
24 | super(url, requiresAuthentication, params);
25 | }
26 |
27 | /**
28 | *
29 | * Twitter User, received by the operation.
30 | *
31 | */
32 | [Bindable]
33 | public function set user(value:TwitterUser):void
34 | {
35 | data = value;
36 | }
37 | public function get user():TwitterUser
38 | {
39 | return data as TwitterUser;
40 | }
41 |
42 | /**
43 | *
44 | * @private
45 | *
46 | */
47 | override protected function handleResult(event:Event) : void
48 | {
49 | var json:Object = getJSON();
50 | user = new TwitterUser(json);
51 | super.handleResult(event);
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/oauth/events/OAuthTwitterEvent.as:
--------------------------------------------------------------------------------
1 | /** OAuthTwitterEvent.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.oauth.events
9 | {
10 | import flash.events.Event;
11 |
12 | /**
13 | * Event of the OAuth authentication
14 | * @author Denis Borisenko
15 | *
16 | */
17 | public class OAuthTwitterEvent extends Event
18 | {
19 | /**
20 | * Error of receiving request token.
21 | */
22 | public static const REQUEST_TOKEN_ERROR:String = "requestTokenError";
23 | /**
24 | * Request token received.
25 | */
26 | public static const REQUEST_TOKEN_RECEIVED:String = "requestTokenReceived";
27 | /**
28 | * Error of receiving access token.
29 | */
30 | public static const ACCESS_TOKEN_ERROR:String = "accessTokenError";
31 | /**
32 | * Authentication successfully complete.
33 | */
34 | public static const AUTHORIZED:String = "authorized";
35 |
36 | /**
37 | * Data object of OAuth authentication event.
38 | */
39 | [Bindable]
40 | public var data:Object;
41 |
42 | public function OAuthTwitterEvent(type:String, data:Object=null, bubbles:Boolean=false, cancelable:Boolean=false)
43 | {
44 | super(type, bubbles, cancelable);
45 | this.data = data;
46 | }
47 |
48 | override public function clone():Event
49 | {
50 | var event:OAuthTwitterEvent = new OAuthTwitterEvent(this.type,this.data,this.bubbles,this.cancelable);
51 | return event;
52 | }
53 |
54 | }
55 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/twitter_internal.as:
--------------------------------------------------------------------------------
1 | /** twitter_internal.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter
9 | {
10 | /**
11 | * Internal namespace of Twitter API.
12 | */
13 | public namespace twitter_internal = "http://dborisenko.com/api/twitter/";
14 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/AsyncQueue.as:
--------------------------------------------------------------------------------
1 | /** AsyncQueue.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils
9 | {
10 | import com.dborisenko.api.twitter.events.TwitterEvent;
11 | import com.dborisenko.api.twitter.interfaces.ITwitterOperation;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import flash.events.Event;
15 | import flash.utils.Dictionary;
16 |
17 | import mx.collections.ArrayCollection;
18 | import mx.collections.Sort;
19 |
20 | /**
21 | * Async queue class.
22 | * @author Denis Borisenko
23 | *
24 | */
25 | public class AsyncQueue
26 | {
27 | protected var operationsQueue:ArrayCollection;
28 | protected var currentOperation:ITwitterOperation;
29 |
30 | protected var priorities:Dictionary;
31 |
32 | public function AsyncQueue()
33 | {
34 | operationsQueue = new ArrayCollection();
35 | priorities = new Dictionary();
36 |
37 | var sort:Sort = new Sort();
38 | sort.compareFunction = function(a:Object, b:Object, fields:Array = null):int
39 | {
40 | var o1:Object = priorities[a];
41 | var o2:Object = priorities[b];
42 |
43 | var pos1:int = (o1 != null ? int(o1) : -1);
44 | var pos2:int = (o2 != null ? int(o2) : -1);
45 |
46 | if (pos1 == -1 && pos2 == -1)
47 | return 0;
48 | if (pos1 == -1)
49 | return 1;
50 | if (pos2 == -1)
51 | return -1;
52 | if (pos1 > pos2)
53 | return -1;
54 | if (pos1 < pos2)
55 | return 1;
56 | return 0;
57 | };
58 | operationsQueue.sort = sort;
59 |
60 | operationsQueue.refresh();
61 | }
62 |
63 | public function executeOperation(operation:ITwitterOperation, priority:int=5):void
64 | {
65 | if (!operation)
66 | return;
67 |
68 | operationsQueue.addItem(operation);
69 | priorities[operation] = priority;
70 | operationsQueue.refresh();
71 |
72 | if (!currentOperation)
73 | {
74 | executeNextOperation();
75 | }
76 | }
77 |
78 | protected function executeNextOperation():void
79 | {
80 | if (operationsQueue.length > 0)
81 | {
82 | currentOperation = operationsQueue.removeItemAt(0) as ITwitterOperation;
83 | delete priorities[currentOperation];
84 | currentOperation.addEventListener(TwitterEvent.COMPLETE, handleOperationComplete);
85 |
86 | currentOperation.execute();
87 | }
88 | }
89 |
90 | protected function handleOperationComplete(event:Event):void
91 | {
92 | currentOperation.removeEventListener(TwitterEvent.COMPLETE, handleOperationComplete);
93 | currentOperation = null;
94 | executeNextOperation();
95 | }
96 | }
97 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/loaders/pagingLoaders/FollowersLoader.as:
--------------------------------------------------------------------------------
1 | /** FollowersLoader.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils.loaders.pagingLoaders
9 | {
10 | import com.dborisenko.api.twitter.TwitterAPI;
11 | import com.dborisenko.api.twitter.commands.user.LoadFollowers;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import mx.collections.ArrayCollection;
15 |
16 | /**
17 | * Followers Loader class. Loads all the pages of the followers.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class FollowersLoader extends PagingLoader
22 | {
23 |
24 | protected var userId:String;
25 | protected var screenName:String;
26 | protected var stringIds:Boolean = true;
27 |
28 | /**
29 | * @param API Required. The API to execute this command against.
30 | *
31 | * @param userId Optional. Specfies the ID of the user for whom to return the list of followers.
32 | * Helpful for disambiguating when a valid user ID is also a valid screen name.
33 | * Example: user_id=1401881
34 | * @param screenName Optional. Specfies the screen name of the user for whom to return the list of followers.
35 | * Helpful for disambiguating when a valid screen name is also a user ID.
36 | * Example: screen_name=101010
37 | *
38 | * @param stringIds Optional. returns the IDs as strings instead of ints. Defaults to true because I'm not
39 | * sure if Flash can handle the larger numbers.
40 | *
41 | */
42 | public function FollowersLoader(api:TwitterAPI,
43 | userId:String = null, screenName:String = null, stringIds:Boolean = true,
44 | postType:String=TwitterAPI.POST_TYPE_NORMAL,
45 | priority:int=TwitterAPI.PRIORITY_NORMAL, list:ArrayCollection=null)
46 | {
47 | super(api, LoadFollowers, postType, priority, list);
48 | this.userId = userId;
49 | this.screenName = screenName;
50 | this.stringIds = stringIds;
51 | }
52 |
53 | public function get followersList():ArrayCollection
54 | {
55 | return list;
56 | }
57 |
58 | override protected function createOperation() : TwitterOperation
59 | {
60 | return new LoadFollowers(userId, screenName, "-1", stringIds) //cursor is overridden in PagingLoader.
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/loaders/pagingLoaders/FriendsLoader.as:
--------------------------------------------------------------------------------
1 | /** FriendsLoader.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils.loaders.pagingLoaders
9 | {
10 | import com.dborisenko.api.twitter.TwitterAPI;
11 | import com.dborisenko.api.twitter.commands.user.LoadFriends;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import mx.collections.ArrayCollection;
15 |
16 | /**
17 | * Friends Loader class. Loads all the pages of the friends.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class FriendsLoader extends PagingLoader
22 | {
23 | protected var userId:String;
24 | protected var screenName:String;
25 | protected var stringIds:Boolean = true;
26 |
27 |
28 |
29 | /**
30 | * You must provide either a userId or a screenName.
31 | *
32 | * @param api Required. The API to run command against.
33 | *
34 | * @param userId Optional. Specfies the ID of the user for whom to return the list of friends.
35 | * Helpful for disambiguating when a valid user ID is also a valid screen name.
36 | * Example: user_id=1401881
37 | *
38 | * @param screenName Optional. Specfies the screen name of the user for whom to return the list of friends.
39 | * Helpful for disambiguating when a valid screen name is also a user ID.
40 | * Example: screen_name=101010
41 | *
42 | * @param stringIds Optional. Whether or not to make the returned user ids into strings. This defaults
43 | * to true because I'm not sure if Flash can handle the large numbers.
44 | *
45 | */
46 | public function FriendsLoader(api:TwitterAPI,
47 | userId:String=null, screenName:String=null, stringIds:Boolean = true,
48 | postType:String=TwitterAPI.POST_TYPE_NORMAL,
49 | priority:int=TwitterAPI.PRIORITY_NORMAL, list:ArrayCollection=null)
50 | {
51 | super(api, LoadFriends, postType, priority, list);
52 | this.userId = userId;
53 | this.screenName = screenName;
54 | this.stringIds = stringIds;
55 | }
56 |
57 | public function get friendsList():ArrayCollection
58 | {
59 | return list;
60 | }
61 |
62 | override protected function createOperation() : TwitterOperation
63 | {
64 | return new LoadFriends(userId, screenName, '-1', stringIds);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/loaders/pagingLoaders/ListMembersLoader.as:
--------------------------------------------------------------------------------
1 | /** ListMembersLoader.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils.loaders.pagingLoaders
9 | {
10 | import com.dborisenko.api.twitter.TwitterAPI;
11 | import com.dborisenko.api.twitter.commands.listMembers.LoadListMembers;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import mx.collections.ArrayCollection;
15 |
16 | /**
17 | * List Members Loader class. Loads all the pages of the list members.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class ListMembersLoader extends PagingLoader
22 | {
23 | protected var listId:String;
24 | protected var slug:String;
25 | protected var ownerScreenName:String;
26 | protected var ownerId:String;
27 | protected var entities:Boolean = true;
28 | protected var skipStatus:Boolean = false;
29 |
30 | /**
31 | * @param API Required. The Twitter API to run command against.
32 | *
33 | * @param listId Optional. The id or slug of the list.
34 | *
35 | * @param slug Optional. The slug of the list. If used, ownerScreenName or ownerId is required.
36 | *
37 | * @param ownerScreenName Optional. The screen name of the owner.
38 | *
39 | * @param ownerId Optional. The id of the owner.
40 | *
41 | * @param entities Optional. Include entities in the user tweets.
42 | *
43 | * @param skipStatus Optional. Skip the status in returned users.
44 | *
45 | */
46 | public function ListMembersLoader(api:TwitterAPI,
47 | listId:String = null, slug:String = null, ownerScreenName:String = null, ownerId:String = null,
48 | entities:Boolean = true, skipStatus:Boolean = false,
49 | postType:String=TwitterAPI.POST_TYPE_NORMAL,
50 | priority:int=TwitterAPI.PRIORITY_NORMAL, list:ArrayCollection=null)
51 | {
52 | super(api, LoadListMembers, postType, priority, list);
53 | this.listId = listId;
54 | this.slug = slug;
55 | this.ownerScreenName = ownerScreenName;
56 | this.ownerId = ownerId;
57 | this.entities = entities;
58 | this.skipStatus = skipStatus;
59 | }
60 |
61 | override protected function createOperation() : TwitterOperation
62 | {
63 | return new LoadListMembers(listId, slug, ownerScreenName, ownerId, '-1', entities, skipStatus);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/loaders/pagingLoaders/ListMembershipsLoader.as:
--------------------------------------------------------------------------------
1 | /** ListMembershipsLoader.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils.loaders.pagingLoaders
9 | {
10 | import com.dborisenko.api.twitter.TwitterAPI;
11 | import com.dborisenko.api.twitter.commands.list.LoadListMemberships;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import mx.collections.ArrayCollection;
15 |
16 | /**
17 | * List Memberships Loader class. Loads all the pages of the list memberships.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class ListMembershipsLoader extends PagingLoader
22 | {
23 | protected var userId:String;
24 | protected var screenName:String;
25 | protected var ownedlists:Boolean = false;
26 |
27 | /**
28 | *
29 | * @param userId Optional. The id of the user for whom to return results for. If blank, defaults to authenticated user.
30 | *
31 | * @param screenName Optional. The screen name of the whom to return results for. If blank, defaults to authenticated user.
32 | *
33 | * @param ownedLists Optional. When set to true will return just lists the authenticating user owns and the user represented
34 | * by userId or screenName is a member of.
35 | *
36 | */
37 | public function ListMembershipsLoader(api:TwitterAPI,
38 | userId:String = null, screenName:String = null, ownedLists:Boolean = false,
39 | postType:String=TwitterAPI.POST_TYPE_NORMAL,
40 | priority:int=TwitterAPI.PRIORITY_NORMAL, list:ArrayCollection=null)
41 | {
42 | super(api, LoadListMemberships, postType, priority, list);
43 | this.userId = userId;
44 | this.screenName = screenName;
45 | this.ownedlists = ownedLists;
46 | }
47 |
48 | override protected function createOperation() : TwitterOperation
49 | {
50 | return new LoadListMemberships(userId, screenName, '-1', ownedlists);
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/loaders/pagingLoaders/ListSubscriptionsLoader.as:
--------------------------------------------------------------------------------
1 | /** ListSubscriptionsLoader.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils.loaders.pagingLoaders
9 | {
10 | import com.dborisenko.api.twitter.TwitterAPI;
11 | import com.dborisenko.api.twitter.commands.list.LoadListSubscriptions;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import mx.collections.ArrayCollection;
15 |
16 | /**
17 | * List Subscriptions Loader class. Loads all the pages of the list subscriptions.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class ListSubscriptionsLoader extends PagingLoader
22 | {
23 | protected var userId:String;
24 | protected var screenName:String;
25 | protected var count:int;
26 |
27 |
28 | /**
29 | *
30 | * @param userId Optional. The id of the user for whom to return results for. If blank, defaults to authenticated user.
31 | *
32 | * @param screenName Optional. The screen name of the whom to return results for. If blank, defaults to authenticated user.
33 | *
34 | * @param count Optional. the amount of results per page. Defaults to 20, maximum of 1,000.
35 | *
36 | */
37 | public function ListSubscriptionsLoader(api:TwitterAPI,
38 | userId:String = null, screenName:String = null, count:int = -1,
39 | postType:String=TwitterAPI.POST_TYPE_NORMAL,
40 | priority:int=TwitterAPI.PRIORITY_NORMAL, list:ArrayCollection=null)
41 | {
42 | super(api, LoadListSubscriptions, postType, priority, list);
43 | this.userId = userId;
44 | this.screenName = screenName;
45 | this.count = count;
46 | }
47 |
48 | override protected function createOperation() : TwitterOperation
49 | {
50 | return new LoadListSubscriptions(userId, screenName, count, '-1');
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/twitter/utils/loaders/pagingLoaders/ListsOfUserLoader.as:
--------------------------------------------------------------------------------
1 | /** ListsOfUserLoader.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.twitter.utils.loaders.pagingLoaders
9 | {
10 | import com.dborisenko.api.twitter.TwitterAPI;
11 | import com.dborisenko.api.twitter.commands.list.LoadListsOfUser;
12 | import com.dborisenko.api.twitter.net.TwitterOperation;
13 |
14 | import mx.collections.ArrayCollection;
15 |
16 | /**
17 | * Lists of Users Loader class. Loads all the pages of the lists of users.
18 | * @author Denis Borisenko
19 | *
20 | */
21 | public class ListsOfUserLoader extends PagingLoader
22 | {
23 | protected var userId:String;
24 | protected var screenName:String;
25 |
26 | /**
27 | *
28 | * Either screenName or userId is required.
29 | *
30 | * @param userId Optional. The ID of the user for whom to return results for.
31 | *
32 | * @param screenName Optional. The screen name of the user for whom to return results for.
33 | *
34 | *
35 | */
36 | public function ListsOfUserLoader(api:TwitterAPI,
37 | userId:String = null, screenName:String = null,
38 | postType:String=TwitterAPI.POST_TYPE_NORMAL,
39 | priority:int=TwitterAPI.PRIORITY_NORMAL, list:ArrayCollection=null)
40 | {
41 | super(api, LoadListsOfUser, postType, priority, list);
42 | this.userId = userId;
43 | this.screenName = screenName;
44 | }
45 |
46 | override protected function createOperation() : TwitterOperation
47 | {
48 | return new LoadListsOfUser(userId, screenName, '-1');
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/vo/FaultObject.as:
--------------------------------------------------------------------------------
1 | /** FaultObject.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2010.
6 | */
7 | package com.dborisenko.api.vo
8 | {
9 | public class FaultObject extends ValueObject
10 | {
11 | [Bindable]
12 | public var faultString:String;
13 | [Bindable]
14 | public var faultBody:Object;
15 | [Bindable]
16 | public var sender:Object;
17 |
18 | public function FaultObject()
19 | {
20 | super();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/api/vo/ValueObject.as:
--------------------------------------------------------------------------------
1 | /** ValueObject.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Part of TwitterAPI project. Copyright (c) 2009.
6 | * http://code.google.com/p/twitter-actionscript-api/
7 | */
8 | package com.dborisenko.api.vo
9 | {
10 | import flash.events.EventDispatcher;
11 |
12 | [Bindable]
13 | public class ValueObject extends EventDispatcher
14 | {
15 | }
16 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/com/dborisenko/utils/URLUtil.as:
--------------------------------------------------------------------------------
1 | /** URLUtil.as
2 | *
3 | * @author Denis Borisenko
4 | *
5 | * Copyright (c) 2009.
6 | */
7 | package com.dborisenko.utils
8 | {
9 | public class URLUtil
10 | {
11 | public static function utf8Encode(string:String):String
12 | {
13 | string = string.replace(/\r\n/g,'\n');
14 | string = string.replace(/\r/g,'\n');
15 |
16 | var utfString:String = '';
17 |
18 | for (var i:int = 0 ; i < string.length ; i++)
19 | {
20 | var chr:Number = string.charCodeAt(i);
21 | if (chr < 128)
22 | {
23 | utfString += String.fromCharCode(chr);
24 | }
25 | else if ((chr > 127) && (chr < 2048))
26 | {
27 | utfString += String.fromCharCode((chr >> 6) | 192);
28 | utfString += String.fromCharCode((chr & 63) | 128);
29 | }
30 | else
31 | {
32 | utfString += String.fromCharCode((chr >> 12) | 224);
33 | utfString += String.fromCharCode(((chr >> 6) & 63) | 128);
34 | utfString += String.fromCharCode((chr & 63) | 128);
35 | }
36 | }
37 |
38 | return utfString;
39 | }
40 |
41 | public static function urlEncode(string:String):String
42 | {
43 | var urlString:String = '';
44 |
45 | for (var i:int = 0 ; i < string.length ; i++)
46 | {
47 | var chr:Number = string.charCodeAt(i);
48 |
49 | if ((chr >= 48 && chr <= 57) || // 09
50 | (chr >= 65 && chr <= 90) || // AZ
51 | (chr >= 97 && chr <= 122) || // az
52 | chr == 45 || // -
53 | chr == 95 || // _
54 | chr == 46 || // .
55 | chr == 126) // ~
56 | {
57 | urlString += String.fromCharCode(chr);
58 | }
59 | else
60 | {
61 | urlString += '%' + chr.toString(16).toUpperCase();
62 | }
63 | }
64 |
65 | return urlString;
66 | }
67 |
68 | public static function encode(string:String):String
69 | {
70 | return urlEncode(utf8Encode(string));
71 | }
72 |
73 | }
74 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/org/iotashan/oauth/IOAuthSignatureMethod.as:
--------------------------------------------------------------------------------
1 | package org.iotashan.oauth
2 | {
3 | public interface IOAuthSignatureMethod
4 | {
5 | public function IOAuthSignatureMethod()
6 |
7 | function get name():String
8 |
9 | function signRequest(request:OAuthRequest):String
10 | }
11 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/org/iotashan/oauth/OAuthConsumer.as:
--------------------------------------------------------------------------------
1 | package org.iotashan.oauth
2 | {
3 | /**
4 | * The OAuthConsumer class is for holding on to the consumer's key and private strings.
5 | */
6 | public class OAuthConsumer
7 | {
8 | private var _key:String;
9 | private var _secret:String;
10 |
11 | /**
12 | * Constructor class.
13 | *
14 | * @param key Consumer's key. Default is an empty string.
15 | * @param secret Consumer's secret. Default is an empty string.
16 | */
17 | public function OAuthConsumer(key:String="",secret:String="")
18 | {
19 | _key = key;
20 | _secret = secret;
21 | }
22 |
23 | /**
24 | * Consumer key
25 | */
26 | public function get key():String {
27 | return _key;
28 | }
29 |
30 | /**
31 | * @private
32 | */
33 | public function set key(val:String):void {
34 | if (val != _key)
35 | _key = val;
36 | }
37 |
38 | /**
39 | * Consumer secret
40 | */
41 | public function get secret():String {
42 | return _secret;
43 | }
44 |
45 | /**
46 | * @private
47 | */
48 | public function set secret(val:String):void {
49 | if (val != _secret)
50 | _secret = val;
51 | }
52 |
53 | /**
54 | * Returns if the Consumer is empty or not
55 | */
56 | public function get isEmpty():Boolean {
57 | if (key.length == 0 && secret.length == 0) {
58 | return true;
59 | } else {
60 | return false;
61 | }
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/org/iotashan/oauth/OAuthSignatureMethod_HMAC_SHA1.as:
--------------------------------------------------------------------------------
1 | package org.iotashan.oauth
2 | {
3 | import com.dborisenko.utils.URLUtil;
4 | import com.hurlant.crypto.Crypto;
5 | import com.hurlant.crypto.hash.HMAC;
6 | import com.hurlant.util.Base64;
7 | import com.hurlant.util.Hex;
8 |
9 | import flash.utils.ByteArray;
10 |
11 | public class OAuthSignatureMethod_HMAC_SHA1 implements IOAuthSignatureMethod
12 | {
13 | public function OAuthSignatureMethod_HMAC_SHA1()
14 | {
15 | }
16 |
17 | public function get name():String {
18 | return "HMAC-SHA1";
19 | }
20 |
21 | public function signRequest(request:OAuthRequest):String {
22 | // get the signable string
23 | var toBeSigned:String = request.getSignableString();
24 |
25 | // get the secrets to encrypt with
26 | var sSec:String = URLUtil.encode(request.consumer.secret) + "&"
27 | if (request.token)
28 | sSec += URLUtil.encode(request.token.secret);
29 |
30 | // hash them
31 | var hmac:HMAC = Crypto.getHMAC("sha1");
32 | var key:ByteArray = Hex.toArray(Hex.fromString(sSec));
33 | var message:ByteArray = Hex.toArray(Hex.fromString(toBeSigned));
34 |
35 | var result:ByteArray = hmac.compute(key,message);
36 | var ret:String = Base64.encodeByteArray(result);
37 |
38 | return ret;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/org/iotashan/oauth/OAuthSignatureMethod_PLAINTEXT.as:
--------------------------------------------------------------------------------
1 | package org.iotashan.oauth
2 | {
3 | public class OAuthSignatureMethod_PLAINTEXT implements IOAuthSignatureMethod
4 | {
5 | public function OAuthSignatureMethod_PLAINTEXT()
6 | {
7 | }
8 |
9 | public function get name():String {
10 | return "PLAINTEXT";
11 | }
12 |
13 | public function signRequest(request:OAuthRequest):String {
14 | var sSec:String = request.consumer.secret + "&"
15 | if (request.token)
16 | sSec += request.token.secret;
17 |
18 | return sSec;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/library/TwitterAPI/src/org/iotashan/oauth/OAuthToken.as:
--------------------------------------------------------------------------------
1 | package org.iotashan.oauth
2 | {
3 | /**
4 | * The OAuthToken class is for holding on to a Token key and private strings.
5 | */
6 | public class OAuthToken
7 | {
8 | private var _key:String;
9 | private var _secret:String;
10 |
11 | /**
12 | * Constructor class.
13 | *
14 | * @param key Token key. Default is an empty string.
15 | * @param secret Token secret. Default is an empty string.
16 | */
17 | public function OAuthToken(key:String="",secret:String="")
18 | {
19 | _key = key;
20 | _secret = secret;
21 | }
22 |
23 | /**
24 | * Token key
25 | */
26 | public function get key():String {
27 | return _key;
28 | }
29 |
30 | /**
31 | * @private
32 | */
33 | public function set key(val:String):void {
34 | if (val != _key)
35 | _key = val;
36 | }
37 |
38 | /**
39 | * Token secret
40 | */
41 | public function get secret():String {
42 | return _secret;
43 | }
44 |
45 | /**
46 | * @private
47 | */
48 | public function set secret(val:String):void {
49 | if (val != _secret)
50 | _secret = val;
51 | }
52 |
53 | /**
54 | * Returns if the Token is empty or not
55 | */
56 | public function get isEmpty():Boolean {
57 | if (key.length == 0 && secret.length == 0) {
58 | return true;
59 | } else {
60 | return false;
61 | }
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------