I posted a question abt the api returning invalid history ids. I'm trying to figure this out. I think the ids are just not valid in a messages get request, since these are not real messages, rather drafts. I don't know why history list is returning drafts for a messagesAdded request. Can somebody tell me if this is the expected behavior?
{
"history": [
{
"id": "10946109",
"messages": [
{
"id": "15cc8cd840c2945a",
"threadId": "15cc5ccf65733c7f"
}
],
"messagesAdded": [
{
"message": {
...
"labelIds": [
"SENT"
]
}
}
]
},
{
"id": "10975146",
"messages": [
{
...
}
],
"messagesAdded": [
{
"message": {
...
"labelIds": [
"DRAFT"
]
}
}
]
}
If I need to filter for actual messages - not drafts, do I just do labelIds does not contain DRAFT?
Your first question:
Can somebody tell me if this is the expected behavior?
Yes this is expected behavior (replicated). Check this Document regarding History List:
Users.history: list
Lists the history of all changes to the given mailbox. History results
are returned in chronological order (increasing historyId).
Your second question:
If I need to filter for actual messages - not drafts, do I just do labelIds does not contain DRAFT?
Yes there is an actual filter. You can change the "labelId" parameter to anything except "DRAFT" so it would not return draft results in the history.
Below is a simple guide on how to properly filter your messages without returning Draft label types:
To check your list of labelId's, try this Label API Test Link to see your list of labels just to be sure that you will be using a valid "labelId" later in step 3 by executing the API.
Get the value of the "historyId" by executing the Message List API, retrieving a list of message then get one id then use the Message Get API
by entering the ID to retrieve the "historyId". Make sure that the labelId is not a "DRAFT" type or you have to get another id from the list just to avoid returning a "DRAFT" type.
Then execute History API Test Link. Enter your "userId" and the "startHistoryId"(make sure to subtract the value of the "startHistoryId" by 1) of your message and change the "labelId" by using one from the list of labels you retrieved from your GET API in step 2, change the "historyTypes" to "messagesAdded" then click execute.
It should return a list of message under the "labelId" being inputted and not a "DRAFT" type.
Related
I'm trying to use the graph API to get a list of users which have been added to a specific group using the delta feature so I reduce the amount of data that passes through.
However, when I $expand on the members property, I'm only getting the id, and not the specific properties I need (mail and some other details) - despite the fact I'm $selecting it.
The url I'm using for the query is
https://graph.microsoft.com/v1.0/groups/delta?$expand=members($select=id,mail)&$select=members&$filter=id eq '<myGroupId>'
And the data I'm getting returned is:
[...]
"value": [
{
"id": "xxxxx-xxxx-xxx-xxx-xxxxx",
"members#delta": [
{
"#odata.type": "#microsoft.graph.user",
"id": "xxxxxxxxxxxxxxxxxxxx"
},
{
"#odata.type": "#microsoft.graph.user",
"id": "xxxxxxxxxxxxxxxxxxxxx"
},
I want my members#delta to include the details of the member so I don't have to query for them seperately.
According this members#delta property contains only the ids of member objects in the group.
Iam new to React query and my attention got the following information:
Structural sharing only works with JSON-compatible values, any other
value types will always be considered as changed. If you are seeing
performance issues because of large responses for example, you can
disable this feature with the config.structuralSharing flag. If you
are dealing with non-JSON compatible values in your query responses
and still want to detect if data has changed or not, you can define a
data compare function with config.isDataEqual
React query
I changed my server to return an image like data response
app.get("/response", (req, res) => {
res.sendFile(path.join(__dirname, "image.jpg"));
});
But still in my app data remain unchanged. So what do they mean by saying JSON-compatible values?
This is an optimization that comes out of the box but it won't work for what you are describing. This is mostly for JSON API responses. React-query instead of creating a new data every time, it will compare the previous data with the new data and modify the values that have changed.
Or in words of one of the mantainers of the library
This feature makes sure that we keep referential identity of our data on every level. As an example, suppose you have the following data structure:
[
{ "id": 1, "name": "Learn React", "status": "active" },
{ "id": 2, "name": "Learn React Query", "status": "todo" }
]
Now suppose we transition our first todo into the done state, and we make a background refetch. We'll get a completely new json from our backend:
[
- { "id": 1, "name": "Learn React", "status": "active" },
+ { "id": 1, "name": "Learn React", "status": "done" },
{ "id": 2, "name": "Learn React Query", "status": "todo" }
]
Now React Query will attempt to compare the old state and the new and keep as much of the previous state as possible. In our example, the todos array will be new, because we updated a todo. The object with id 1 will also be new, but the object for id 2 will be the same reference as the one in the previous state - React Query will just copy it over to the new result because nothing has changed in it.
This comes in very handy when using selectors for partial subscriptions:
// ✅ will only re-render if _something_ within todo with id:2 changes
// thanks to structural sharing
const { data } = useTodo(2)
As I've hinted before, for selectors, structural sharing will be done twice: Once on the result returned from the queryFn to determine if anything changed at all, and then once more on the result of the selector function. In some instances, especially when having very large datasets, structural sharing can be a bottleneck. It also only works on json-serializable data. If you don't need this optimization, you can turn it off by setting structuralSharing: false on any query.
Source:
https://tkdodo.eu/blog/react-query-render-optimizations#structural-sharing
I'm trying to update a search index (using the Update Indexer) by sending a PUT request to https://searchservicename.search.windows.net/indexes/indexName?api-version=2017-11-11 and it's not working.
If I make the exact same request with the list of fields, the request works as expected and I receive a 200. As soon as I try to add fieldMappings as well, I get an error.
My Json I'm adding to the request as "application/json":
{
"name": "indexName",
"fields": [
<List of Valid Fields w/ Valid Types>
],
"fieldMappings": [
{
"sourceFieldName": "fieldName",
"targetFieldName": "fieldName",
"mappingFunction": {
"name": "base64Encode"
}
}
]
}
When calling the API, the error I'm getting is:
{Search request failed: {"error":{"code":"","message":"The request is invalid. Details: index : A resource without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.\r\n"}}
I expect the request to return 200 and have the field mapping added.
The error I get seems to be related to the list of fields but as mentioned before, the request works as expected with the same body minus the field mappings.
Let me know if you need any other information from me - Thanks.
Field mappings should be added to an indexer, not an index. Based on your request, you are trying to update an index.
Context:
The Watson Conversation bot has a node that gets triggered by three input entities from the user, this works fine, but i want the reply from the bot to be
"Checking if you have a lecture tomorrow. Give me a moment"
then there's a query in the background building up the answer that gets replied later to the user.
the strong word tomorrow is an #sys-date entity, but i want it to reply to the user what he/she said instead of the date, because the bot can check no both weeks months ect, all valid date formats, and the reply would look much better if i could use the original text from the user.
This kind of origin retrieval will be used for other entities aswell when i get it working.
You can use the context variable in the case, and if you want to get specific data, you can use regex to extract the user input:
Example all user input
"date": "<? input.text?>"
or for exactly what the user input, ex: "this week"
"date": "<?#sys-date.literal?>"
Etc..
Use the variable with the .literal, see my complete example:
{
"context": {
"date": "<?#sys-date.literal?>"
},
"output": {
"text": {
"values": [
"Checking if you have a lecture $date. Give me a moment."
],
"selection_policy": "sequential"
}
}
}
Documentation examples
:
The playground has an example card that includes a "creator" field with the name and an image representing "Google Glass". The JSON used to create this card is
{
"text": "Hello Explorers,\n\nWelcome to Glass!\n\n+Project Glass\n",
"creator": {
"displayName": "Project Glass",
"imageUrls": [
"https://lh3.googleusercontent.com/-quy9Ox8dQJI/T3xUHhub6PI/AAAAAAAAHAQ/YvjqA3Pw1sM/glass_photos.jpg?sz=360"
]
},
"notification": {
"level": "DEFAULT"
}
}
When this is sent to Glass, however, the imageUrl isn't displayed. The documentation at https://developers.google.com/glass/v1/reference/timeline/insert simply says that "creator" is a "nested object", but with no clear indication what this nested object should be. The example seems to indicate that this should be a Contact (see https://developers.google.com/glass/v1/reference/contacts), and the object returned by the insert seems to be of type "mirror#contact", confirming this.
Does the contact used in a creator need to be pre-created via the contacts API call first? Is there something else necessary to get the creator to display or work correctly?
The creator is currently displayed only if the REPLY menu item is provided along with the timeline item.
This seems like a bug, please file it on our issue tracker