Posts a activity to feed
421258
def _post_activity(self, activity, unserialize=True):
        
        # I think we always want to post to feed
        feed_url = "{proto}://{server}/api/user/{username}/feed".format(
            proto=self._pump.protocol,
            server=self._pump.client.server,
            username=self._pump.client.nickname
        )

        data = self._pump.request(feed_url, method="POST", data=activity)

        if not data:
            return False

        if "error" in data:
            raise PumpException(data["error"])

        if unserialize:
            if "target" in data:
                # we probably want to unserialize target if it's there
                # true for collection.{add,remove}
                self.unserialize(data["target"])
            else:
                # copy activity attributes into object
                if "author" not in data["object"]:
                    data["object"]["author"] = data["actor"]
                for key in ["to", "cc", "bto", "bcc"]:
                    if key not in data["object"] and key in data:
                        data["object"][key] = data[key]

                self.unserialize(data["object"])

        return True
1059821
function feed(op, pnode) {
        if (numStreams > 0) {
            changes.push({op:op, pnode:pnode.toJSON()})
        }
    }
502681
public void doPost (HttpServletRequest request, HttpServletResponse response)
    		throws ServletException, IOException {
        String alertId = request.getParameter("alertId");
        String tel = request.getParameter("tel");
        String alertText = request.getParameter("alertText");        
        if(alertText == null || alertText.length() < 1) {
	        // Get the content of the request as the text to parse
	        byte[] content = new byte[request.getContentLength()];
	        request.getInputStream().read(content,0, request.getContentLength());        
	        alertText = new String(content); 	        
        }
        if(logger.isInfoEnabled()) {
        	logger.info("Got an alert : \n alertID : " + alertId + " \n tel : " + tel + " \n text : " +alertText);
        }
        // 
        try {
        	Properties jndiProps = new Properties();			
			Context initCtx = new InitialContext(jndiProps);
			// Commented out since the preferred way is through SMS Servlets
//        	SleeConnectionFactory factory = (SleeConnectionFactory) initCtx.lookup("java:/MobicentsConnectionFactory");
//        	
//			SleeConnection conn1 = factory.getConnection();
//			ExternalActivityHandle handle = conn1.createActivityHandle();
//
//			EventTypeID requestType = conn1.getEventTypeID(
//					EVENT_TYPE,
//					"org.mobicents", "1.0");
//			SmsAlertingCustomEvent smsAlertingCustomEvent = new SmsAlertingCustomEvent(alertId, tel, alertText);
//			
//			conn1.fireEvent(smsAlertingCustomEvent, requestType, handle, null);
//			conn1.close();
		} catch (Exception e) {
			logger.error("unexpected exception while firing the event " + EVENT_TYPE + " into jslee", e);
		}	
        
        sendHttpResponse(response, OK_BODY);
    }
606283
function xivelyPost(feedId, streamId, apiKey, currentValue) {
    var dataPoint =
    {
        "version":"1.0.0",
        "datastreams" :
        [
            {
                "id" : streamId,
                "current_value" : currentValue
            },
        ]
    };

    var requestUrl = "https://api.xively.com/v2/feeds/" + feedId;

    var options = {
        url: requestUrl,
        headers: {
            "X-ApiKey" : apiKey,
            "Content-Type": "application/json",
            "Accept": "*/*",
            "User-Agent": "nodejs"
        },
        body: JSON.stringify(dataPoint)
    };

    return requestPut(options);
}
90211
public function createActivity()
    {
        $activity = [];
        $activity['actor'] = $this->activityActor();
        $activity['verb'] = $this->activityVerb();
        $activity['object'] = $this->activityObject();
        $activity['foreign_id'] = $this->activityForeignId();
        $activity['time'] = $this->activityTime();

        $to = $this->activityNotify();

        if ( $to !== null )
        {
            $activity['to'] = [];
            foreach ( $to as $feed )
            {
                $activity['to'][] = $feed->getId();
            }
        }

        $extra_data = $this->activityExtraData();

        if ( $extra_data !== null )
        {
            $activity = array_merge($activity, $extra_data);
        }

        return $activity;
    }
274225
def post(self, request, *args, **kwargs):
        
        return self.subscribe(request, *args, **kwargs)
348247
def post(self):
        """"""
        body = tornado.escape.json_decode(self.request.body)

        try:
            self._bo.register(
                params=body["params"],
                target=body["target"],
            )
            print("BO has registered: {} points.".format(len(self._bo.space)), end="\n\n")
        except KeyError:
            pass
        finally:
            suggested_params = self._bo.suggest(self._uf)

        self.write(json.dumps(suggested_params))
260337
public synchronized void post()
   {
    if (tc.isEntryEnabled()) SibTr.entry(tc, "post", ""+count);
      --count;
      if (count >= 0)
         notify();
    if (tc.isEntryEnabled()) SibTr.exit(tc, "post");
   }
1014444
def run(self, target, payload, instance=None, hook_id=None, **kwargs):
        
        self.post_data(target, payload, hook_id)
1208930
def activity_show(self, activity_id, **kwargs):
        ""
        api_path = "/api/v2/activities/{activity_id}.json"
        api_path = api_path.format(activity_id=activity_id)
        return self.call(api_path, **kwargs)
1315155
def do_printActivity(self,args):
        """"""
        parser = CommandArgumentParser("printActivity")
        parser.add_argument(dest='index',type=int,help='refresh');
        args = vars(parser.parse_args(args))
        index = args['index']

        activity = self.activities[index]
        pprint(activity)
935257
function Activities(wixApi) {

    if (!(wixApi instanceof Wix)){
        throw 'WixApi must be provided'
    }
    var wixApi = wixApi;
    this.wixApi = function() {
        return wixApi;
    };

    /**
     * Creates a new WixActivity for the given {@link ActivityType}
     * @method
     * @param {ActivityType} type the type of Activity
     * @returns {WixActivity} returns an empty Wix Activity
     */
    this.newActivity = function(type) {
        var wao = new WixActivity();
        extend(wao, new WixActivityData());
        return wao.withActivityType(type);
    };

    /**
     * Posts the Activity to Wix.  Returns a Promise for an id
     * @param {WixActivity} activity the Activity to post to Wix
     * @param {string} userSessionToken The current session token for active Wix user
     * @returns {Promise.<string, error>} A new id, or an error
     */
    this.postActivity = function(activity, userSessionToken) {
        if(!(activity instanceof WixActivity)) {
            throw 'WixActivity must be provided'
        }
        if(!activity.isValid()) {
            throw 'WixActivity is missing required fields'
        }
        if(!activity.isWritable()){
            throw 'Cannot post read only Activities'
        }

        var deferred = q.defer();
        var request = this.createRequest("POST", "/v1/activities");

        request.withPostData(JSON.stringify(activity.toJSON()));
        request.withQueryParam("userSessionToken", userSessionToken);
        request.asWixQueryParams();
        var options = request.toHttpsOptions();
        rest.postJson('https://' + options.host + options.path, activity, {
            headers : options.headers
        }).on('complete', function(data, response) {
            if(response.statusCode === 200) {
                deferred.resolve(data.activityId);
            } else {
                deferred.reject(data);
            }

        }).on('error', function(data) {
            deferred.reject(data);
        });
        return deferred.promise;
    };
    /**
     * Returns an Activity by a given ID
     * @param {string} activityId The id of the Activity to return
     * @returns {Promise.<WixActivity, error>} An Activity, or an error
     */
    this.getActivityById = function(activityId) {
        if (activityId === undefined || activityId == null || activityId.length == 0){
            throw "Activity Id must be provided"
        }
        return this.resourceRequest(this.createRequest("GET", "/v1/activities/").withPathSegment(activityId),
        function(data) {
            return new WixActivityData().init(data);
        });
    };

    /**
     * Get Activities Query Options
     * @typedef {Object} GetActivitiesOptions
     * @property {?Number} pageSize - The number of results to return per page of data. Valid options are: 25, 50 and 100. Defaults to 25
     * @property {?string} activityTypes - The activity types to filter against. Multiple activity types are separated by a comma
     * @property {?dateTime} until - The ending date for activities we want to return, as an ISO 8601 timestamp This field is only relevant when a cursor is not present
     * @property {?dateTime} from - The     beginning date for activities we want to return, as an ISO 8601 timestamp. This field is only relevant when a cursor is not present
     * @property {?string} scope - The scope of the results to return, either for the entire site or limited to the current application. Can either be site or app. By default, all activities for the site will be returned
     */

    /**
     * Navigates the Activities found on the current site
     * @param {string} cursor The current cursor
     * @param options {GetActivitiesOptions} The Activity to post
     * @returns {Promise.<WixPagingData, error>} A promise for a {@link WixPagingData} object to navigate results, or an error
     */
    this.getActivities = function(cursor, options) {
        var request = this.createRequest("GET", "/v1/activities");
        if(cursor !== undefined && cursor !== null) {
            request.withQueryParam("cursor", cursor);
        }
        if(options !== undefined && options !== null) {
            if(options.from !== undefined && options.from !== null) {
                request.withQueryParam("from", options.from);
            }
            if (options.until !== undefined && options.until !== null) {
                request.withQueryParam("until", options.until);
            }
            if (options.scope !== undefined && options.scope !== null) {
                request.withQueryParam("scope", options.scope);
            }
            if (options.activityTypes !== undefined && options.activityTypes !== null) {
                request.withQueryParam("activityTypes", options.activityTypes);
            }
            if (options.pageSize !== undefined && options.pageSize !== null) {
                request.withQueryParam("pageSize", options.pageSize);
            }
        }
        var wixApi = this;
        return this.resourceRequest(request, function(data) {
            return new WixPagingData(data, function(cursor) {
                return wixApi.getActivities(cursor, null);
            }, function(elem) {
                return new WixActivityData().init(elem);
            });
        });
    };

    /**
     * Returns a list of all activity types contained within the Wix system
     * @returns {Promise.<Array.<string>, error>} A promise for an array of strings
     */
    this.getTypes = function() {
        return this.resourceRequest(this.createRequest("GET", "/v1/activities/types"), null);
    }
}
519046
public ApiResponse postUserActivity(String verb, String title,
            String content, String category, User user, Entity object,
            String objectType, String objectName, String objectContent) {
        Activity activity = Activity.newActivity(verb, title, content,
                category, user, object, objectType, objectName, objectContent);
        return postUserActivity(user.getUuid().toString(), activity);
    }
1069324
protected function addFeed()
	{
		if ($this->params->get('show_feed_link', 1) == 1)
		{
			$link    = '&format=feed&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
		}
	}
375383
def post_intent(self, intent_json):
        """"""
        endpoint = self._intent_uri()
        return self._post(endpoint, data=intent_json)
634585
function writeActivity(template, activity) {
  if (!enabled) {
    return;
  }

  var handlers = outputHandlers.get();

  if (handlers.length === 0) {
    throw new Error('No output handlers defined.');
  }

  handlers.forEach(function(handler) {
    handler(template(activity));
  });
}
602504
@Override
	public Later<String> post(String object, Param... params)
	{
		return this.getBatchForGraph().post(object, params);
	}