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 );
41QVariantMap
QgsArcGisPortalUtils::retrieveUserInfo(
const QString &communityUrl,
const QString &user,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QMap< QString, QVariant > &requestHeaders,
QgsFeedback *feedback,
const QString &urlPrefix )
48 const QVariantMap info =
retrieveUserInfo( communityUrl, user, authcfg, errorTitle, errorText, requestHeaders, feedback, urlPrefix );
49 return info.value( QStringLiteral(
"groups" ) ).toList();
52QVariantList
QgsArcGisPortalUtils::retrieveUserGroups(
const QString &communityUrl,
const QString &user,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QMap< QString, QVariant > &requestHeaders,
QgsFeedback *feedback,
const QString &urlPrefix )
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();
94QVariantList
QgsArcGisPortalUtils::retrieveGroupContent(
const QString &contentUrl,
const QString &groupId,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QMap< QString, QVariant > &requestHeaders,
QgsFeedback *feedback,
int pageSize,
const QString &urlPrefix )
101 const QVariantList items =
retrieveGroupContent( contentUrl, groupId, authcfg, errorTitle, errorText, requestHeaders, feedback, pageSize, urlPrefix );
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 )
122QVariantList
QgsArcGisPortalUtils::retrieveGroupItemsOfType(
const QString &contentUrl,
const QString &groupId,
const QString &authcfg,
const QList<int> &itemTypes, QString &errorTitle, QString &errorText,
const QMap< QString, QVariant > &requestHeaders,
QgsFeedback *feedback,
int pageSize,
const QString &urlPrefix )
134 return QStringLiteral(
"Feature Service" );
136 return QStringLiteral(
"Map Service" );
138 return QStringLiteral(
"Image Service" );
ArcGisRestServiceType
Available ArcGIS REST service types.
@ GeocodeServer
GeocodeServer.
@ Unknown
Other unknown/unsupported type.
@ GlobeServer
GlobeServer.
@ ImageServer
ImageServer.
@ FeatureServer
FeatureServer.
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, const QString &urlPrefix=QString())
Retrieves JSON definitions for all items which belong the the specified groupId.
static QVariantMap retrieveUserInfo(const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, const QString &urlPrefix=QString())
Retrieves JSON user info for the specified user name.
static QVariantList retrieveUserGroups(const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsHttpHeaders &requestHeaders=QgsHttpHeaders(), QgsFeedback *feedback=nullptr, const QString &urlPrefix=QString())
Retrieves JSON definitions for all groups which the specified user name is a member of.
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, const QString &urlPrefix=QString())
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, const QString &urlPrefix=QString())
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
Tells whether the operation has been canceled already.
#define BUILTIN_UNREACHABLE