Github list of tag and release asset urls - github

I'm struggling with the github graphql interface to get the data that I need. I want to get a list of asset urls for both tags and releases. It seems that some repos produce my desired result while others produce nothing.
query {
repository(owner:"erlang",name:"otp") {
releases(last:100) {
edges {
node {
url
releaseAssets(last:100) {
edges {
node {
downloadUrl
}
}
}
tag {
name
target {
... on Commit {
zipballUrl
tarballUrl
}
}
}
}
}
}
tags:refs(refPrefix:"refs/tags/", last:30) {
edges {
tag:node {
name
target {
sha:oid
commitResourcePath
... on Commit {
zipballUrl
tarballUrl
author {
name
email
date
}
}
}
}
}
}
}
}
That query, as is, produces my desired results(or at least some them) whereas owner:"spring-projects",name:"spring-framework" produces tags with no tarball. When I look at the spring-framework repo it obviously has assets for releases.
Why are they not showing in this query? When I look at git every release and tag has assets yet, even in my query, the results are hit or miss. What am I missing?

target is a git reference, in that case it can point to a Tag or a Commit object. When it points to a Commit, your query returns the expected result since ...on Commit is not empty. To get the Tag as well just try out with ...on Tag and extract the tagger or the commit it points to depending on what you want. Here is an example :
{
repository(owner: "spring-projects", name: "spring-framework") {
releases(last: 100) {
edges {
node {
url
releaseAssets(last: 100) {
edges {
node {
downloadUrl
}
}
}
tag {
...refInfo
}
}
}
}
tags: refs(refPrefix: "refs/tags/", last: 30) {
edges {
node {
...refInfo
}
}
}
}
}
fragment refInfo on Ref {
name
target {
sha: oid
commitResourcePath
__typename
... on Tag {
target {
... on Commit {
...commitInfo
}
}
tagger {
name
email
date
}
}
... on Commit {
...commitInfo
}
}
}
fragment commitInfo on Commit {
zipballUrl
tarballUrl
author {
name
email
date
}
}
Try it in the explorer
Note that in the example above, I've used fragments to reduce the query size & improve readibility
My guess is that in case the ref is pointing to a Tag object that's an annotated tag which can hold a message, a specific tagging date & tagger info. If it points to a Commit object, it's a lightweight tag which is just linking to a commit

Related

Not giving same results with dimensions and metrics from front end to API

I was able to do the following request: { "dimensions":[ { "name":"date" } { "name":"deviceCategory" } { "name":"eventName" } { "name":"customEvent:from_marketplace" } ] "metrics":[ { "name":"eventCount" } { "name":"eventCountPerUser" } ] "dateRanges":[ { "startDate":"2022-11-01" "endDate":"2022-12-12" } ] "dimensionFilter":{ "filter":{ "stringFilter":{ "matchType":"EXACT" "value":"send_offer" } "fieldName":"eventName" } } "offset":"0" "keepEmptyRows":true } when pulling data for dates before Nov 1, i get data for the event, but after Nov1, I dont get any data. If i remove the customEvent:from_marketplace and then i get data.
I usually minimized the # of dimensions in a call, but don't understand why the front end with the same dimensions and metrics provide data.

StoreFront api shopify in Flutter app ("Nodes" & "Edges" conflicting class names)

My need is very simple.
I want to query Shopify's Storefront api using Flutter, but there is a catch.
My response always have multiple nodes and edges. and each node/edge containing different objects.
Now the problem arise when i try to use JsonToDart generator in android studio and it creates each class with its own model. containing different fields and it conflicts with the other Node class.
screenshot is attached for reference.
i want to know how i can tackle this problem.
my graphQL query is:
{
products(first: 2) {
nodes {
id
title
createdAt
description
descriptionHtml
featuredImage {
id
url
width
height
altText
}
onlineStoreUrl
options {
id
name
values
}
priceRange {
maxVariantPrice {
amount
currencyCode
}
minVariantPrice {
amount
currencyCode
}
}
productType
publishedAt
requiresSellingPlan
seo {
title
description
}
tags
totalInventory
updatedAt
vendor
images(first: 2) {
nodes {
id
url
width
height
altText
}
}
media(first: 2) {
nodes {
alt
mediaContentType
}
}
variants(first: 2) {
nodes {
availableForSale
barcode
id
image {
id
url
width
height
altText
}
requiresShipping
sku
title
weight
weightUnit
}
}
}
}
}
You shouldn't have multiple classes called the same way, this creates confusion in your code, and if for any reason you do, they have to be defined in different files and whenever you import them somewhere you have to pick the right file to import it from

GitHub Projects Beta - How to get the data from a view in the API

My company is using the new GitHub projects beta and we're really enjoying the experience, but we're facing a problem and it is how to export the data from a specific view (or even all the data) with all the custom columns that we have.
The ideal solution for us is to get this same data as JSON using the API.
Using https://api.github.com/orgs/.../issues does not work because the issues does not have the custom columns that we create inside the project, and https://api.github.com/orgs/.../projects does not have the data of the issues.
Any idea or work-around to get this data easily using APIs?
After reading the feedback post on GitHub, it's not possible to do it with API, just GraphQL, at least for now.
So my problem was solved with this useful code.
To get the first 100 project from your organization and their ID:
query{
organization(login: "MY_ORG") {
projectsNext(first: 20) {
nodes {
id
title
}
}
}
}
To get the first 100 issues and drafts from a specific project:
{
node(id: "My_Project_ID") {
... on ProjectNext {
items(first: 100, after: null) {
edges {
cursor
}
nodes {
content {
... on Issue {
title
assignees(first: 1) {
nodes {
login
}
}
milestone {
title
}
labels(first: 5) {
nodes {
name
}
}
repository{
name
}
}
}
fieldValues(first: 15) {
nodes {
value
projectField {
name
settings
}
}
}
}
}
}
}
}
Those codes can be easily tested in THIS LINK

How to redirect using F5 iRules with a variable in the URL

Hi I'm new to F5 iRule.
I'm trying to redirect
https://website1.com/userid=1234
to
https://website2.com/userid=1234
such that whatever value the userid may have will be carried over after redirection.
I'm thinking userid value should be set to a variable.
Can someone share what code to use? Thanks!
So https://website1.com/userid=8888 should go to https://website2.com/userid=8888 and so on.
You shouldn't need a variable if that pattern is consistent. A simple rule would be:
when HTTP_REQUEST {
if { [HTTP::host] eq "website1.com" } {
HTTP::redirect https://websitesite2.com[HTTP::uri]
}
}
However, if you are on v11.4+, you really should use a local traffic policy for this as it is more performant as a built-in feature of TMOS.
ltm policy sample_site_redirect {
controls { forwarding }
last-modified 2018-12-20:09:33:02
requires { http }
rules {
full_uri_redirect {
actions {
0 {
http-reply
redirect
location tcl:https://website2.com[HTTP::uri]
}
}
conditions {
0 {
http-host
host
values { website1.com }
}
}
}
}
status published
strategy first-match
}
if all traffic to the virtual server this rule or policy is attached to is intended for website1 only, you can eliminate those conditions. I didn't want to assume. If it's only the URI starting with /user= that you want to match, and redirect on, you can do that this way:
when HTTP_REQUEST {
if { ([HTTP::host] eq "website1.com") && ([string tolower [HTTP::uri]] starts_with "/user=") } {
HTTP::redirect https://website2.com[HTTP::uri]
}
}

BlackBerry 10 Cascades: How to invoke Contacts with prefilled fields?

As the title says, I'm trying to invoke Contacts in BlackBerry Cascades:
https://developer.blackberry.com/cascades/documentation/device_platform/invocation/contacts.html
with fields filled from string variable containing a vCard. I have had no success with mimeTypes, URIs, actions and targets specified in above documentation. The following code or any variation I could develop from documented cases doesn't invoke:
Container {
property string inputString //contains data from which vCard should be extracted if detected
//....
attachedObjects: [
Invocation {
id: myQuery
property bool ready: false
query {
mimeType: "text/plain"
invokeTargetId: "sys.browser"
uri: ("http://www.google.com/search?q="+ escape(inputString))
invokeActionId: "bb.action.OPEN"
data: ""
onArmed: {myQuery.ready = true}
onQueryChanged: {
myQuery.query.updateQuery()
}
}
}
//....
if (inputString.indexOf("VCARD") > -1) {
myInvocation.query.setMimeType("");
myInvocation.query.setUri(inputString);
myInvocation.query.setData(inputString);
myInvocation.query.setInvokeTargetId("sys.pim.contacts.card.viewer");
myInvocation.query.setInvokeActionId("bb.action.VIEW");
myInvocation.query.updateQuery();
}
//...
Button {
onClicked: {
if (myQuery.ready = true) {
myQuery.trigger(myQuery.query.invokeActionId);
}
}
}
}
Other invocations like SMS, eMail & Browser do invoke with this setup, although the MimeType, URIs, data, targets and actions took some fiddling to set right and the configuration that finally worked is not the one from the documentation.
So, how to invoke Contacts?
I've modified your code so now you'll be able to launch as the browser app (as in the code you provided) as the contact app. I don't have any contact set up on my dev device, so in order to view a certain contact you need to provide respective contact ID (see ContactService for information on this) and so on
import bb.cascades 1.0
Page {
Container {
property string inputString //contains data from which vCard should be extracted if detected
//....
Button {
text: "..."
onClicked: {
myQuery.trigger(myQuery.query.invokeActionId); // launches browser
contactInvocation.trigger(contactInvocation.query.invokeActionId); // launches contacts
}
}
attachedObjects: [
Invocation {
id: myQuery
query {
mimeType: "text/plain"
invokeTargetId: "sys.browser"
uri: ("http://www.google.com/search?q=" + escape("sample"))
invokeActionId: "bb.action.OPEN"
onQueryChanged: {
myQuery.query.updateQuery()
}
}
},
Invocation {
id: contactInvocation
query {
invokeTargetId: "sys.pim.contacts.app"
mimeType: "application/vnd.blackberry.contact.id"
invokeActionId: "bb.action.OPEN"
onQueryChanged: {
contactInvocation.query.updateQuery()
}
}
}
]
}
}