/// <summary>
        /// Creates/updates the nickname for the current Forge app. Creates/updates the nickname for the current Forge app.  The nickname is  used as a clearer alternative name when identifying appbundles and activities, as  compared to using the Forge app ID.  Once you have defined a nickname,  it MUST be used instead of the Forge app ID.                The new nickname cannot be in use by any other Forge app.                The Forge app cannot have any data when this endpoint is invoked.  Use the &#39;DELETE /forgeapps/me&#39;  endpoint (cautiously!!!) to remove all data from this Forge app.  &#39;DELETE /forgeapps/me&#39; is  also the only way to remove the nickname.                Note the nickname is supplied in the body, not as a query-parameter.
        /// </summary>
        /// <exception cref="Autodesk.Forge.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">Must be \&quot;me\&quot; for the call to succeed.</param>
        /// <param name="nicknameRecord">new nickname (public key is for internal use only). (optional)</param>
        /// <returns>Task of ApiResponse (StatusCodeResult)</returns>
        public async System.Threading.Tasks.Task <ApiResponse </*StatusCodeResult*/ dynamic> > ForgeAppsCreateNicknameAsyncWithHttpInfo(string id, NicknameRecord nicknameRecord = null)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling ForgeAppsApi->ForgeAppsCreateNickname");
            }

            var    localVarPath         = "/da/us-east/v3/forgeapps/{id}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json-patch+json",
                "application/json",
                "text/json",
                "application/_*+json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (id != null)
            {
                localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter
            }
            if (nicknameRecord != null && nicknameRecord.GetType() == typeof(byte[]))        // http body (model) parameter
            {
                localVarPostBody = nicknameRecord;                                           // byte array
            }
            else if (nicknameRecord != null &&
                     (nicknameRecord.GetType() == typeof(System.IO.FileStream) ||
                      nicknameRecord.GetType() == typeof(System.IO.BinaryReader) ||
                      nicknameRecord.GetType() == typeof(System.IO.BufferedStream) ||
                      nicknameRecord.GetType() == typeof(System.IO.MemoryStream) ||
                      nicknameRecord.GetType() == typeof(System.IO.StreamReader)
                     )
                     )
            {
                localVarPostBody = Configuration.ApiClient.toByteArray(nicknameRecord); // byte array
            }
            else if (nicknameRecord != null)
            {
                localVarPostBody = Configuration.ApiClient.Serialize(nicknameRecord);
            }

            // authentication (oauth2_application) required
            // oauth required
            if (!String.IsNullOrEmpty(Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ForgeAppsCreateNickname", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse </*StatusCodeResult*/ dynamic>(localVarStatusCode,
                                                                  localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                  /*(StatusCodeResult)*/ Configuration.ApiClient.Deserialize(localVarResponse, typeof(StatusCodeResult), true)));
        }
        /// <summary>
        /// Creates/updates the nickname for the current Forge app. Creates/updates the nickname for the current Forge app.  The nickname is  used as a clearer alternative name when identifying appbundles and activities, as  compared to using the Forge app ID.  Once you have defined a nickname,  it MUST be used instead of the Forge app ID.                The new nickname cannot be in use by any other Forge app.                The Forge app cannot have any data when this endpoint is invoked.  Use the &#39;DELETE /forgeapps/me&#39;  endpoint (cautiously!!!) to remove all data from this Forge app.  &#39;DELETE /forgeapps/me&#39; is  also the only way to remove the nickname.                Note the nickname is supplied in the body, not as a query-parameter.
        /// </summary>
        /// <exception cref="Autodesk.Forge.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">Must be \&quot;me\&quot; for the call to succeed.</param>
        /// <param name="nicknameRecord">new nickname (public key is for internal use only). (optional)</param>
        /// <returns>Task of StatusCodeResult</returns>
        public async System.Threading.Tasks.Task </*StatusCodeResult*/ dynamic> ForgeAppsCreateNicknameAsync(string id, NicknameRecord nicknameRecord = null)
        {
            ApiResponse </*StatusCodeResult*/ dynamic> localVarResponse = await ForgeAppsCreateNicknameAsyncWithHttpInfo(id, nicknameRecord);

            return(localVarResponse.Data);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates/updates the nickname for the current Forge app.
        /// </summary>
        /// <remarks>
        /// Creates/updates the nickname for the current Forge app.  The nickname is  used as a clearer alternative name when identifying AppBundles and Activities, as  compared to using the Forge app ID.  Once you have defined a nickname,  it MUST be used instead of the Forge app ID.                The new nickname cannot be in use by any other Forge app.                The Forge app cannot have any data when this endpoint is invoked.  Use the &#39;DELETE /forgeapps/me&#39;  endpoint (cautiously!!!) to remove all data from this Forge app.  &#39;DELETE /forgeapps/me&#39; is  also the only way to remove the nickname.                Note the nickname is supplied in the body, not as a query-parameter.
        /// </remarks>
        /// <exception cref="HttpRequestException">Thrown when fails to make API call</exception>
        /// <param name="id">Must be \&quot;me\&quot; for the call to succeed.</param>/// <param name="nicknameRecord">new nickname (public key is for internal use only).</param>

        /// <returns>Task of HttpResponseMessage</returns>
        public async System.Threading.Tasks.Task <HttpResponseMessage> CreateNicknameAsync(string id, NicknameRecord nicknameRecord, string scopes = null, IDictionary <string, string> headers = null, bool throwOnError = true)
        {
            using (var request = new HttpRequestMessage())
            {
                request.RequestUri =
                    Marshalling.BuildRequestUri("/v3/forgeapps/{id}",
                                                routeParameters: new Dictionary <string, object> {
                    { "id", id },
                },
                                                queryParameters: new Dictionary <string, object> {
                }
                                                );

                request.Headers.TryAddWithoutValidation("Accept", "application/json");
                if (headers != null)
                {
                    foreach (var header in headers)
                    {
                        request.Headers.TryAddWithoutValidation(header.Key, header.Value);
                    }
                }

                request.Content = Marshalling.Serialize(nicknameRecord); // http body (model) parameter

                // tell the underlying pipeline what scope we'd like to use
                if (scopes == null)
                {
                    request.Properties.Add(ForgeConfiguration.ScopeKey, "code:all");
                }
                else
                {
                    request.Properties.Add(ForgeConfiguration.ScopeKey, scopes);
                }

                request.Method = new HttpMethod("PATCH");

                // make the HTTP request
                var response = await this.Service.Client.SendAsync(request);

                if (throwOnError)
                {
                    await response.EnsureSuccessStatusCodeAsync();
                }
                else if (!response.IsSuccessStatusCode)
                {
                    return(response);
                }

                return(response);
            } // using
        }
        /// <summary>
        /// Creates/updates the nickname for the current Forge app. Creates/updates the nickname for the current Forge app.  The nickname is  used as a clearer alternative name when identifying appbundles and activities, as  compared to using the Forge app ID.  Once you have defined a nickname,  it MUST be used instead of the Forge app ID.                The new nickname cannot be in use by any other Forge app.                The Forge app cannot have any data when this endpoint is invoked.  Use the &#39;DELETE /forgeapps/me&#39;  endpoint (cautiously!!!) to remove all data from this Forge app.  &#39;DELETE /forgeapps/me&#39; is  also the only way to remove the nickname.                Note the nickname is supplied in the body, not as a query-parameter.
        /// </summary>
        /// <exception cref="Autodesk.Forge.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">Must be \&quot;me\&quot; for the call to succeed.</param>
        /// <param name="nicknameRecord">new nickname (public key is for internal use only). (optional)</param>
        /// <returns>StatusCodeResult</returns>
        public /*StatusCodeResult*/ dynamic ForgeAppsCreateNickname(string id, NicknameRecord nicknameRecord = null)
        {
            ApiResponse </*StatusCodeResult*/ dynamic> localVarResponse = ForgeAppsCreateNicknameWithHttpInfo(id, nicknameRecord);

            return(localVarResponse.Data);
        }
 /// <summary>
 /// Creates/updates the nickname for the current Forge app.
 /// </summary>
 /// <remarks>
 /// Creates/updates the nickname for the current Forge app.  The nickname is  used as a clearer alternative name when identifying AppBundles and Activities, as  compared to using the Forge app ID.  Once you have defined a nickname,  it MUST be used instead of the Forge app ID.                The new nickname cannot be in use by any other Forge app.                The Forge app cannot have any data when this endpoint is invoked.  Use the &#39;DELETE /forgeapps/me&#39;  endpoint (cautiously!!!) to remove all data from this Forge app.  &#39;DELETE /forgeapps/me&#39; is  also the only way to remove the nickname.                Note the nickname is supplied in the body, not as a query-parameter.
 /// </remarks>
 /// <exception cref="HttpRequestException">Thrown when fails to make API call</exception>
 /// <param name="id">Must be \&quot;me\&quot; for the call to succeed.</param>
 /// <param name="nicknameRecord">new nickname (public key is for internal use only).</param>
 /// <returns>Task of void</returns>
 public async System.Threading.Tasks.Task CreateNicknameAsync(string id, NicknameRecord nicknameRecord)
 {
     await this.ForgeAppsApi.CreateNicknameAsync(id, nicknameRecord);
 }