/// <summary>
        /// Creates a VaultApi helper object which will make HTTP API calls using the provided client application/developer credentials.
        /// (OAuth2 protocol Client Credentials Grant Type), allows a user to provide an existing token
        /// </summary>m>
        public VaultApi(IClientSecrets clientSecrets, Tokens tokens)
        {
            if (!string.IsNullOrEmpty(tokens.AccessToken))
            {
                this.ApiTokens = tokens;
                this.ClientSecrets = clientSecrets;

                this.REST = new RestManager(this);
                this.DocumentViewer = new DocumentViewerManager(this);
                this.Sites = new SitesManager(this);
                this.ScheduledProcess = new ScheduledProcessManager(this);
                this.CurrentUser = new CurrentUserManager(this);
                this.Users = new UsersManager(this);
                this.Groups = new GroupsManager(this);
                this.Folders = new FoldersManager(this);
                this.Files = new FilesManager(this);
                this.FormInstances = new FormInstancesManager(this);
                this.FormTemplates = new FormTemplatesManager(this);
                this.Documents = new DocumentsManager(this);
                this.IndexFields = new IndexFieldManager(this);
                this.Files = new FilesManager(this);
                this.CustomQueryManager = new CustomQueryManager(this);
                this.DocumentShares = new DocumentShareManager(this);

                this.Meta = new MetaManager(this);
                this.PersistedData = new PersistedData.PersistedDataManager(this);
                this.Customer = new CustomerManager(this);
                this.Version = new VersionManager(this);
            }
        }
Exemple #2
0
        protected static UrlParts GetUrlParts(IClientSecrets clientSecrets)
        {
            UrlParts urlParts = new UrlParts
            {
                ApiVersion         = clientSecrets.ApiVersion,
                BaseUrl            = clientSecrets.BaseUrl,
                CustomerAlias      = clientSecrets.CustomerAlias,
                DatabaseAlias      = clientSecrets.DatabaseAlias,
                OAuthTokenEndPoint = clientSecrets.OAuthTokenEndPoint
            };

            return(urlParts);
        }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="clientSecrets"> </param>
 /// /// <param name="apiTokens"></param>
 public Page(IClientSecrets clientSecrets, Tokens apiTokens)
 {
     base.Populate(clientSecrets, apiTokens);
     ItemType     = typeof(T);
     Items        = new List <T>();
     First        = string.Empty;
     Last         = string.Empty;
     Limit        = 0;
     Next         = string.Empty;
     Offset       = 0;
     Previous     = string.Empty;
     TotalRecords = 0;
 }
        protected static UrlParts GetUrlParts(IClientSecrets clientSecrets)
        {
            UrlParts urlParts = new UrlParts
            {
                ApiVersion = clientSecrets.ApiVersion,
                BaseUrl = clientSecrets.BaseUrl,
                CustomerAlias = clientSecrets.CustomerAlias,
                DatabaseAlias = clientSecrets.DatabaseAlias,
                OAuthTokenEndPoint = clientSecrets.OAuthTokenEndPoint
            };

            return urlParts;
        }
        /// <summary>
        /// Creates a VaultApi helper object which will make HTTP API calls using the provided client application/developer credentials AND 
        /// the provided UserName/Password credentials.  After authenticating the client application, the Resource Owner credentials are authenticated 
        /// and used for all subsequent HTTP API access
        /// (OAuth2 protocol Resource Owner Grant Type)
        /// </summary>
        /// <param name="clientSecrets"></param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public VaultApi(IClientSecrets clientSecrets, string userName, string password)
        {
            this.ApiTokens = HttpHelper.GetAccessToken(clientSecrets.OAuthTokenEndPoint, clientSecrets.ApiKey, clientSecrets.ApiSecret, userName, password).Result;

            if (!string.IsNullOrEmpty(this.ApiTokens.AccessToken))
            {
                this.ClientSecrets = clientSecrets;

                this.REST = new RestManager(this);
                this.DocumentViewer = new DocumentViewerManager(this);
                this.Sites = new SitesManager(this);
                this.ScheduledProcess = new ScheduledProcessManager(this);
                this.CurrentUser = new CurrentUserManager(this);
                this.Users = new UsersManager(this);
                this.Groups = new GroupsManager(this);
                this.Folders = new FoldersManager(this);
                this.Files = new FilesManager(this);
                this.FormInstances = new FormInstancesManager(this);
                this.FormTemplates = new FormTemplatesManager(this);
                this.Documents = new DocumentsManager(this);
                this.IndexFields = new IndexFieldManager(this);
                this.Files = new FilesManager(this);
                this.CustomQueryManager = new CustomQueryManager(this);
                this.DocumentShares = new DocumentShareManager(this);

                this.Meta = new MetaManager(this);
                this.PersistedData = new PersistedData.PersistedDataManager(this);
                this.Customer = new CustomerManager(this);
                this.Version = new VersionManager(this);
            }
        }
Exemple #6
0
 /// <summary>
 /// Populates the token
 /// </summary>
 /// <param name="clientSecrets"></param>
 /// <param name="apiTokens"> </param>
 internal void Populate(IClientSecrets clientSecrets, Tokens apiTokens)
 {
     this.ClientSecrets = clientSecrets;
     this.ApiTokens     = apiTokens;
 }
        internal void PopulateAccessToken(IClientSecrets clientSecrets, Tokens apiTokens)
        {
            base.Populate(clientSecrets, apiTokens);

            this.SessionPopulated();
        }
 /// <summary>
 /// Populates the token
 /// </summary>
 /// <param name="clientSecrets"></param>
 /// <param name="apiTokens"> </param>
 internal void Populate(IClientSecrets clientSecrets, Tokens apiTokens)
 {
     this.ClientSecrets = clientSecrets;
     this.ApiTokens = apiTokens;
 }
Exemple #9
0
        internal void PopulateAccessToken(IClientSecrets clientSecrets, Tokens apiTokens)
        {
            base.Populate(clientSecrets, apiTokens);

            this.SessionPopulated();
        }