当前位置: 首页>>代码示例>>C#>>正文


C# IRestClient.Execute方法代码示例

本文整理汇总了C#中IRestClient.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# IRestClient.Execute方法的具体用法?C# IRestClient.Execute怎么用?C# IRestClient.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRestClient的用法示例。


在下文中一共展示了IRestClient.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Logout

 public static void Logout(IRestClient restClient)
 {
     var request = new RestRequest("api/rest/session/logout", Method.POST);
     var responseData = restClient.Execute<RestResponseBaseExt>(request);
     //Dont throw Exception as it doesnt matter if Logout has worked
     //ThrowIfNotSuccessful(responseData);
 }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:7,代码来源:AgorumRestHelper.Session.cs

示例2: CreateLinks

        public static void CreateLinks(IRestClient restClient, long sourceFileId, long[] destFolderId,
                                      TransactionResponse transaction = null)
        {
            if (destFolderId == null || destFolderId.Length == 0)
                return;

            var createRequest = new RestRequest("api/rest/object/link/{id}", Method.POST);
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);

            createRequest.AddUrlSegment("id", sourceFileId.ToString("D"));

            foreach (var value in destFolderId)
            {
                createRequest.AddParameter("target", value.ToString("D"));
            }
            createRequest.AddParameter("parameters", createRequest.JsonSerializer.Serialize(new {aclfromtarget = true}));

            var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);
            ThrowIfNotSuccessful(tmpResponse, "duplicate entry");

            //var createRequest = new RestRequest("/api/rest/parse/xml", Method.POST);
            //if (transaction != null)
            //    createRequest.AddParameter("transactionId", transaction.TransactionId);
            //createRequest.AddParameter("xml", AgorumFile.GenerateLinkObjectToFolderXml(sourceFileId, destFolderId));

            //var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);

            //ThrowIfNotSuccessful(tmpResponse, "duplicate");
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:30,代码来源:AgorumRestHelper.Object.Create.cs

示例3: MoveObjects

        public static void MoveObjects(IRestClient restClient, long[] pFileIds, long pFromId, long pToId,
            TransactionResponse transaction = null)
        {
            if (pFileIds == null || pFileIds.Length == 0)
                return;

            var createRequest = new RestRequest("api/rest/object/move/{id}", Method.POST);
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);

            for (var i = 0; i < pFileIds.Length; i++)
            {
                if (i == 0)
                    createRequest.AddUrlSegment("id", pFileIds[i].ToString("D"));
                else
                    createRequest.AddParameter("id", pFileIds[i].ToString("D"));
            }
            createRequest.AddParameter("target", pToId.ToString("D"));
            createRequest.AddParameter("parameters", createRequest.JsonSerializer.Serialize(new
            {
                parent = new[] {pFromId.ToString("D")},
                inheritAcl = true
            }));

            var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);
            ThrowIfNotSuccessful(tmpResponse);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:27,代码来源:AgorumRestHelper.Object.Update.cs

示例4: CreateFolder

        public static void CreateFolder(IRestClient restClient, AgorumFolder folder,
                                        TransactionResponse transaction = null)
        {
            var createRequest = new RestRequest("api/rest/object", Method.POST);
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);
            createRequest.AddParameter("handler", "object");

            createRequest.AddParameter("data", createRequest.JsonSerializer.Serialize(new Data
                {
                    classname = folder.Classname,
                    name = AgorumObject.RemoveIllegalChars(folder.Name),
                    target = folder.AnyFolderPathId != 0 ? folder.AnyFolderPathId.ToString() : GetAgorumAbsolutePath(folder.AnyFolderPath),
                    createtarget = folder.AnyFolderPathId == 0
                }));

            foreach (var property in folder.GetProperties())
            {
                createRequest.AddParameter("properties", property);
            }

            var tmpResponse = restClient.Execute<RestResponseBaseExt<AgorumFolder>>(createRequest);
            ThrowIfNotSuccessful(tmpResponse);

            folder.FillFromObject(tmpResponse.Data.Data);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:26,代码来源:AgorumRestHelper.Object.Create.cs

示例5: Login

        public static void Login(IRestClient restClient, string pUsername, string pPassword)
        {
            var request = new RestRequest("api/rest/session/login", Method.POST);
            request.AddParameter("username", pUsername);
            request.AddParameter("password", pPassword);

            // execute the request
            var responseData = restClient.Execute<LoginResponse>(request);
            ThrowIfNotSuccessful(responseData);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:10,代码来源:AgorumRestHelper.Session.cs

示例6: CreateEdit

 private static string CreateEdit(IRestClient restClient, string applicationId, string accessToken)
 {
     Console.WriteLine("Creating edit");
     var request = new RestRequest("/androidpublisher/v2/applications/{applicationId}/edits", Method.POST);
     request.AddUrlSegment("applicationId", applicationId);
     request.AddQueryParameter("access_token", accessToken);
     var response = restClient.Execute<EditResponse>(request);
     CheckResponse(response);
     return response.Data.Id;
 }
开发者ID:manicmonkey,项目名称:upload-apk,代码行数:10,代码来源:Program.cs

示例7: CommitEdit

 private static void CommitEdit(IRestClient restClient, string accessToken, string applicationId, string editId)
 {
     Console.WriteLine("Committing edit");
     var request = new RestRequest("/androidpublisher/v2/applications/{applicationId}/edits/{editId}:commit", Method.POST);
     request.AddUrlSegment("applicationId", applicationId);
     request.AddUrlSegment("editId", editId);
     request.AddQueryParameter("access_token", accessToken);
     var response = restClient.Execute<EditResponse>(request);
     CheckResponse(response);
 }
开发者ID:manicmonkey,项目名称:upload-apk,代码行数:10,代码来源:Program.cs

示例8: UpdateAndRenameObject

        public static void UpdateAndRenameObject(IRestClient restClient, AgorumObject agObject, TransactionResponse transaction = null)
        {
            //Angabe von Id nicht nötig, da XML ObjectZuweisungen in XML-Anweisung hat und nicht zu einem bestimmten Object hochgeladen wird.
            var createRequest = new RestRequest("/api/rest/parse/xml", Method.POST);
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);
            createRequest.AddParameter("xml", agObject.GenerateUpdateObjectXml());

            var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);
            ThrowIfNotSuccessful(tmpResponse);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:11,代码来源:AgorumRestHelper.Object.Update.cs

示例9: CreateTransaction

        public static TransactionResponse CreateTransaction(IRestClient restClient)
        {
            var request = new RestRequest("api/rest/session/transaction ", Method.POST);
            request.AddParameter("timeout", 300); //5 Minuten Timeout

            // execute the request
            var responseData = restClient.Execute<TransactionResponse>(request);
            ThrowIfNotSuccessful(responseData);

            return responseData.Data;
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:11,代码来源:AgorumRestHelper.Session.cs

示例10: CommitTransaction

        public static void CommitTransaction(IRestClient restClient, TransactionResponse transaction, bool abortTransaction = false)
        {
            var request = new RestRequest("api/rest/session/transaction/{id}", Method.DELETE);
            //request.AddParameter("id", transaction.TransactionId);
            request.AddUrlSegment("id", transaction.TransactionId);
            request.AddParameter("rollback", abortTransaction); //If true, Transaction gets aborted

            // execute the request
            var responseData = restClient.Execute<RestResponseBaseExt>(request);
            ThrowIfNotSuccessful(responseData);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:11,代码来源:AgorumRestHelper.Session.cs

示例11: DeleteObject

        public static void DeleteObject(IRestClient restClient, long id, TransactionResponse transaction = null)
        {
            var createRequest = new RestRequest("api/rest/object/{id}", Method.DELETE);
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);
            createRequest.AddParameter("handler", "object");
            createRequest.AddUrlSegment("id", id.ToString("D"));

            var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);
            ThrowIfNotSuccessful(tmpResponse);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:11,代码来源:AgorumRestHelper.Object.Delete.cs

示例12: DeleteLink

        public static void DeleteLink(IRestClient restClient, long fileId, long parentId,
                                       TransactionResponse transaction = null)
        {
            var createRequest = new RestRequest("api/rest/object/{id}", Method.DELETE);
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);
            createRequest.AddUrlSegment("id", fileId.ToString("D"));
            createRequest.AddParameter("parameters", createRequest.JsonSerializer.Serialize(new { parent = parentId.ToString("D") }));

            var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);
            ThrowIfNotSuccessful(tmpResponse);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:12,代码来源:AgorumRestHelper.Object.Delete.cs

示例13: AddUserToJiraGroup

 public string AddUserToJiraGroup(JiraDeveloper newdeveloper, string role, IRestClient client)
 {
     var requestBody = string.Format("group/user?groupname={0}", role);
     var request = new RestRequest(requestBody, Method.POST);
     request.RequestFormat = DataFormat.Json;
     request.AddBody(new
     {
         name = newdeveloper.name
     });
     var resp = client.Execute(request);
     return AnalyzeResponse(resp);
 }
开发者ID:pesetskyps,项目名称:Jira_User_add,代码行数:12,代码来源:HomeController.cs

示例14: GetAccessTokenAsync

			public async Task GetAccessTokenAsync(IRestClient client, string authCode)
			{
				var request = new RestRequest("oauth/token", HttpMethod.Post)
					.AddJsonBody(new 
						{
							code = authCode,
							client_id = ClientId,
							client_secret = ClientSecret,
							redirect_uri = RedirectUri.AbsoluteUri,
							grant_type = "authorization_code"
						});

				var response = await client.Execute<OAuthToken>(request);
				token = response.Data;
			}
开发者ID:SamirHafez,项目名称:Fresh,代码行数:15,代码来源:TraktService.cs

示例15: RenameObject

        public static void RenameObject(IRestClient restClient, AgorumFile agObject, TransactionResponse transaction = null)
        {
            var createRequest = new RestRequest("/api/rest/object/{id}", Method.PUT);
            createRequest.AddUrlSegment("id", agObject.Id.ToString("D"));
            if (transaction != null)
                createRequest.AddParameter("transactionId", transaction.TransactionId);
            createRequest.AddParameter("updatehandler", "object");

            createRequest.AddParameter("data", createRequest.JsonSerializer.Serialize(new
            {
                name = agObject.Name
            }));

            var tmpResponse = restClient.Execute<RestResponseBaseExt>(createRequest);
            ThrowIfNotSuccessful(tmpResponse);
        }
开发者ID:hoppler,项目名称:AgorumRest,代码行数:16,代码来源:AgorumRestHelper.Object.Update.cs


注:本文中的IRestClient.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。