How to use ApplyAction - manatee.trello

I've been trying to search for information on how use the copyCard trello action, it looks like I should use Card.ApplyAction, but I am not sure if thats the correct way. I have not found how to set the needed data on the action to copy the card.
Is there a method in Manatee.Trello to copy a card or do I just do it all myself? If there is how do you use it?

To copy a card, you'll need the destination list. If you're just trying to put it in the same list, that's card.List.
Then you can just add a new card using the existing card as a source:
var card = new Card("<card ID>");
var copy = Card.List.Cards.Add(card);
Done!
Edit for completeness
The ActionTypes enum serves two purposes:
Identify the type of action when you get the list of actions (card.Actions) for objects that expose them (boards, lists, cards, etc.)
Filter actions that are included in the Filter() extension method.
You can find out more on the Manatee.Trello wiki
Another edit for more completeness
The card.ApplyAction() method is for web hooks. When a request is received, the content is deserialized as a string and passed to this method. It is an alternative updating mechanism from the default on-demand polling.

Related

Actions Builder checked list value for intent parameter returns no original value for match

I'm running into an issue with the Actions Builder that I think is a bug at Google's side of the Actions Builder platform, but not I'm not a hundred percent sure.
I'm building some sort of a shopping list app (that integrates with backend services). I have an intent to add one or more "generic names" (= product names) to a list.
When I configure the Intent with an InputType like this (notice the List being false),
The input I send to the intent gets parsed correctly, like this:
You see, "kokosolie" is resolved when my query was "add 'kokosnootolie' to the list". In this case, I get both the resolved and the original value of the InputType.
But in my use case, I want to receive multiple values for a "Generic name", so I turn on the "is list" checkbox.
The same query/voice command now results in this:
Only the resolved input type is returned here. While I need this one later in the app's logic, I also need the original values, but Google doesn't return them to me.
Is this a bug or a missing feature at Google's side of things or rather me, missing some configuration?

Filtering a Treeview

I'm new to TypeScript and the VS Code API. I'm looking to learn and am creating an extension that I've wanted a long time in order to do so. I managed to create the functionality I needed (basically a filename filter) using a WebView but I'd prefer using treeview. Here's what I've got:
Unfiltered file list
Filtered file list
Ideally, I'd like to create this:
Is this currently possible and what keywords do I need to research to make it happen?
Thanks
See the demo at https://stackoverflow.com/a/73039858/836330 of filtering in a TreeView. It is not part of the extension-available api though. You could trigger it in an extension with
await vscode.commands.executeCommand('workbench.files.action.focusFilesExplorer');
await vscode.commands.executeCommand('list.find');
but looking at the commit for this functionality I don't think there is any way to populate that find input from an extension - I don't think the command list.find takes any arguments. I tried a couple of ways like
await vscode.commands.executeCommand('list.find', {text: 'findMe'});
await vscode.commands.executeCommand('list.find', {query: 'findMe'});
Other find functionality in vscode can take arguments, but this filtering a treeView is brand new and will probably need a feature request if you want to populate the find input programmatically.

Smart sheet API - replace sheet?

I am using the Smart Sheet Python API.
How can I update data completely using the same sheet ID?
My approach was to loop through the columns and delete them (or delete the rowIDs) to clear out the existing sheet. How can I now load new data to the same sheet so I do not have to reshare it, etc?
Is there a more efficient method?
You could also use the copy_sheet function. This will create a copy of your current sheet, and then using the includes parameter you can specify whether the data is copied, or the shared users are included in the copy.
In your situation, it sounds like you want to have a blank copy of the sheet with the same shared users. That call in Python would look something like this:
copy_response = ss_client.Sheets.copy_sheet(
sheet_ID, # sheet_id
ss_client.models.ContainerDestination({
'destination_type': 'home', # folder, workspace, or home
'destination_id': None, # folder_id
'new_name': 'newSheetName'
}),
'shares' # includes
)
print(copy_response)
For a complete list of the available includes take a look at the Smartsheet API Docs section for Copy Sheet.

Clearing an ObserveableArray located in a separate viewmodel

I need to clear the contents of an observableArray that is located in one viewmodel while the user is in another viewmodel. Can that be done?
For example, lets say I have an observeableArray called myArray. myArray is located in TestPage1.js. The user does something to populate that observeableArray while on TestPage1 and then navigates to TestPage2.js. I need a way to clear the contents of myArray FROM TestPage2 so that when a user returns to TestPage1, no data bound to myArray is displayed.
Clearing the contents before leaving TestPage1 is not an option since the decision to clear or the contents of myArray is really based on what the user does.
I would use event aggregation. I have made one for SignalR, if you have no use for SignalR in your project you can use this one that has the server side functionally striped
http://jsfiddle.net/AV39k/
You subscribe to a event like
MyApp.eventAggregator.subscribe(MyApp.DeleteCustomerMessage, this.customerDeleted, this);
The complete framework can be found here
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy

How to implement copy paste of a resource in REST?

How would you implement copy-paste support in a RESTful way?
Let's say I have book store resource. And books in every store
http://mydomain.com/rest/book-stores/1
http://mydomain.com/rest/book-stores/1/books/12
I need the client to be able to invoke copy paste of a book to another store.
Implementing the following:
PUT http://mydomain.com/rest/books/1/copy-paste
seems very RPC like. Do you have any suggestion how can this operation be modeled in a RESTful way?
Copy = GET http://mydomain.com/book/1
Paste = PUT http://mydomain.com/book/2 or POST http://mydomain.com/book
This is only a problem if your resources are organized to mimic a hierarchical system. Like a file system.
I prefer non-hierarchical resources. The "path" to a file would just be a property of the file. To copy-paste, there are two options.
If you really just want another "path" reference, add another entry for the "path" property. The same exact file is "in" both "folders".
If you need to new version of the file, effectively forking changes thereafter, create a new resource (different URI) with a different "path" property.
To move, just change the "path" property.
If you must insist on hierarchical, just mimic how a file system does copy-paste and move.
The copy is easy. A GET for the resource to copy.
To paste, a POST, because you are creating a new resource, a new URI.
If you need to do a move, you probably need to DELETE the old resource.
If you want, you can specify a location in the delete request, allowing the server to redirect users looking for the moved resource at its old location.
I would have it so that the user executes PUT command to execute the action.
So something like a variable in the form data is contains the correct action to perform.