GAS - create google slide scribble line with script - google-slides-api

I would like to create a line with some point array with google-slide-api script. but I do not found any document about how to do it.
Then I create a line with scribble tool manually then read it by google-slide-api. I got below output:
- Slide #1 contains 1 elements.
elem #0 - {
"line": {
"lineProperties": {
"dashStyle": "SOLID",
"endArrow": "NONE",
"lineFill": {
"solidFill": {
"alpha": 1,
"color": {
"themeColor": "DARK2"
}
}
},
"startArrow": "NONE",
"weight": {
"magnitude": 9525,
"unit": "EMU"
}
}
},
"objectId": "gf0b4bb3376_0_2",
"size": {
"height": {
"magnitude": 786825,
"unit": "EMU"
},
"width": {
"magnitude": 763325,
"unit": "EMU"
}
},
"transform": {
"scaleX": 1,
"scaleY": 1,
"translateX": 1196175,
"translateY": 777044.3325,
"unit": "EMU"
}
}
That means google slide actual create it as a line type but nothing special to define the data points! then it's not possible to create the same from the output json data.

Answer:
Unfortunately, this isn't currently possible.
More Information:
As explained by Iamblichus in this answer, the Slides API does not support this kind of line, and as you have pointed out smoothing between separate lines does not work.
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Google Slides component, with the Feature Request template.

Related

Twitter API 2.0 - Unable to fetch user.fields

I am using API version 2.0 and unable to fetch the user.fields results. All other parameters seem to be returning results correctly. I'm following this documentation.
url = "https://api.twitter.com/2/tweets/search/all"
query_params = {
"query": "APPL",
"max_results": "10",
"tweet.fields": "created_at,lang,text,author_id",
"user.fields": "name,username,created_at,location",
"expansions": "referenced_tweets.id.author_id",
}
response = requests.request("GET", url, headers=headers, params=query_params).json()
Sample result:
{
'author_id': '1251347502013521925',
'text': 'All conspiracy. But watch for bad news on Apple. Such a vulnerable stocktechnically for the biggest market cap # $2.1T ( Thanks Jay). This is the glue for the bulls. But, they stopped innovating when Steve died, built a fancy office and split the stock. $appl',
'lang': 'en',
'created_at': '2021-06-05T02:33:48.000Z',
'id': '1401004298738311168',
'referenced_tweets': [{
'type': 'retweeted',
'id': '1401004298738311168'
}]
}
As you can see, the following information is not returned: name, username, and location.
Any idea how to retrieve this info?
Your query does actually return the correct data. I tested this myself.
A full example response will be structured like this:
{
"data": [
{
"created_at": "2021-06-05T02:33:48.000Z",
"lang": "en",
"id": "1401004298738311168",
"text": "All conspiracy. But watch for bad news on Apple. Such a vulnerable stocktechnically for the biggest market cap # $2.1T ( Thanks Jay). This is the glue for the bulls. But, they stopped innovating when Steve died, built a fancy office and split the stock. $appl",
"author_id": "1251347502013521925",
"referenced_tweets": [
{
"type": "retweeted",
"id": "1401004298738311168"
}
]
}
],
"includes": {
"users": [
{
"name": "Gary Casper",
"id": "1251347502013521925",
"username": "Hisel1979",
"created_at": "2020-07-11T13:39:58.000Z"
}
]
}
}
The sample result you provided comes from within the data object. However, the expanded object data will be nested in the includes object (in your case name, username, and location). The corresponding user object can be referenced via the author_id field.

updateShapeProperties complaining about missing fields property

Details
OS: Manjaro Linux
Node.js version: 10
npm version: 6
googleapis version: 51.0.0
Steps to reproduce
We are sending a google slide API request with updateShapeProperties:
"updateShapeProperties": {
"objectId": objectId,
"shapeProperties": {
"shapeBackgroundFill": {
"solidFill": {
"color": {
"rgbColor": {
"red": r,
"green": g,
"blue": b
}
},
"alpha": 1
}
},
"outline": {
"outlineFill": {
"solidFill": {
"color": {
"rgbColor": {
"red": 0,
"green": 0,
"blue": 0
}
},
"alpha": 0.1
}
},
},
"contentAlignment": "MIDDLE"
},
"fields": "*"
}
where objectId comes from one of any pageElement we get from slide.pageElements
We get a 400 response that states:
message: ""Invalid requests[2].updateShapeProperties: At least one field must be listed in 'fields'. (Use '*' to indicate all fields.)
This somehow used to work the past few months, and was wondering why it suddenly doesn't work right now. Did we have any changes or updates on the updateShapeProperties API?
I believe that [2] of Invalid requests[2].updateShapeProperties is the request body in your question. When I tested your request body, I could replicate your situation. The error message is At least one field must be listed in 'fields'. (Use '*' to indicate all fields.). When I tested "fields": "", I got the same error message. From this situation, I thought that it might be a bug.
When I searched this situation at the Google issue tracker, I found it. Ref
So as the current workaround, in order to avoid this error, in your request body, how about the following modification?
From:
"fields": "*"
To:
"fields": "shapeBackgroundFill,outline,contentAlignment"

install plugin for Open Distro

Amazon Elasticsearch Service offers k-Nearest Neighbor (k-NN) search which can enhance search by similarity use cases.
https://aws.amazon.com/about-aws/whats-new/2020/03/build-k-nearest-neighbor-similarity-search-engine-with-amazon-elasticsearch-service/
I tried this official code that I found here...
https://github.com/opendistro-for-elasticsearch/k-NN
PUT /myindex
{
"settings" : {
"index": {
"knn": true
}
},
"mappings": {
"properties": {
"my_vector1": {
"type": "knn_vector",
"dimension": 2
},
"my_vector2": {
"type": "knn_vector",
"dimension": 4
},
"my_vector3": {
"type": "knn_vector",
"dimension": 8
}
}
}
}
Getting this error:
"unknown setting [index.knn] please check that any required plugins
are installed, or check the breaking changes documentation for removed
settings"
How do I check if my Elastic installation supports this feature?
t2.small and t2.medium instance types are not supported. (It is not mentioned anywhere in the documentation.) It worked as expected when r5.large instance type was selected.

Hosts can't ping when ICMPv4 flow has been made

I'm using OpenDayLight to be OpenFlow controller, i have 2 hosts that connect to the OpenFlow-enabled router (wr1043ndv4), the controller works fine to see the topology inventory, but when i want to try ping from one host to another i can't. i already made the flow according to the ICMPv4 guide
According to some post in here, the subnet mask for the destination address must /32, so i put the flow and it's in the flow table but the hosts can't ping to one another, i even try to make the subnet mask on the host to /32 to match what i put in the flow but still didn't work.
here my xml code that i changed a bit from the guide site:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
<table_id>235</table_id>
<id>100</id>
<cookie_mask>255</cookie_mask>
<match>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
<ethernet-destination>
<address>e8:06:88:xx:xx:xx</address>
</ethernet-destination>
<ethernet-source>
<address>e8:06:88:xx:xx:xx</address>
</ethernet-source>
</ethernet-match>
<ipv4-source>192.168.1.100/32</ipv4-source>
<ipv4-destination>192.168.5.100/32</ipv4-destination>
<ip-match>
<ip-protocol>1</ip-protocol>
<ip-dscp>27</ip-dscp>
<ip-ecn>3</ip-ecn>
</ip-match>
<icmpv4-match>
<icmpv4-type>6</icmpv4-type>
<icmpv4-code>3</icmpv4-code>
</icmpv4-match>
<in-port>3</in-port>
</match>
<hard-timeout>1200</hard-timeout>
<cookie>11</cookie>
<idle-timeout>3400</idle-timeout>
<flow-name>flowicmp1</flow-name>
<priority>2</priority>
</flow>
and here the result that shown on the flow table:
{
"flow-node-inventory:table": [
{
"id": 235,
"opendaylight-flow-table-statistics:flow-table-statistics": {
"active-flows": 3,
"packets-looked-up": 0,
"packets-matched": 0
},
"flow": [
{
"id": "100",
"priority": 2,
"opendaylight-flow-statistics:flow-statistics": {
"packet-count": 0,
"byte-count": 0,
"duration": {
"nanosecond": 589000000,
"second": 12
}
},
"table_id": 235,
"cookie_mask": 0,
"hard-timeout": 1200,
"match": {
"ethernet-match": {
"ethernet-source": {
"address": "e8:06:88:xx:xx:xx"
},
"ethernet-type": {
"type": 2048
},
"ethernet-destination": {
"address": "e8:06:88:xx:xx:xx"
}
},
"icmpv4-match": {
"icmpv4-code": 3,
"icmpv4-type": 6
},
"ip-match": {
"ip-dscp": 27,
"ip-protocol": 1,
"ip-ecn": 3
},
"ipv4-destination": "192.168.5.100/32",
"ipv4-source": "192.168.1.100/32",
"in-port": "3"
},
"cookie": 11,
"flags": "",
"instructions": {
"instruction": [
{
"order": 0,
"apply-actions": {
"action": [
{
"order": 0,
"dec-nw-ttl": {}
}
]
}
}
]
},
"idle-timeout": 3400
},
What did i do wrong? i expect the hosts to be able to ping each other after i made that flow push.
the action of your flow seems to be to just decrement the ttl. do you want
the action to be to forward out of another port?
also, is the output you gave for the flow table coming from the config
datastore or operational? if you add a flow (e.g. via REST) it will end
up in the config datastore. However, if the flow never gets programmed
on the openflow switch it will not end up in the operational datastore. The
operational datastore reflects the actual state of the network, whereas the
config datastore reflects the "desired" state.

Youtube API Subscription.ContentDetails.NewItemCount returning zero if querying myself but return different value from Google API Explorer

When using the youtube API to get the list of my subscriptions and all the related details I get a number of information from the snippet and contentDetails part of the response object.
When I call the service from my script the contentDetails.newItemCount always return zero, this should indicate the number of new videos on the channel since last time I've opened the channel. The contentDetails.totalItemCount (total number of videos for the channel) is accurate instead.
In contrast if I run the same query through the google api explorer, the same variable contains the correct information and not zero.
The call I make from my PHP script is exactly the same as the one run on the google api explorer so I can't explain or understand why I'm getting different results. The code I use is roughly the following
$this->_youtube = new Google_Service_YouTube($this->_connector->_googleClient);
$params = array('mine' => true,'maxResults'=>25,'order'=>'alphabetical');
$part = 'snippet,contentDetails';
$response = $this->_youtube->subscriptions->listSubscriptions(
$part,
$params
);
foreach ($response['items'] as $item) {
$this->_mysubscriptions[] = array(
'channelId'=>$item['snippet']['resourceId']['channelId'],
'title'=>$item['snippet']['title'],
'description'=>$item['snippet']['description'],
'thumb_default'=>$item['snippet']['thumbnails']['default']['url'],
'thumb_medium'=>$item['snippet']['thumbnails']['medium']['url'],
'thumb_high'=>$item['snippet']['thumbnails']['high']['url'],
'subscribedOn'=>$this->cleanDate($item['snippet']['publishedAt']),
'totalVideos'=>$item['contentDetails']['totalItemCount'],
'newVideos'=>$item['contentDetails']['newItemCount']);
}
This is how the object returned looks like (just removed few IDs from the response) from the google API explorer, while when I run it through my code I get the same data but the newItemCount is zero.
{
"kind": "youtube#subscription",
"snippet": {
"publishedAt": "2016-09-14T12:48:00.000Z",
"title": "Muselk",
"description": "\"Memes win games\" - Youtube.com/mrmuselk",
"resourceId": {
"kind": "youtube#channel",
"channelId": "UCd534c_ehOvrLVL2v7Nl61w"
},
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/-iWlz7dePNz0/AAAAAAAAAAI/AAAAAAAAAAA/smtPKh-RLTU/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"medium": {
"url": "https://yt3.ggpht.com/-iWlz7dePNz0/AAAAAAAAAAI/AAAAAAAAAAA/smtPKh-RLTU/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"high": {
"url": "https://yt3.ggpht.com/-iWlz7dePNz0/AAAAAAAAAAI/AAAAAAAAAAA/smtPKh-RLTU/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
}
}
},
"contentDetails": {
"totalItemCount": 792,
"newItemCount": 4,
"activityType": "all"
}
I've looked through the revision history but can't find any reference of modifications made to this specific property of the contentDetails object
There is a bug filed with google on this property but it refers to a different behaviour.
Wondering if this happens to other as well, or if somebody can give some hints on how this works or don't.

Resources