Skip to content

Commit

Permalink
rename delete methods to remove
Browse files Browse the repository at this point in the history
  • Loading branch information
ksvirkou-hubspot committed Dec 13, 2023
1 parent de299c4 commit 6ef651e
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 235 deletions.
140 changes: 70 additions & 70 deletions codegen/crm/lists/apis/ListsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,6 @@ import { ListsByIdResponse } from '../models/ListsByIdResponse';
*/
export class ListsApiRequestFactory extends BaseAPIRequestFactory {

/**
* Delete a list by **ILS list ID**. Lists deleted through this endpoint can be restored up to 90-days following the delete. After 90-days, the list is purged and can no longer be restored.
* Delete a List
* @param listId The **ILS ID** of the list to delete.
*/
public async _delete(listId: number, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'listId' is not null or undefined
if (listId === null || listId === undefined) {
throw new RequiredError("ListsApi", "_delete", "listId");
}


// Path Params
const localVarPath = '/crm/v3/lists/{listId}'
.replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["oauth2"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* Create a new list with the provided object list definition.
* Create List
Expand Down Expand Up @@ -298,6 +260,44 @@ export class ListsApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

/**
* Delete a list by **ILS list ID**. Lists deleted through this endpoint can be restored up to 90-days following the delete. After 90-days, the list is purged and can no longer be restored.
* Delete a List
* @param listId The **ILS ID** of the list to delete.
*/
public async remove(listId: number, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'listId' is not null or undefined
if (listId === null || listId === undefined) {
throw new RequiredError("ListsApi", "remove", "listId");
}


// Path Params
const localVarPath = '/crm/v3/lists/{listId}'
.replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["oauth2"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* Restore a previously deleted list by **ILS list ID**. Deleted lists are eligible to be restored up-to 90-days after the list has been deleted.
* Restore a List
Expand Down Expand Up @@ -455,38 +455,6 @@ export class ListsApiRequestFactory extends BaseAPIRequestFactory {

export class ListsApiResponseProcessor {

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to _delete
* @throws ApiException if the response code was not in [200, 299]
*/
public async _delete(response: ResponseContext): Promise<void > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("204", response.httpStatusCode)) {
return;
}
if (isCodeInRange("0", response.httpStatusCode)) {
const body: Error = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Error", ""
) as Error;
throw new ApiException<Error>(response.httpStatusCode, "An error occurred.", body, response.headers);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: void = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"void", ""
) as void;
return body;
}

throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down Expand Up @@ -667,6 +635,38 @@ export class ListsApiResponseProcessor {
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to remove
* @throws ApiException if the response code was not in [200, 299]
*/
public async remove(response: ResponseContext): Promise<void > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("204", response.httpStatusCode)) {
return;
}
if (isCodeInRange("0", response.httpStatusCode)) {
const body: Error = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Error", ""
) as Error;
throw new ApiException<Error>(response.httpStatusCode, "An error occurred.", body, response.headers);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: void = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"void", ""
) as void;
return body;
}

throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down
128 changes: 64 additions & 64 deletions codegen/crm/lists/apis/MembershipsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,44 +175,6 @@ export class MembershipsApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

/**
* Remove **all** of the records from a list. ***Note:*** *The list is not deleted.* This endpoint only works for lists that have a `processingType` of `MANUAL` or `SNAPSHOT`.
* Delete All Records from a List
* @param listId The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
*/
public async deleteAll(listId: number, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'listId' is not null or undefined
if (listId === null || listId === undefined) {
throw new RequiredError("MembershipsApi", "deleteAll", "listId");
}


// Path Params
const localVarPath = '/crm/v3/lists/{listId}/memberships'
.replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["oauth2"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* Fetch the memberships of a list in order sorted by the `recordId` of the records in the list. The `recordId`s are sorted in *ascending* order if an `after` offset or no offset is provided. If only a `before` offset is provided, then the records are sorted in *descending* order. The `after` offset parameter will take precedence over the `before` offset in a case where both are provided.
* Fetch List Memberships Ordered by ID
Expand Down Expand Up @@ -328,6 +290,44 @@ export class MembershipsApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

/**
* Remove **all** of the records from a list. ***Note:*** *The list is not deleted.* This endpoint only works for lists that have a `processingType` of `MANUAL` or `SNAPSHOT`.
* Delete All Records from a List
* @param listId The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
*/
public async removeAll(listId: number, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'listId' is not null or undefined
if (listId === null || listId === undefined) {
throw new RequiredError("MembershipsApi", "removeAll", "listId");
}


// Path Params
const localVarPath = '/crm/v3/lists/{listId}/memberships'
.replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["oauth2"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

}

export class MembershipsApiResponseProcessor {
Expand Down Expand Up @@ -440,13 +440,17 @@ export class MembershipsApiResponseProcessor {
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to deleteAll
* @params response Response returned by the server for a request to getPage
* @throws ApiException if the response code was not in [200, 299]
*/
public async deleteAll(response: ResponseContext): Promise<void > {
public async getPage(response: ResponseContext): Promise<CollectionResponseLong > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("204", response.httpStatusCode)) {
return;
if (isCodeInRange("200", response.httpStatusCode)) {
const body: CollectionResponseLong = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"CollectionResponseLong", ""
) as CollectionResponseLong;
return body;
}
if (isCodeInRange("0", response.httpStatusCode)) {
const body: Error = ObjectSerializer.deserialize(
Expand All @@ -458,10 +462,10 @@ export class MembershipsApiResponseProcessor {

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: void = ObjectSerializer.deserialize(
const body: CollectionResponseLong = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"void", ""
) as void;
"CollectionResponseLong", ""
) as CollectionResponseLong;
return body;
}

Expand All @@ -472,16 +476,16 @@ export class MembershipsApiResponseProcessor {
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getPage
* @params response Response returned by the server for a request to remove
* @throws ApiException if the response code was not in [200, 299]
*/
public async getPage(response: ResponseContext): Promise<CollectionResponseLong > {
public async remove(response: ResponseContext): Promise<MembershipsUpdateResponse > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: CollectionResponseLong = ObjectSerializer.deserialize(
const body: MembershipsUpdateResponse = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"CollectionResponseLong", ""
) as CollectionResponseLong;
"MembershipsUpdateResponse", ""
) as MembershipsUpdateResponse;
return body;
}
if (isCodeInRange("0", response.httpStatusCode)) {
Expand All @@ -494,10 +498,10 @@ export class MembershipsApiResponseProcessor {

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: CollectionResponseLong = ObjectSerializer.deserialize(
const body: MembershipsUpdateResponse = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"CollectionResponseLong", ""
) as CollectionResponseLong;
"MembershipsUpdateResponse", ""
) as MembershipsUpdateResponse;
return body;
}

Expand All @@ -508,17 +512,13 @@ export class MembershipsApiResponseProcessor {
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to remove
* @params response Response returned by the server for a request to removeAll
* @throws ApiException if the response code was not in [200, 299]
*/
public async remove(response: ResponseContext): Promise<MembershipsUpdateResponse > {
public async removeAll(response: ResponseContext): Promise<void > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: MembershipsUpdateResponse = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"MembershipsUpdateResponse", ""
) as MembershipsUpdateResponse;
return body;
if (isCodeInRange("204", response.httpStatusCode)) {
return;
}
if (isCodeInRange("0", response.httpStatusCode)) {
const body: Error = ObjectSerializer.deserialize(
Expand All @@ -530,10 +530,10 @@ export class MembershipsApiResponseProcessor {

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: MembershipsUpdateResponse = ObjectSerializer.deserialize(
const body: void = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"MembershipsUpdateResponse", ""
) as MembershipsUpdateResponse;
"void", ""
) as void;
return body;
}

Expand Down
Loading

0 comments on commit 6ef651e

Please sign in to comment.