Skip to content
Permalink
Browse files

Start on QgsArcGisPortalUtils

  • Loading branch information
nyalldawson committed Dec 21, 2020
1 parent 5a2cfe5 commit d6fa53310b4eb4554c4c39b1fd20fe0112f1b550
@@ -0,0 +1,53 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/providers/arcgis/qgsarcgisportalutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsArcGisPortalUtils
{
%Docstring
Utility functions for working with ArcGIS REST services.

.. seealso:: :py:class:`QgsArcGisRestUtils`

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgsarcgisportalutils.h"
%End
public:

static QVariantMap retrieveUserInfo( const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle /Out/, QString &errorText /Out/, const QMap< QString, QString > &requestHeaders = QMap< QString, QString >(), QgsFeedback *feedback = 0 );
%Docstring
Retrieves JSON user info for the specified user name.

If ``user`` is blank then the user associated with the current logon details will be retrieved

:param communityUrl: should be set to the Portal's community URL, e.g. https://mysite.com/portal/sharing/rest/community
:param user: username to query, or an empty string to query the current user
:param authcfg: authentification configuration ID
:param requestHeaders: optional additional request headers
:param feedback: optional feedback argument for cancelation support

:return: - JSON user info
- errorTitle: title summary of any encountered errrors
- errorText: error text of any encountered errors
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/providers/arcgis/qgsarcgisportalutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -15,6 +15,8 @@ class QgsArcGisRestUtils
%Docstring
Utility functions for working with ArcGIS REST services.

.. seealso:: :py:class:`QgsArcGisPortalUtils`

.. versionadded:: 3.18
%End

@@ -500,6 +500,7 @@
%Include auto_generated/processing/qgsprocessingprovider.sip
%Include auto_generated/processing/qgsprocessingregistry.sip
%Include auto_generated/processing/qgsprocessingutils.sip
%Include auto_generated/providers/arcgis/qgsarcgisportalutils.sip
%Include auto_generated/providers/arcgis/qgsarcgisrestutils.sip
%Include auto_generated/providers/memory/qgsmemoryproviderutils.sip
%Include auto_generated/raster/qgsbilinearrasterresampler.sip
@@ -179,6 +179,7 @@ set(QGIS_CORE_SRCS
processing/models/qgsprocessingmodelparameter.cpp
processing/models/qgsprocessingmodeloutput.cpp

providers/arcgis/qgsarcgisportalutils.cpp
providers/arcgis/qgsarcgisrestquery.cpp
providers/arcgis/qgsarcgisrestutils.cpp

@@ -1403,6 +1404,7 @@ set(QGIS_CORE_HDRS
processing/qgsprocessingregistry.h
processing/qgsprocessingutils.h

providers/arcgis/qgsarcgisportalutils.h
providers/arcgis/qgsarcgisrestquery.h
providers/arcgis/qgsarcgisrestutils.h

@@ -0,0 +1,37 @@
/***************************************************************************
qgsarcgisportalutils.h
--------------------
begin : December 2020
copyright : (C) 2020 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsarcgisportalutils.h"
#include "qgsarcgisrestquery.h"
#include <QUrl>
#include <QUrlQuery>

QVariantMap QgsArcGisPortalUtils::retrieveUserInfo( const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle, QString &errorText, const QMap<QString, QString> &requestHeaders, QgsFeedback *feedback )
{
QString endPoint = communityUrl;
if ( endPoint.endsWith( '/' ) )
endPoint.chop( 1 );

if ( user.isEmpty() )
endPoint += QStringLiteral( "/self" );
else
endPoint += QStringLiteral( "/users/" ) + user;

QUrl queryUrl( endPoint );
QUrlQuery query( queryUrl );
query.addQueryItem( QStringLiteral( "f" ), QStringLiteral( "json" ) );
queryUrl.setQuery( query );

return QgsArcGisRestQueryUtils::queryServiceJSON( queryUrl, authcfg, errorTitle, errorText, requestHeaders, feedback );
}
@@ -0,0 +1,58 @@
/***************************************************************************
qgsarcgisportalutils.h
--------------------
begin : December 2020
copyright : (C) 2020 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSARCGISPORTALUTILS_H
#define QGSARCGISPORTALUTILS_H

#include "qgis_core.h"
#include "qgis_sip.h"

#include <QVariantMap>
#include <QString>

class QgsFeedback;

/**
* \ingroup core
* Utility functions for working with ArcGIS REST services.
*
* \see QgsArcGisRestUtils
*
* \since QGIS 3.18
*/

class CORE_EXPORT QgsArcGisPortalUtils
{
public:

/**
* Retrieves JSON user info for the specified user name.
*
* If \a user is blank then the user associated with the current logon details will be retrieved
*
* \param communityUrl should be set to the Portal's community URL, e.g. https://mysite.com/portal/sharing/rest/community/
* \param user username to query, or an empty string to query the current user
* \param authcfg authentification configuration ID
* \param errorTitle title summary of any encountered errrors
* \param errorText error text of any encountered errors
* \param requestHeaders optional additional request headers
* \param feedback optional feedback argument for cancelation support
*
* \returns JSON user info
*/
static QVariantMap retrieveUserInfo( const QString &communityUrl, const QString &user, const QString &authcfg, QString &errorTitle SIP_OUT, QString &errorText SIP_OUT, const QMap< QString, QString > &requestHeaders = QMap< QString, QString >(), QgsFeedback *feedback = nullptr );

};

#endif // QGSARCGISPORTALUTILS_H
@@ -51,6 +51,8 @@ class QgsMultiCurve;
* \ingroup core
* Utility functions for working with ArcGIS REST services.
*
* \see QgsArcGisPortalUtils
*
* \since QGIS 3.18
*/
class CORE_EXPORT QgsArcGisRestUtils

0 comments on commit d6fa533

Please sign in to comment.
You can’t perform that action at this time.