def createAlbum(self, name, location, description, v): """ * name, location, description, visible * @return """ j = Json() j.put(u"name", name).put(u"location", location).put(u"description", description).put(u"visibility", java.str(v).replace(u"_", u"-")) return self.fromJson(java.str(j))
def createComment(self, xid, comment): """ Create a comment object with xid and comment. This object can be passed directly to a native javascript function. @return Comment object """ j = Json() j.put(u"xid", xid).put(u"text", comment) return self.fromJson(java.str(j))
def createNote(self, title, content): """ Create a new instance of Note @param title of note @param content of note @return note """ j = Json() j.put(u"title", title).put(u"content", content) return self.fromJson(java.str(j))
def createEventInfo(self, uid, eids, startTime, endTime, status): """ Create filter to be used in event query. Null values will be ignored @param uid int Filter by events associated with a user with this uid. @param eids array Filter by this list of event IDs. This is a comma-separated list of event IDs. @param start_time int Filter with this UTC as lower bound. A missing or zero parameter indicates no lower bound. @param end_time int Filter with this UTC as upper bound. A missing or zero parameter indicates no upper bound. @param rsvp_status string Filter by this RSVP status. The RSVP status should be one of the following strings: @return events that can be used as filter """ j = Json() j.put(u"uid", uid).put(u"eids", eids).put(u"start_time", startTime).put(u"end_time", endTime) j.put(u"rsvp_status", ( java.str(status) if status is not None else None )) return self.fromJson(java.str(j))
def newInstance(self, type, src, href): """ Create new Media @param src media @param href media @return new media object """ j = Json() j.put(u"type", java.str(type)) j.put(u"href", href).put(u"src", src) return j.getJavaScriptObject().cast()
def saveOrUpdate(self): """ Save event to facebook """ jEvent = Json() jEvent.put(u"name", self.nameText.getValue()) jEvent.put(u"host", self.hostText.getValue()) jEvent.put(u"location", self.locationText.getValue()) jEvent.put(u"city", self.cityText.getValue()) selectedCategory = Integer(self.categoryListBox.getValue(self.categoryListBox.getSelectedIndex())) # Save Category selectedSubCategory = Integer(self.subCategoriesListBox.getValue(self.subCategoriesListBox.getSelectedIndex())) jEvent.put(u"category", EventInfo.Category.values()[(selectedCategory - 1)].toString()) jEvent.put(u"subcategory", EventInfo.SubCategory.values()[(selectedSubCategory - 1)].toString()) jEvent.put(u"start_time", Date().getTime() + Long(u"9999999999")) jEvent.put(u"end_time", Date().getTime() + Long(u"9999999999999")) eventInfo = EventInfo.fromJson(java.str(jEvent)) self.outer.add(self.loader) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.outer.remove(self.loader) errorResponse = ErrorResponseUI(caught) errorResponse.center() errorResponse.show() @java.typed(JavaScriptObject) def onSuccess(self, result): self.outer.remove(self.loader) self.outer.add(HTML(u"Created event with ID " + java.str(result))) self.apiClient.eventsCreate(eventInfo, _anonymous()) # Create the event.