diff --git a/lib/adapters/REST/endpoints/concept-scheme.ts b/lib/adapters/REST/endpoints/concept-scheme.ts index 8f4501113..e24befede 100644 --- a/lib/adapters/REST/endpoints/concept-scheme.ts +++ b/lib/adapters/REST/endpoints/concept-scheme.ts @@ -91,26 +91,6 @@ export const patch: RestEndpoint<'ConceptScheme', 'patch'> = ( } export const update: RestEndpoint<'ConceptScheme', 'update'> = ( - http: AxiosInstance, - params: UpdateConceptSchemeParams, - data: OpPatch[], - headers?: RawAxiosRequestHeaders -) => { - return raw.patch( - http, - `${basePath(params.organizationId)}/${params.conceptSchemeId}`, - data, - { - headers: { - 'X-Contentful-Version': params.version, - 'Content-Type': 'application/json-patch+json', - ...headers, - }, - } - ) -} - -export const updatePut: RestEndpoint<'ConceptScheme', 'updatePut'> = ( http: AxiosInstance, params: UpdateConceptSchemeParams, data: CreateConceptSchemeProps, diff --git a/lib/adapters/REST/endpoints/concept.ts b/lib/adapters/REST/endpoints/concept.ts index 937fb2668..1659e3257 100644 --- a/lib/adapters/REST/endpoints/concept.ts +++ b/lib/adapters/REST/endpoints/concept.ts @@ -55,26 +55,6 @@ export const patch: RestEndpoint<'Concept', 'patch'> = ( } export const update: RestEndpoint<'Concept', 'update'> = ( - http: AxiosInstance, - params: UpdateConceptParams, - data: OpPatch[], - headers?: RawAxiosRequestHeaders -) => { - return raw.patch( - http, - `${basePath(params.organizationId)}/${params.conceptId}`, - data, - { - headers: { - 'X-Contentful-Version': params.version, - 'Content-Type': 'application/json-patch+json', - ...headers, - }, - } - ) -} - -export const updatePut: RestEndpoint<'Concept', 'updatePut'> = ( http: AxiosInstance, params: UpdateConceptParams, data: CreateConceptProps, diff --git a/lib/common-types.ts b/lib/common-types.ts index 8af0d663a..1208e0152 100644 --- a/lib/common-types.ts +++ b/lib/common-types.ts @@ -463,7 +463,6 @@ type MRInternal = { (opts: MROpts<'Concept', 'createWithId', UA>): MRReturn<'Concept', 'createWithId'> (opts: MROpts<'Concept', 'patch', UA>): MRReturn<'Concept', 'patch'> (opts: MROpts<'Concept', 'update', UA>): MRReturn<'Concept', 'update'> - (opts: MROpts<'Concept', 'updatePut', UA>): MRReturn<'Concept', 'updatePut'> (opts: MROpts<'Concept', 'delete', UA>): MRReturn<'Concept', 'delete'> (opts: MROpts<'ConceptScheme', 'get', UA>): MRReturn<'ConceptScheme', 'get'> @@ -473,7 +472,6 @@ type MRInternal = { (opts: MROpts<'ConceptScheme', 'createWithId', UA>): MRReturn<'ConceptScheme', 'createWithId'> (opts: MROpts<'ConceptScheme', 'patch', UA>): MRReturn<'ConceptScheme', 'patch'> (opts: MROpts<'ConceptScheme', 'update', UA>): MRReturn<'ConceptScheme', 'update'> - (opts: MROpts<'ConceptScheme', 'updatePut', UA>): MRReturn<'ConceptScheme', 'updatePut'> (opts: MROpts<'ConceptScheme', 'delete', UA>): MRReturn<'ConceptScheme', 'delete'> (opts: MROpts<'ContentType', 'get', UA>): MRReturn<'ContentType', 'get'> @@ -1211,11 +1209,6 @@ export type MRActions = { return: ConceptProps } update: { - params: UpdateConceptParams - payload: OpPatch[] - return: ConceptProps - } - updatePut: { params: UpdateConceptParams payload: CreateConceptProps return: ConceptProps @@ -1262,11 +1255,6 @@ export type MRActions = { return: ConceptSchemeProps } update: { - params: UpdateConceptSchemeParams - payload: OpPatch[] - return: ConceptSchemeProps - } - updatePut: { params: UpdateConceptSchemeParams payload: CreateConceptSchemeProps return: ConceptSchemeProps diff --git a/lib/plain/entities/concept-scheme.ts b/lib/plain/entities/concept-scheme.ts index 56f798f83..6bf1e8faf 100644 --- a/lib/plain/entities/concept-scheme.ts +++ b/lib/plain/entities/concept-scheme.ts @@ -46,48 +46,27 @@ export type ConceptSchemePlainClientAPI = { payload: CreateConceptSchemeProps ): Promise - /** - * Update Concept Scheme - * @returns the updated Concept Scheme - * @throws if the request fails - * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept-scheme} - * @deprecated The behavior of this method as a PATCH is being deprecated, and will be replaced with a PUT in the next major version. Use the `patch` method instead. - * @example - * ```javascript - * const updatedConcept = await client.conceptScheme.update({ - * organizationId: '', - * conceptSchemeId: '', - * version: 1, - * }, conceptSchemePatch); - * ``` - */ - update( - params: SetOptional, - payload: OpPatch[] - ): Promise - /** * Update Concept Scheme with PUT * @returns the updated Concept Scheme * @throws if the request fails * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept-scheme} - * @deprecated In the next major version, this method will be replaced with the standard `update` method which will be updated to use PUT instead of PATCH. * @example * ```javascript * const updatedConcept = await client.conceptScheme.update({ * organizationId: '', * conceptSchemeId: '', * version: 1, - * }, CreateConceptSchemeProps); + * }, conceptSchemeProps); * ``` */ - updatePut( + update( params: SetOptional, payload: CreateConceptSchemeProps ): Promise /** - * Update Concept Scheme + * Update Concept Scheme with PATCH * @returns the updated Concept Scheme * @throws if the request fails * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept-scheme} diff --git a/lib/plain/entities/concept.ts b/lib/plain/entities/concept.ts index 568e8c446..06d5a059f 100644 --- a/lib/plain/entities/concept.ts +++ b/lib/plain/entities/concept.ts @@ -48,47 +48,26 @@ export type ConceptPlainClientAPI = { ): Promise /** - * Update Concept + * Update Concept with PUT * @returns the updated Concept * @throws if the request fails * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept} - * @deprecated The behavior of this method as a PATCH is being deprecated, and will be replaced with a PUT in the next major version. Use the `patch` method instead. * @example * ```javascript * const updatedConcept = await client.concept.update({ * organizationId: '', * conceptId: '', * version: 1, - * }, patch); + * }, conceptProps); * ``` */ update( - params: SetOptional, - payload: OpPatch[] - ): Promise - - /** - * Update Concept with PUT - * @returns the updated Concept - * @throws if the request fails - * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept} - * @deprecated In the next major version, this method will be replaced with the standard `update` method which will be updated to use PUT instead of PATCH. - * @example - * ```javascript - * const updatedConcept = await client.concept.updatePut({ - * organizationId: '', - * conceptId: '', - * version: 1, - * }, patch); - * ``` - */ - updatePut( params: SetOptional, payload: CreateConceptProps ): Promise /** - * Update Concept + * Update Concept with PATCH * @returns the updated Concept * @throws if the request fails * @see {@link https://www.contentful.com/developers/docs/references/content-management-api/#/reference/taxonomy/concept} diff --git a/lib/plain/plain-client.ts b/lib/plain/plain-client.ts index eb4567203..ce0db5b41 100644 --- a/lib/plain/plain-client.ts +++ b/lib/plain/plain-client.ts @@ -111,7 +111,6 @@ export const createPlainClient = ( delete: wrap(wrapParams, 'Concept', 'delete'), patch: wrap(wrapParams, 'Concept', 'patch'), update: wrap(wrapParams, 'Concept', 'update'), - updatePut: wrap(wrapParams, 'Concept', 'updatePut'), getMany: wrap(wrapParams, 'Concept', 'getMany'), getDescendants: wrap(wrapParams, 'Concept', 'getDescendants'), getAncestors: wrap(wrapParams, 'Concept', 'getAncestors'), @@ -126,7 +125,6 @@ export const createPlainClient = ( createWithId: wrap(wrapParams, 'ConceptScheme', 'createWithId'), patch: wrap(wrapParams, 'ConceptScheme', 'patch'), update: wrap(wrapParams, 'ConceptScheme', 'update'), - updatePut: wrap(wrapParams, 'ConceptScheme', 'updatePut'), }, function: { getMany: wrap(wrapParams, 'Function', 'getMany'), diff --git a/test/integration/taxonomy-integration.test.ts b/test/integration/taxonomy-integration.test.ts index c372528db..4d85f5d33 100644 --- a/test/integration/taxonomy-integration.test.ts +++ b/test/integration/taxonomy-integration.test.ts @@ -126,36 +126,6 @@ describe('Taxonomy Integration', () => { expect(result.scopeNote['en-US']).toEqual('Scope Note') }) - it('creates and updates a concept', async () => { - const concept: CreateConceptProps = { - prefLabel: { - 'en-US': 'Test Concept', - }, - } - const result = await client.concept.create({}, concept) - isConceptProps(result) - expect(result.prefLabel['en-US']).toBe('Test Concept') - expect(result.uri).toBeNull() - conceptsToDelete.push(result) - - const updatedConcept = await client.concept.update( - { - version: result.sys.version, - conceptId: result.sys.id, - }, - [ - { - path: '/uri', - op: 'replace', - value: 'https://example.com/concept', - }, - ] - ) - - isConceptProps(updatedConcept) - expect(updatedConcept.uri).toBe('https://example.com/concept') - }) - it('create and update a concept - patch', async () => { const concept: CreateConceptProps = { prefLabel: { @@ -198,7 +168,7 @@ describe('Taxonomy Integration', () => { expect(result.uri).to.null conceptsToDelete.push(result) - const updatedConcept = await client.concept.updatePut( + const updatedConcept = await client.concept.update( { version: result.sys.version, conceptId: result.sys.id, @@ -406,36 +376,6 @@ describe('Taxonomy Integration', () => { expect(result.definition['en-US']).toBe('Definition') }) - it('creates and updates a concept scheme', async () => { - const conceptScheme: CreateConceptSchemeProps = { - prefLabel: { - 'en-US': 'Test ConceptScheme', - }, - } - const result = await client.conceptScheme.create({}, conceptScheme) - isConceptSchemeProps(result) - expect(result.prefLabel['en-US']).toBe('Test ConceptScheme') - expect(result.uri).toBeNull() - conceptSchemesToDelete.push(result) - - const updatedConceptScheme = await client.conceptScheme.update( - { - version: result.sys.version, - conceptSchemeId: result.sys.id, - }, - [ - { - path: '/uri', - op: 'replace', - value: 'https://example.com/updatedConceptScheme', - }, - ] - ) - - isConceptSchemeProps(updatedConceptScheme) - expect(updatedConceptScheme.uri).toBe('https://example.com/updatedConceptScheme') - }) - it('create and update a conceptScheme - patch', async () => { const conceptScheme: CreateConceptSchemeProps = { prefLabel: { @@ -478,7 +418,7 @@ describe('Taxonomy Integration', () => { expect(result.uri).to.null conceptSchemesToDelete.push(result) - const updatedConceptScheme = await client.conceptScheme.updatePut( + const updatedConceptScheme = await client.conceptScheme.update( { version: result.sys.version, conceptSchemeId: result.sys.id, diff --git a/test/unit/adapters/REST/endpoints/concept-scheme.test.ts b/test/unit/adapters/REST/endpoints/concept-scheme.test.ts index 3b0343aee..633a8a791 100644 --- a/test/unit/adapters/REST/endpoints/concept-scheme.test.ts +++ b/test/unit/adapters/REST/endpoints/concept-scheme.test.ts @@ -119,34 +119,13 @@ describe('ConceptScheme', () => { }) test('update', async () => { - const { httpMock, adapterMock, entityMock } = setup(Promise.resolve({})) - httpMock.patch.mockReturnValue(Promise.resolve({ data: entityMock })) - - return adapterMock - .makeRequest({ - entityType: 'ConceptScheme', - action: 'update', - userAgent: 'mocked', - params: { - organizationId: 'organization-id', - conceptSchemeId: 'concept-scheme-id', - }, - }) - .then(() => { - expect(httpMock.patch.mock.calls[0][0]).to.eql( - '/organizations/organization-id/taxonomy/concept-schemes/concept-scheme-id' - ) - }) - }) - - test('updatePut', async () => { const { httpMock, adapterMock, entityMock } = setup(Promise.resolve({})) httpMock.put.mockReturnValue(Promise.resolve({ data: entityMock })) return adapterMock .makeRequest({ entityType: 'ConceptScheme', - action: 'updatePut', + action: 'update', params: { organizationId: 'organization-id', conceptSchemeId: 'concept-scheme-id', diff --git a/test/unit/adapters/REST/endpoints/concept.test.ts b/test/unit/adapters/REST/endpoints/concept.test.ts index 3a30ef420..9f24572e7 100644 --- a/test/unit/adapters/REST/endpoints/concept.test.ts +++ b/test/unit/adapters/REST/endpoints/concept.test.ts @@ -171,33 +171,12 @@ describe('Concept', () => { test('update', async () => { const { httpMock, adapterMock, entityMock } = setup(Promise.resolve({})) - httpMock.patch.mockReturnValue(Promise.resolve({ data: entityMock })) - - return adapterMock - .makeRequest({ - entityType: 'Concept', - action: 'update', - userAgent: 'mocked', - params: { - organizationId: 'organization-id', - conceptId: 'concept-id', - }, - }) - .then(() => { - expect(httpMock.patch.mock.calls[0][0]).to.eql( - '/organizations/organization-id/taxonomy/concepts/concept-id' - ) - }) - }) - test('updatePut', async () => { - const { httpMock, adapterMock, entityMock } = setup(Promise.resolve({})) - httpMock.put.mockReturnValue(Promise.resolve({ data: entityMock })) return adapterMock .makeRequest({ entityType: 'Concept', - action: 'updatePut', + action: 'update', params: { organizationId: 'organization-id', conceptId: 'concept-id',