Is there way to select only id from parentReference - onedrive

Request
GET /drive/root/children?select=name,size,parentReference
returns, for parentReference, for example,
"parentReference:{
"driveId":"3e2dd398785a81d",
"id":"3E2DD398785A81D!103",
"path":"/drive/root:"
}
Is there way that parentReference in reponse contains only id:
"parentReference:{
"id":"3E2DD398785A81D!103",
}

Ideally you should be able to ?select=name,size,parentReference/id but that currently doesn't work (it'll behave like ?select=name,size,parentReference). We aim to fix that at some point though, and so you're more than welcome to use the former syntax and it should start working when we fix it. Until then you'll just get back some extra things you don't actually care about.

Related

Minecraft Spigot I cannot get String from Component

Hello Support I can't get the String from a Component. I did this with 2 ways with bad results.
TextComponent textComponent = (TextComponent) item.displayname;
return textComponent.content();
The result of this is a error with Casting
and
return PlainTextComponentSerializer.plainText().serialize(item.displayname);
The result of this is Literaly "chat.square_brackets" which is weird.
Please Help. Thanks
I also was having trouble with this. Here's what I found to work for me. Full disclosure that I'm developing my plugin on the PaperMC 1.16 fork and not Spigot. So it's possible that this may not work for you, either because it isn't a part of Spigot or because you are working in a version that this feature is not a part of.
To start, I would first check to make sure that we are both on the same page. For me, the component objects being used are from a package called net.kyori.adventure.text if yours are not provided by this package I don't know that this solution will work for you.
Also as mentioned by others, accessing the displayName directly on the ItemStack isn't going to give the desired results. Instead, you need to do itemStack.getItemMeta().displayName(). This method should then return a net.kyori.adventure.text.Component; once you have the component you need to serialize it using one of the serializers from the previously mentioned package.
That will look something like this:
Component itemDisplayName = itemStack.getItemMeta().displayName()
PlainComponentSerializer plainSerializer = PlainComponentSerializer.plain();
String itemName = plainSerializer.serialize(itemDisplayName);
The package that the serializer is from is: net.kyori.adventure.text.serializer.plain.PlainComponentSerializer
I don't understand how you can access to the displayname field in ItemStack in the Spigot API.
You should use ItemMeta to manage display name. To get the item meta, you should use ItemStack#getItemMeta.
Don't forget to check if the item as a meta with hasItemMeta. You can also use hasDisplayName to be sure that the display name is valid.

Soundcloud API - (Sometimes) wrong playcount & ISRC code

I'm making a statistics system, and fetch some simple data from Soundcloud. But, when I use the very same link, but with different releases, sometimes it doesn't find anything at all, and sometimes the playcount is wrong. Further more, it always returns "null" for the ISRC code, even with tracks where I know it has indeed been submitted.
I use the following endpoint:
https://api.soundcloud.com/resolve.json?url=$url&client_id=$client_id
Now, with the versy same endpoint, I get different results for:
https://soundcloud.com/krisoneil/kris-oneil-fisher-pouring-down-black-hole-out-feb-2nd <- works, and shows the correct playcount
soundcloud[dotcom]/krisoneil/heroic-pleasure <- works, but shows a wrong playcount
soundcloud[dot com]/blackholerecordings/luke-chable-kinetic <- doesn't work
Further more, the two that works both shows "null" for the ISRC code, even though I know they are entered.
I don't get how the same script sometimes work, sometimes kinda work, and sometimes doesn't work at all.
Any help on this would be appreciated!
All thebest wishes,
Kris
I've noticed this too. You could try using the v2 endpoint which is unofficial and undocumented, but it does show the correct stats for me
For favorites -
https://api-v2.soundcloud.com/users/{USER_ID}/track_likes?&limit=200&client_id={CLIENT_ID}
For tracks - https://api-v2.soundcloud.com/users/{USER_ID}/tracks?&limit=200&client_id={CLIENT_ID}
etc...

Whats wrong with my code (GML)

ok so im sorry to be asking, however im trying to make it so that when i press z, a portal appears at my Spr_players coordinates, however if one of them already exists, i want it to be erased and im simply wondering what ive done wrong. Again sorry for bothering. (please note that i am a bad programmer and i appoligize if i broke any rules)
if object_exists(portal)
{
instance_destroy()
action_create_object(portal,Spr_player.x,Spr_player.y)
}
else
{
action_create_object(portal,Spr_player.x,Spr_player.y)
}
The instance_destroy() statement destroys the current self instance which is what is executing the code. You must use the with (<objectID>) {instance_destroy()} syntax to destroy another instance.
As long as there is only one instance of portal in the room this code should work:
if object_exists(portal)
{
with (portal) instance_destroy(); //you should also need a semicolon here to separate
//this statement from the next, it is good practice
//to do this after all statements as I have done.
action_create_object(portal,Spr_player.x,Spr_player.y);
}
else
{
action_create_object(portal,Spr_player.x,Spr_player.y);
}
If there are multiple instances of portal this will only destroy the first one. To destroy all you would have to use a for loop to iterate through them all. Off the top of my mind I can not remember the function to get the ids of all the instances of an object, but it looks like this is not a problem since each time one is created the existing one is destroyed and thus you will only have one a t a time.
Another way of doing this is just to move the existing portal to the new position. The only difference here is that the create event of the portal will not be executed and any alarms will not be reset.
portal.x=Spr_player.x
portal.y=Spr_player.y
Again this will only move the first portal if there are more than one.

What are the Aweber API Variables $account_id and $list_id?

You can check here:
https://labs.aweber.com/docs/code_samples/subs/create
The script to add a new subscriber to the list via api requires those two pieces info...only I cannot figure out for the life of me what those two variables are!! I've beaten through every little aspect of my Aweber Subscriber Account, AND my Aweber Labs account...and I can't find any reference to either of those variables anywhere. I've submitted some tickets to them, and haven't gotten any response yet.
Does anyone have any ideas here? I've tried my account names, my list names, to no avail!
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Okay, I've got it! You can get the values of both of these variables by dumping some other variables in the aweber api after making certain api calls.
get the account id first:
$account = $aweber->getAccount($accessKey, $accessSecret);
then vardump or print_r $account.
next we get the list id:
$account = $aweber->getAccount($accessKey, $accessSecret);
$list_url = 'https://api.aweber.com/1.0/accounts/<id>/lists';
$lists = $account->loadFromUrl($list_url);
then vardump or print_r $lists.
And you are all set! I'm so happy I figured this out, it freakin took long enough. Hopefully this saves some one a bit of time.
I too have agonized over finding the $list_ID, so went to deactivate the list, and create a new one, and "discovered" that if you hover over the Deactivate button, you get a url you can copy, and this gives both %account and %list Ids
https://www.aweber.com/users/lists/deactivate/$accountID/$lisID
like this....
https://www.aweber.com/users/lists/deactivate/123456/123456
Hopefully this will help make someone as it is a super easy solution
The proper answer is Anne Allen's one, but...
Check the return of the /accounts endpoint. It should return the same account id as you detected in the link, but I had cases they were different (strange, isn't it?). Use the account id returned by the /accounts endpoint and other endpoints to retrieve lists, subscribers, etc. will start to work. It's like if some accounts have two ids, one partially works and the other fully works.
Let me tell you how to get $list_id value... login into your AWeber account and then create a new list copy only integer value from list's name.
At first, login.
1) click Reports>Settings. Your account ID will be displayed in the box,example: ?id=XXXXX
2) click List Options>List Settings. There you will see the list ID under the name.
p.s. To add subscriber, you can use this - Automatically add into aweber list

rubycas-server response

This is the data that I get back from the rubycas server.
{
"cn"=>"--- - Toby Joiner",
"sn"=>"--- - Joiner",
"mail"=>"--- - tobyjoiner#xxxxxx.xxx",
"memberof"=>"---
- CN=All Users,OU=AllUsers,DC=bnw,DC=local
- CN=Administrators,CN=Builtin,DC=bnw,DC=local
- CN=Remote Desktop Users,CN=Builtin,DC=bnw,DC=local",
"givenname"=>"--- - Toby"
}
I am wondering if there is a way I am supposed pull this data out, right now I am doing:
first_name = session[:cas_extra_attributes][:sn].gsub('-','')
to remove the dashes. I am hoping I am just missing the built in way to get the extra data out from the rubycas server.
That looks like YAML escaped data. You should be able to get rid of it by first parsing it through YAML.load and then processing it as you wish.
As a small aside, I've personally re-implemented the basic functions of rubycas-server as a Rails engine called cassy. However, I don't think it supports sending through extra attributes at the moment.
I just thought I'd mention it as it gives you an alternative to try if rubycas-server doesn't work out.