Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions src/main/requests/AbstractRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,6 @@ export abstract class AbstractRequest<R extends AbstractResponse<unknown>> {
return this.parseResponse(parsed);
}

/**
* Adds a paging param to the request.
*
* @param pageOptionToken the page option token to create the param.
*
* @deprecated since 1.7.0, use {@link AbstractRequest#withPaging} instead.
*/
public addPaging(pageOptionToken: PageOptionToken): void {
this.params.before = undefined;
this.params.after = undefined;
this.params[pageOptionToken.option] = pageOptionToken.value;
}

/**
* Adds the range params to the request.
*
* @param since the since param.
* @param until the until param.
*
* @deprecated since 1.7.0, use {@link AbstractRequest#withRange} instead.
*/
public addRange(since: Date, until: Date): void {
this.params.since = since;
this.params.until = until;
}

/**
* Adds the limit param to the request.
*
* @param limit the number of objects to retrieve.
*
* @deprecated since 1.7.0, use {@link AbstractRequest#withLimit} instead.
*/
public addLimit(limit: number): void {
this.params.limit = limit;
}

/**
* Adds a paging param to the request.
*
Expand Down
25 changes: 1 addition & 24 deletions src/test/requests/AbstractRequest.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fetchMock from 'jest-fetch-mock';
import { Constants } from '../../main/Constants';
import { ApiVersion } from '../../main/Enums';
import { AbstractRequest } from '../../main/requests/AbstractRequest';
Expand Down Expand Up @@ -28,7 +29,6 @@ describe('AbstractRequest', () => {
const request: AbstractRequestImpl = new AbstractRequestImpl();

fetchMock.mockOnce(JSON.stringify(TestConstants.FULL_MEDIA_DATA));

it('Executes the request', async () => {
const response = await request.execute();
expect(response.getData()).toEqual(TestConstants.FULL_MEDIA_DATA);
Expand All @@ -45,29 +45,6 @@ describe('AbstractRequest', () => {
});
});

it('Adds the paging (deprecated method)', () => {
request.addPaging(TestConstants.BEFORE_PAGE);
expect(request.config().params.before).toEqual(TestConstants.BEFORE_PAGE.value);
request.addPaging(TestConstants.AFTER_PAGE);
expect(request.config().params.after).toEqual(TestConstants.AFTER_PAGE.value);

// Test that it clears the previous paging
expect(request.config().params.before).toBeUndefined();
request.addPaging(TestConstants.BEFORE_PAGE);
expect(request.config().params.after).toBeUndefined();
});

it('Adds the range (deprecated method)', () => {
request.addRange(TestConstants.SINCE, TestConstants.UNTIL);
expect(request.config().params.since).toEqual(TestConstants.SINCE);
expect(request.config().params.until).toEqual(TestConstants.UNTIL);
});

it('Adds the limit (deprecated method)', () => {
request.addLimit(TestConstants.LIMIT);
expect(request.config().params.limit).toEqual(TestConstants.LIMIT);
});

it('Adds the paging', () => {
expect(request.withPaging(TestConstants.BEFORE_PAGE).config().params.before).toEqual(
TestConstants.BEFORE_PAGE.value
Expand Down