本文整理汇总了C#中VVRestApi.Common.ClientSecrets类的典型用法代码示例。如果您正苦于以下问题:C# ClientSecrets类的具体用法?C# ClientSecrets怎么用?C# ClientSecrets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientSecrets类属于VVRestApi.Common命名空间,在下文中一共展示了ClientSecrets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VaultApi
/// <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)
/// Includes the Tokens that were created from an earlier call
/// </summary>
/// <param name="clientSecrets"></param>
/// <param name="tokens"></param>
public VaultApi(ClientSecrets 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);
}
}
示例2: GetVaultUserWebLoginToken
public ApiResponse GetVaultUserWebLoginToken(string userName, string apiKey, string developerSecret, string oAuthServerTokenEndPoint, string baseVaultUrl, string apiVersion, string customerAlias, string databaseAlias)
{
ApiResponse response = new ApiResponse();
try
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = apiKey,
ApiSecret = developerSecret,
OAuthTokenEndPoint = oAuthServerTokenEndPoint,
BaseUrl = baseVaultUrl,
ApiVersion = apiVersion,
CustomerAlias = customerAlias,
DatabaseAlias = databaseAlias
};
VaultApi vaultApi = new VaultApi(clientSecrets);
var user = vaultApi.Users.GetUser(userName);
if (user != null)
{
response.Value = user.GetWebLoginToken();
}
}
catch (Exception ex)
{
response.IsError = true;
response.ErrorMessage = ex.Message;
}
return response;
}
示例3: Populate
internal void Populate(JToken meta, JToken data, ClientSecrets clientSecrets, Tokens apiTokens)
{
this.Populate(clientSecrets, apiTokens);
//Now populate the meta
try
{
this.Meta = meta.ToObject<ApiMetaData>();
}
catch (Exception ex)
{
LogEventManager.Error("Error deserializing the Meta node.", ex);
this.Meta = new ApiMetaData();
this.Meta.ErrorMessages.Add(new ApiErrorMessage { DeveloperMessage = ex.Message });
this.Meta.StatusCode = HttpStatusCode.BadRequest;
}
if (data != null)
{
this.PopulateData(data);
}
}
示例4: StorePersistedData
public ApiResponse StorePersistedData(string valuesInJsonFormat, int minutesToStoreData, string apiKey, string developerSecret, string oAuthServerTokenEndPoint, string baseVaultUrl, string apiVersion, string customerAlias, string databaseAlias)
{
ApiResponse response = new ApiResponse();
try
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = apiKey,
ApiSecret = developerSecret,
OAuthTokenEndPoint = oAuthServerTokenEndPoint,
BaseUrl = baseVaultUrl,
ApiVersion = apiVersion,
CustomerAlias = customerAlias,
DatabaseAlias = databaseAlias
};
VaultApi vaultApi = new VaultApi(clientSecrets);
DateTime expirationDate = DateTime.UtcNow.AddMinutes(minutesToStoreData);
var data = vaultApi.PersistedData.CreateData(Guid.NewGuid().ToString(), ScopeType.Global, valuesInJsonFormat, "text/JSON", string.Empty, LinkedObjectType.None, expirationDate);
if (data != null)
{
response.Value = data.Id.ToString();
}
}
catch (Exception ex)
{
response.IsError = true;
response.ErrorMessage = ex.Message;
}
return response;
}
示例5: FormTemplateNameTest
public void FormTemplateNameTest()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var formTemplate = vaultApi.FormTemplates.GetFormTemplate("Encounters");
Assert.IsNotNull(formTemplate);
Debug.WriteLine("Form template name: " + formTemplate.Name);
}
示例6: UploadFileStream
public void UploadFileStream()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
//var testFolder = vaultApi.Folders.GetFolderByPath("/Arbys");
//if (testFolder != null)
//{
var document = vaultApi.Documents.CreateDocument(new Guid("C9B9DB43-5BCF-E411-8281-14FEB5F06078"), "RandomNewDocument", "Random New Document in TestFolder", "1", DocumentState.Released);
Assert.IsNotNull(document);
var documentId = document.DocumentId;
//documentId = Guid.Empty;
var fileStream = TestHelperShared.GetSearchWordTextFileStream();
//var byteArray = TestHelperShared.GetSearchWordTextFile();
//var fileStream = TestHelperShared.GetFileStream(@"c:\temp\video1.mp4");
//if (fileStream == null)
//{
// throw new Exception("Could not get the embedded file: SearchWordTextFile.txt");
//}
var indexFields = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Name", "Test Data")
};
var optParameters = new JObject(){
new JProperty("source", "DocumentViewer"),
new JProperty("command", "copyPriorRevisionAnnotations")
};
var returnObject = vaultApi.Files.UploadFile(documentId, "SearchWordTextFile.txt", "14", "14", DocumentCheckInState.Released, indexFields, fileStream, optParameters);
var meta = returnObject.GetValue("meta") as JObject;
if (meta != null)
{
var status = meta.GetValue("status").Value<string>();
Assert.AreEqual("200", status);
var checkinstatusString = meta.GetValue("checkInStatus").Value<string>();
Assert.AreEqual(CheckInStatusType.CheckedIn.ToString(), checkinstatusString);
}
//}
}
示例7: FormDataTest
public void FormDataTest()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var formTemplateId = new Guid("F9CB9977-5B0E-E211-80A1-14FEB5F06078");
//var options = new RequestOptions
//{
// Fields = "dhdocid,revisionid,City,First Name,Unit"
//};
var options = new RequestOptions
{
Query = "[VVModifyDate] ge '2015-11-07T22:18:09.444Z'",
Expand = true
};
var formdata = vaultApi.FormTemplates.GetFormInstanceData(formTemplateId, options);
Assert.IsNotNull(formdata);
//foreach (FormTemplate formTemplate in formTemplates.Items)
//{
// Assert.IsNotNullOrEmpty(formTemplate.Name);
//}
//Assert.IsNotNull(formTemplates);
}
示例8: UpdateIndexFieldForDocument
public void UpdateIndexFieldForDocument()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var dlId = new Guid("85fa0e91-a64a-e511-82a3-5cf3706c36ed");
var dhId = new Guid("BD9DB6B5-A64A-E511-82A3-5CF3706C36ED");
var fieldId = new Guid("3AD6D13A-2E75-E111-84E2-14FEB5F06078");
var dataId = new Guid("5ABEAFB5-A64A-E511-82A3-5CF3706C36ED");
var value = "Movies";
var docIndexField = vaultApi.Documents.UpdateIndexFieldValue(dlId, fieldId, value);
Assert.AreEqual(value, docIndexField.Value);
}
示例9: GetApiObjectFieldNames
public void GetApiObjectFieldNames()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
List<MetaDataType> ApiObjectTypes = vaultApi.Meta.GetDataTypes();
StringBuilder sbFieldList = new StringBuilder();
sbFieldList.AppendLine("API Object Field List");
foreach (MetaDataType apiObjectType in ApiObjectTypes)
{
sbFieldList.AppendLine("-----------------------------------------------------------------");
sbFieldList.AppendLine(string.Format("{0} fields: {1}", apiObjectType.Name, Environment.NewLine));
foreach (string fieldName in apiObjectType.AvailableFields)
{
sbFieldList.AppendLine(string.Format("{0}", fieldName));
}
}
LogEventManager.Info(sbFieldList.ToString());
}
示例10: GetCustomerDatabaseInfo
public void GetCustomerDatabaseInfo()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var dbInfo = vaultApi.Customer.GetCustomerDatabaseInfo();
Assert.IsNotNull(dbInfo);
}
示例11: CreateCustomerTest
public void CreateCustomerTest()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var newCustomer = vaultApi.Customer.CreateCustomer("Customer2", "Customer2", "Main", "Customer2.Admin", "p",
"[email protected]", 1, 5, true);
Assert.IsNotNull(newCustomer);
}
示例12: CreateFolderByPath
public void CreateFolderByPath()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var folderPath = "/Community/Airplanes/Lockheed";
var folderDescription = "Lockheed Folder";
var allowRevisions = true;
var namingConventionPrefix = "Lockheed-";
var namingConventionSufix = "";
var datePosition = DocDatePosition.NoDateInsert;
var docSeqType = VVRestApi.Vault.Library.DocSeqType.TypeInteger;
var expireAction = ExpireAction.Nothing;
var expireRequired = false;
var expirationDays = 0;
var reviewRequired = false;
var reviewDays = 0;
var folder = vaultApi.Folders.CreateFolderByPath(folderPath, folderDescription, false, false, allowRevisions, namingConventionPrefix, namingConventionSufix, datePosition, docSeqType, expireAction, expireRequired, expirationDays, reviewRequired, reviewDays);
Assert.IsNotNull(folder);
}
示例13: CreateChildFolder
public void CreateChildFolder()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var parentFolder = vaultApi.Folders.GetFolderByPath("/General");
if (parentFolder != null)
{
var namingConventionPrefix = "ChilderFolder1-";
var namingConventionSufix = "";
var datePosition = DocDatePosition.NoDateInsert;
var docSeqType = VVRestApi.Vault.Library.DocSeqType.TypeInteger;
var expireAction = ExpireAction.Nothing;
var expireRequired = false;
var expirationDays = 0;
var reviewRequired = false;
var reviewDays = 0;
var folder = vaultApi.Folders.CreateChildFolder(parentFolder.Id, "ChildFolder1", "ChildFolder1", false, false, true, namingConventionPrefix, namingConventionSufix, datePosition, docSeqType, expireAction, expireRequired, expirationDays, reviewRequired, reviewDays);
Assert.IsNotNull(folder);
}
}
示例14: CreateChildFolderWithNameOnly
public void CreateChildFolderWithNameOnly()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var parentFolder = vaultApi.Folders.GetFolderByPath("/General");
if (parentFolder != null)
{
var folder = vaultApi.Folders.CreateChildFolder(parentFolder.Id, "SampleChildFolder2");
Assert.IsNotNull(folder);
}
}
示例15: ClientCredentialsGrantType_LoginTest
public void ClientCredentialsGrantType_LoginTest()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
}