24 QString endPoint = communityUrl;
25 if ( endPoint.endsWith(
'/' ) )
29 endPoint += QLatin1String(
"/self" );
31 endPoint += QStringLiteral(
"/users/" ) + user;
33 QUrl queryUrl( endPoint );
34 QUrlQuery query( queryUrl );
35 query.addQueryItem( QStringLiteral(
"f" ), QStringLiteral(
"json" ) );
36 queryUrl.setQuery( query );
48 const QVariantMap info =
retrieveUserInfo( communityUrl, user, authcfg, errorTitle, errorText, requestHeaders, feedback );
49 return info.value( QStringLiteral(
"groups" ) ).toList();
59 QString endPoint = contentUrl;
60 if ( endPoint.endsWith(
'/' ) )
63 endPoint += QStringLiteral(
"/groups/" ) + groupId;
70 QUrl queryUrl( endPoint );
71 QUrlQuery query( queryUrl );
72 query.addQueryItem( QStringLiteral(
"f" ), QStringLiteral(
"json" ) );
73 query.addQueryItem( QStringLiteral(
"start" ), QString::number( start ) );
74 query.addQueryItem( QStringLiteral(
"num" ), QString::number( pageSize ) );
75 queryUrl.setQuery( query );
78 if ( !errorText.isEmpty() )
79 return QVariantList();
81 items.append( response.value( QStringLiteral(
"items" ) ).toList() );
86 const int total = response.value( QStringLiteral(
"total" ) ).toInt();
101 const QVariantList items =
retrieveGroupContent( contentUrl, groupId, authcfg, errorTitle, errorText, requestHeaders, feedback, pageSize );
105 for (
const QVariant &item : items )
107 const QVariantMap itemDef = item.toMap();
108 const QString itemType = itemDef.value( QStringLiteral(
"type" ) ).toString();
110 for (
const int filterType : itemTypes )
133 case Qgis::ArcGisRestServiceType::FeatureServer:
134 return QStringLiteral(
"Feature Service" );
135 case Qgis::ArcGisRestServiceType::MapServer:
136 return QStringLiteral(
"Map Service" );
137 case Qgis::ArcGisRestServiceType::ImageServer:
138 return QStringLiteral(
"Image Service" );
ArcGisRestServiceType
Available ArcGIS REST service types.
@ GeocodeServer
GeocodeServer.
@ Unknown
Other unknown/unsupported type.
@ GlobeServer
GlobeServer.
static QVariantMap retrieveUserInfo(const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr)
Retrieves JSON user info for the specified user name.
static QVariantList retrieveGroupContent(const QString &contentUrl, const QString &groupId, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, int pageSize=100)
Retrieves JSON definitions for all items which belong the the specified groupId.
static QVariantList retrieveUserGroups(const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr)
Retrieves JSON definitions for all groups which the specified user name is a member of.
static QVariantList retrieveGroupItemsOfType(const QString &contentUrl, const QString &groupId, const QString &authcfg, const QList< int > &itemTypes, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, int pageSize=100)
Retrieves JSON definitions for all items which belong the the specified groupId.
static QVariantMap queryServiceJSON(const QUrl &url, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr)
Performs a blocking request to a URL and returns the retrieved JSON content.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const SIP_HOLDGIL
Tells whether the operation has been canceled already.
#define BUILTIN_UNREACHABLE