diff --git a/__tests__/fixtures/crm-request-array31.yml b/__tests__/fixtures/crm-request-array31.yml new file mode 100644 index 00000000..9d46ba80 --- /dev/null +++ b/__tests__/fixtures/crm-request-array31.yml @@ -0,0 +1,1683 @@ +openapi: 3.1.0 +info: + version: 4.1.0 + title: CRM API - ITEMS + description: 'Welcome to the CRM API.' + contact: + email: hello@apideck.com + url: 'https://developers.apideck.com' + x-logo: + url: 'https://developers.apideck.com/icon.png' + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +externalDocs: + description: Apideck Developer Docs + url: 'https://developers.apideck.com' +servers: + - url: 'https://unify.apideck.com' + description: Production +security: + - apiKey: [] + applicationId: [] + consumerId: [] +tags: + - name: Companies + description: '' +components: + schemas: + Address: + type: object + properties: + id: + type: string + example: '123' + nullable: true + type: + type: string + x-graphql-type-name: AddressType + enum: + - primary + - secondary + - home + - office + - shipping + - billing + - other + example: primary + name: + type: string + example: HQ US + nullable: true + line1: + type: string + example: Main street + description: 'Line 1 of the address e.g. number, street, suite, apt #, etc.' + nullable: true + line2: + type: string + example: 'apt #' + description: Line 2 of the address + nullable: true + city: + type: string + example: San Francisco + description: Name of city. + nullable: true + state: + type: string + example: CA + description: Name of state + nullable: true + postal_code: + type: string + example: '94104' + description: Zip code or equivalent. + nullable: true + country: + type: string + example: US + description: country code according to ISO 3166-1 alpha-2. + nullable: true + latitude: + type: string + example: '40.759211' + nullable: true + longitude: + type: string + example: '-73.984638' + nullable: true + BadRequest: + properties: + status_code: + type: number + description: HTTP status code + example: 400 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Bad Request + typeName: + type: string + description: The type of error returned + example: RequestHeadersValidationError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid Params + detail: + anyOf: + - type: string + example: Missing property foobar + - type: object + example: + missing: + - - foobar: required + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#requestbodyvalidationerror' + BankAccount: + type: object + properties: + iban: + type: string + example: CH2989144532982975332 + nullable: true + bic: + type: string + example: AUDSCHGGXXX + nullable: true + CompaniesFilter: + type: object + x-graphql-type-name: CompaniesFilter + example: + name: SpaceX + properties: + name: + type: string + description: Name of the company to filter on + example: SpaceX + additionalProperties: false + CompaniesSort: + type: object + x-graphql-type-name: CompaniesSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Companies + enum: + - created_at + - updated_at + - name + example: created_at + direction: + type: string + description: The direction in which to sort the Companies + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + CompanyArray: + type: array + items: + $ref: '#/components/schemas/Company' + Company: + type: object + required: + - name + additionalProperties: false + properties: + id: + type: string + readOnly: true + example: '12345' + name: + type: string + example: Copper + minLength: 1 + interaction_count: + type: integer + example: 1 + readOnly: true + nullable: true + owner_id: + type: string + example: '12345' + image_url: + type: string + example: 'https://www.spacex.com/static/images/share.jpg' + nullable: true + description: + type: string + example: 'A crm that works for you, so you can spend time on relationships instead of data.' + nullable: true + vat_number: + description: VAT number + type: string + example: BE0689615164 + nullable: true + currency: + type: string + example: USD + nullable: true + status: + type: string + minLength: 1 + example: Open + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + bank_accounts: + type: array + items: + $ref: '#/components/schemas/BankAccount' + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + Contact: + required: + - name + x-pii: + - name + - first_name + - middle_name + - last_name + - email + properties: + id: + type: string + example: '12345' + readOnly: true + name: + type: string + example: Elon Musk + minLength: 1 + owner_id: + type: string + example: '54321' + nullable: true + company_id: + type: string + example: '23456' + nullable: true + company_name: + type: string + example: '23456' + nullable: true + lead_id: + type: string + example: '34567' + nullable: true + first_name: + type: string + example: Elon + nullable: true + middle_name: + type: string + example: D. + nullable: true + last_name: + type: string + example: Musk + nullable: true + prefix: + type: string + example: Mr. + nullable: true + suffix: + type: string + example: PhD + nullable: true + title: + type: string + example: CEO + nullable: true + department: + type: string + example: Engineering + nullable: true + language: + type: string + example: EN + description: language code according to ISO 639-1. For the United States - EN + nullable: true + gender: + type: string + enum: + - male + - female + - unisex + example: female + nullable: true + birthday: + type: string + example: '2000-08-12' + nullable: true + image: + type: string + example: 'https://logo.dev/spacex.com?s=128' + nullable: true + lead_source: + type: string + minLength: 1 + example: Cold Call + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + description: + type: string + example: Internal champion + nullable: true + status: + type: string + example: open + nullable: true + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + additionalProperties: false + ContactsFilter: + type: object + x-graphql-type-name: ContactsFilter + example: + first_name: Elon + last_name: Musk + email: elon@tesla.com + properties: + name: + type: string + description: Name of the contact to filter on + example: Elon Musk + first_name: + type: string + description: First name of the contact to filter on + example: Elon + last_name: + type: string + description: Last name of the contact to filter on + example: Musk + email: + type: string + description: E-mail of the contact to filter on + example: elon@tesla.com + additionalProperties: false + ContactsSort: + type: object + x-graphql-type-name: ContactsSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Contacts + enum: + - created_at + - updated_at + - name + - first_name + - last_name + - email + example: created_at + direction: + type: string + description: The direction in which to sort the Contacts + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + CreateCompanyResponse: + $id: https://developers.apideck.com/CreateCompany.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CustomField: + type: object + required: + - id + additionalProperties: false + properties: + id: + type: string + example: custom_technologies + value: + anyOf: + - type: string + example: Uses Salesforce and Marketo + nullable: true + - type: number + example: 10 + nullable: true + - type: boolean + example: true + nullable: true + - type: array + items: + type: string + DeleteCompanyResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + Email: + required: + - email + type: object + properties: + id: + type: string + example: '123' + email: + type: string + format: email + example: elon@musk.com + minLength: 1 + type: + type: string + x-graphql-type-name: EmailType + enum: + - primary + - secondary + - work + - personal + - billing + - other + example: primary + GetCompaniesResponse: + x-graphql-type-name: CompanyList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Company' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetCompaniesArrayResponse: + $id: https://developers.apideck.com/CreateCompany.json + $schema: http://json-schema.org/draft-07/schema# + type: array + items: + $ref: '#/components/schemas/GetCompanyResponse' + GetCompanyResponse: + x-graphql-type-name: company + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Company' + GetContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Contact' + GetContactsResponse: + x-graphql-type-name: ContactList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Contact' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/User' + GetUsersResponse: + x-graphql-type-name: UserList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/User' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + Links: + type: object + description: Links to navigate to previous or next pages through the API + properties: + previous: + type: string + description: Link to navigate to the previous page through the API + example: 'https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D' + nullable: true + current: + type: string + description: Link to navigate to the current page through the API + example: 'https://unify.apideck.com/crm/companies' + next: + type: string + description: Link to navigate to the previous page through the API + example: 'https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM' + nullable: true + Meta: + type: object + description: Reponse metadata + properties: + items_on_page: + type: integer + description: Number of items returned in the data property of the response + example: 50 + cursors: + type: object + description: Cursors to navigate to previous or next pages through the API + properties: + previous: + type: string + description: Cursor to navigate to the previous page of results through the API + example: em9oby1jcm06OnBhZ2U6OjE= + nullable: true + current: + type: string + description: Cursor to navigate to the current page of results through the API + example: em9oby1jcm06OnBhZ2U6OjI= + nullable: true + next: + type: string + description: Cursor to navigate to the next page of results through the API + example: em9oby1jcm06OnBhZ2U6OjM= + nullable: true + NotFoundResponse: + properties: + status_code: + type: number + description: HTTP status code + example: 404 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Not Found + typeName: + type: string + description: The type of error returned + example: EntityNotFoundError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unknown Widget + detail: + anyOf: + - type: string + example: "Could not find widget with id: '123'" + - type: object + example: + not_found: + entity: widget + id: '123' + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#entitynotfounderror' + NotImplemented: + properties: + status_code: + type: number + description: HTTP status code + example: 501 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Not Implemented + typeName: + type: string + description: The type of error returned + example: MappingError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unmapped Attribute + detail: + anyOf: + - type: string + example: Failed to retrieve Widget tokenUrl from 'components.securitySchemes.oauth2.flows' + - type: object + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#mappingerror' + PaymentRequired: + properties: + status_code: + type: number + description: HTTP status code + example: 402 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Payment Required + typeName: + type: string + description: The type of error returned + example: RequestLimitError + message: + type: string + description: A human-readable message providing more details about the error. + example: Request Limit Reached + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: You have reached your limit of 2000 + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#requestlimiterror' + PhoneNumber: + required: + - number + type: object + properties: + id: + type: string + example: '12345' + nullable: true + number: + type: string + example: 111-111-1111 + minLength: 1 + type: + type: string + x-graphql-type-name: PhoneType + enum: + - primary + - secondary + - home + - office + - mobile + - assistant + - fax + - other + example: primary + SocialLink: + required: + - url + type: object + properties: + id: + type: string + example: '12345' + nullable: true + url: + type: string + example: 'https://www.twitter.com/apideck-io' + minLength: 1 + type: + type: string + example: twitter + nullable: true + Tags: + type: array + items: + type: string + example: + - New + User: + required: + - email + x-pii: + - username + - first_name + - last_name + - email + properties: + id: + type: string + example: '12345' + readOnly: true + email: + type: string + format: email + example: elon@musk.com + minLength: 1 + parent_id: + type: string + example: '54321' + nullable: true + username: + type: string + example: masterofcoin + nullable: true + first_name: + type: string + example: Elon + nullable: true + last_name: + type: string + example: Musk + nullable: true + image: + type: string + example: 'https://logo.dev/spacex.com?s=128' + nullable: true + language: + type: string + example: EN + nullable: true + status: + type: string + example: active + nullable: true + password: + type: string + example: supersecretpassword + writeOnly: true + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + Unauthorized: + properties: + status_code: + type: number + description: HTTP status code + example: 401 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Unauthorized + typeName: + type: string + description: The type of error returned + example: UnauthorizedError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unauthorized Request + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: Failed to generate valid JWT Session. Verify applicationId is correct + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#unauthorizederror' + UnexpectedError: + properties: + status_code: + type: number + description: HTTP status code + example: 400 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Bad Request + typeName: + type: string + description: The type of error returned + example: RequestHeadersValidationError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid Params + detail: + anyOf: + - type: string + example: 'Missing Header: x-apideck-consumer-id' + - type: object + example: + missing: + - - x-apideck-consumer-id: required + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#unauthorizederror' + UnifiedId: + title: UnifiedId + required: + - id + properties: + id: + type: string + readOnly: true + example: '12345' + Unprocessable: + properties: + status_code: + type: number + description: HTTP status code + example: 422 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Unprocessable Entity + typeName: + type: string + description: The type of error returned + example: InvalidStateError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid State + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: State did not include unified_api + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#invalidstateerror' + UpdateCompanyResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + Website: + type: object + required: + - url + properties: + id: + type: string + example: '12345' + nullable: true + url: + type: string + example: 'http://example.com' + minLength: 1 + type: + type: string + x-graphql-type-name: WebsiteType + enum: + - primary + - secondary + - work + - personal + - other + example: primary + parameters: + applicationId: + name: x-apideck-app-id + in: header + required: true + description: The ID of your Unify application + schema: + type: string + serviceId: + name: x-apideck-service-id + in: header + description: 'Provide the service id you want to call (e.g., pipedrive). [See the full list in the connector section.](#section/Connectors) Only needed when a consumer has activated multiple integrations for a Unified API.' + schema: + type: string + consumerId: + name: x-apideck-consumer-id + in: header + required: true + description: ID of the consumer which you want to get or push data from + schema: + type: string + raw: + name: raw + in: query + description: Include raw response. Mostly used for debugging purposes + schema: + type: boolean + default: true + id: + in: path + name: id + schema: + type: string + required: true + description: ID of the record you are acting upon. + limit: + name: limit + in: query + description: Number of records to return + schema: + type: integer + minimum: 1 + maximum: 200 + default: 20 + cursor: + name: cursor + in: query + description: Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. + schema: + type: string + nullable: true + default: null + contactsFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/ContactsFilter' + contactsSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/ContactsSort' + companiesFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/CompaniesFilter' + companiesSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/CompaniesSort' + responses: + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequest' + CreateCompany: + description: Company created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCompanyResponse' + CreateContact: + description: Contact created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContactResponse' + CreateUser: + description: User created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserResponse' + DeleteCompany: + description: Company deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteCompanyResponse' + DeleteContact: + description: Contact deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteContactResponse' + DeleteUser: + description: User deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteUserResponse' + GetCompanies: + description: Companies + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompaniesResponse' + GetCompaniesArray: + description: Companies + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompaniesArrayResponse' + GetCompany: + description: Company + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompanyResponse' + GetContact: + description: Contact + content: + application/json: + schema: + $ref: '#/components/schemas/GetContactResponse' + GetContacts: + description: Contacts + content: + application/json: + schema: + $ref: '#/components/schemas/GetContactsResponse' + GetUsers: + description: Users + content: + application/json: + schema: + $ref: '#/components/schemas/GetUsersResponse' + GetUser: + description: User + content: + application/json: + schema: + $ref: '#/components/schemas/GetUserResponse' + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + NotImplemented: + description: Not Implemented + content: + application/json: + schema: + $ref: '#/components/schemas/NotImplemented' + PaymentRequired: + description: Payment Required + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequired' + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Unauthorized' + UnexpectedError: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/UnexpectedError' + Unprocessable: + description: Unprocessable + content: + application/json: + schema: + $ref: '#/components/schemas/Unprocessable' + UpdateCompany: + description: Company updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateCompanyResponse' + UpdateContact: + description: Contact updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateContactResponse' + UpdateUser: + description: User updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserResponse' + securitySchemes: + apiKey: + type: http + scheme: bearer + description: | + To use API you have to sign up and get your own API key. Unify API accounts have sandbox mode and live mode API keys. + To change modes just use the appropriate key to get a live or test object. You can find your API keys on the unify settings of your Apideck app. + Your Apideck application_id can also be found on the same page. + + Authenticate your API requests by including your test or live secret API key in the request header. + + - Bearer authorization header: `Authorization: Bearer ` + - Application id header: `x-apideck-app-id: ` + + You should use the public keys on the SDKs and the secret keys to authenticate API requests. + + **Do not share or include your secret API keys on client side code.** Your API keys carry significant privileges. Please ensure to keep them 100% secure and be sure to not share your secret API keys in areas that are publicly accessible like GitHub. + + Learn how to set the Authorization header inside Postman https://learning.postman.com/docs/postman/sending-api-requests/authorization/#api-key + + Go to Unify to grab your API KEY https://app.apideck.com/unify/api-keys + applicationId: + type: apiKey + in: header + name: x-apideck-app-id + description: The ID of your Unify application + consumerId: + type: apiKey + in: header + name: x-apideck-consumer-id + description: The ID of the consumer which you want to get or push data from +paths: + /crm/companies: + post: + tags: + - Companies + operationId: companiesAdd + summary: Create company + description: Create company + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CompanyArray' + responses: + '201': + $ref: '#/components/responses/CreateCompany' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + get: + tags: + - Companies + operationId: companiesList + summary: Get companies + description: Get companies + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetCompaniesArray' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' diff --git a/__tests__/fixtures/crm-request-items31.yml b/__tests__/fixtures/crm-request-items31.yml new file mode 100644 index 00000000..7e83d068 --- /dev/null +++ b/__tests__/fixtures/crm-request-items31.yml @@ -0,0 +1,3296 @@ +openapi: 3.1.0 +info: + version: 4.1.0 + title: CRM API - ITEMS + description: "Welcome to the CRM API.\n\nYou can use this API to access all CRM API endpoints.\n\n## Base URL\n\nThe base URL for all API requests is `https://unify.apideck.com`\n\n## GraphQL\n\nUse the [GraphQL playground](https://unify.apideck.com/graphql) to test out the GraphQL API.\n\n## Headers\n\nCustom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230) states header names are case insensitive.\n\n| Name | Type | Required | Description |\n| --------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| x-apideck-consumer-id | String | Yes | The id of the customer stored inside Apideck Vault. This can be a user id, account id, device id or whatever entity that can have integration within your app. |\n| x-apideck-service-id | String | No | Describe the service you want to call (e.g., pipedrive). Only needed when a customer has activated multiple integrations for the same Unified API. |\n| x-apideck-raw | Boolean | No | Include raw response. Mostly used for debugging purposes. |\n| x-apideck-app-id | String | Yes | The application id of your Unify application. Available at https://app.apideck.com/unify/api-keys. |\n| Authorization | String | Yes | Bearer API KEY |\n\n## Authorization\n\nYou can interact with the API through the authorization methods below.\n\n\n\n## Pagination\n\nAll API resources have support for bulk retrieval via list APIs. For example, you can list [opportunities](#tag/Opportunities), [companies](#tag/Companies) and [leads](#tag/Leads). Apideck uses cursor-based pagination via the optional `cursor` and `limit` parameters.\n\nTo fetch the first page of results, call the list API without a `cursor` parameter. Afterwards you can fetch subsequent pages by providing a cursor parameter. You will find the next cursor in the response body in `meta.cursors.next`. If `meta.cursors.next` is `null` you're at the end of the list.\n\nIn the REST API you can also use the `links` from the response for added convenience. Simply call the URL in `links.next` to get the next page of results.\n\n### Query Parameters\n\n| Name | Type | Required | Description |\n| ------ | ------ | -------- | ------------------------------------------------------------------------------------------------------------------ |\n| cursor | String | No | Cursor to start from. You can find cursors for next & previous pages in the meta.cursors property of the response. |\n| limit | Number | No | Number of results to return. Minimum 1, Maximum 200, Default 20 |\n\n### Response Body\n\n| Name | Type | Description |\n| --------------------- | ------ | ------------------------------------------------------------------ |\n| meta.cursors.previous | String | Cursor to navigate to the previous page of results through the API |\n| meta.cursors.current | String | Cursor to navigate to the current page of results through the API |\n| meta.cursors.next | String | Cursor to navigate to the next page of results through the API |\n| meta.items_on_page | Number | Number of items returned in the data property of the response |\n| links.previous | String | Link to navigate to the previous page of results through the API |\n| links.current | String | Link to navigate to the current page of results through the API |\n| links.next | String | Link to navigate to the next page of results through the API |\n\n⚠️ `meta.cursors.previous`/`links.previous` is not available for all connectors.\n\n## SDKs and API Clients\n\nUpcoming. [Request the SDK of your choice](https://integrations.apideck.com/request).\n\n## Debugging\n\nBecause of the nature of the abstraction we do in Apideck Unify we still provide the option to the receive raw requests and responses being handled underlying. By including the raw flag `?raw=true` in your requests you can still receive the full request. Please note that this increases the response size and can introduce extra latency.\n\n## Errors\n\nThe API returns standard HTTP response codes to indicate success or failure of the API requests. For errors, we also return a customized error message inside the JSON response. You can see the returned HTTP status codes below.\n\n| Code | Title | Description |\n| ---- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| 200 | OK | The request message has been successfully processed, and it has produced a response. The response message varies, depending on the request method and the requested data. |\n| 201 | Created | The request has been fulfilled and has resulted in one or more new resources being created. |\n| 204 | No Content | The server has successfully fulfilled the request and that there is no additional content to send in the response payload body. |\n| 400 | Bad Request | The receiving server cannot understand the request because of malformed syntax. Do not repeat the request without first modifying it; check the request for errors, fix them and then retry the request. |\n| 401 | Unauthorized | The request has not been applied because it lacks valid authentication credentials for the target resource. |\n| 402 | Payment Required | Subscription data is incomplete or out of date. You'll need to provide payment details to continue. |\n| 403 | Forbidden | You do not have the appropriate user rights to access the request. Do not repeat the request. |\n| 404 | Not Found | The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. |\n| 409 | Conflict | The request could not be completed due to a conflict with the current state of the target resource. |\n| 422 | Unprocessable Entity | The server understands the content type of the request entity, and the syntax of the request entity is correct but was unable to process the contained instructions. |\n| 5xx | Server Errors | Something went wrong with the Unify API. These errors are logged on our side. You can contact our team to resolve the issue. |\n\n### Handling errors\n\nThe Unify API and SDKs can produce errors for many reasons, such as a failed requests due to misconfigured integrations, invalid parameters, authentication errors, and network unavailability.\n\n### Error Types\n\n#### RequestBodyValidationError\n\nRequest body is not valid for the current endpoint. Check the spelling and types of your attributes, and ensure you are not passing data that is outside of the specification.\n\n#### RequestParametersValidationError\n\nRequest parameters are not valid for the current endpoint. Check the spelling and types of your parameters, and ensure you are not passing parameters that are outside of the specification.\n\n#### RequestHeadersValidationError\n\nRequest headers are not valid for the current endpoint. Check the spelling and types of your headers, and ensure you are not passing headers that are outside of the specification.\n\n#### UnsupportedFiltersError\n\nFilters in the request are valid, but not supported by the connector. Remove the unsupported filter(s) to get a successful response.\n\n#### UnsupportedSortFieldError\n\nSort field (`sort[by]`) in the request is valid, but not supported by the connector. Replace or remove the sort field to get a successful response.\n\n#### InvalidCursorError\n\nPagination cursor in the request is not valid for the current connector. Make sure to use a cursor returned from the API, for the same connector.\n\n#### ConnectorExecutionError\n\nA Unified API request made via one of our downstream connectors returned an unexpected error. The `status_code` returned is proxied through to error response along with their original response via the error detail.\n\n#### ConnectorProcessingError\n\nA Unified API request made via one of our downstream connectors returned a status code that was less than 400, along with a description of why the request could not be processed. Often this is due to the shape of request data being valid, but unable to be processed due to internal business logic - for example: an invalid relationship or `ID` present in your request.\n\n#### UnauthorizedError\n\nWe were unable to authorize the request as made. This can happen for a number of reasons, from missing header params to passing an incorrect authorization token. Verify your Api Key is being set correctly in the authorization header. ie: `Authorization: 'Bearer sk_live_***'`\n\n#### ConnectorCredentialsError\n\nA request using a given connector has not been authorized. Ensure the connector you are trying to use has been configured correctly and been authorized for use.\n\n#### ConnectorDisabledError\n\nA request has been made to a connector that has since been disabled. This may be temporary - You can contact our team to resolve the issue.\n\n#### RequestLimitError\n\nYou have reached the number of requests included in your Free Tier Subscription. You will no be able to make further requests until this limit resets at the end of the month, or talk to us about upgrading your subscription to continue immediately.\n\n#### EntityNotFoundError\n\nYou've made a request for a resource or route that does not exist. Verify your path parameters or any identifiers used to fetch this resource.\n\n#### OAuthCredentialsNotFoundError\n\nWhen adding a connector integration that implements OAuth, both a `client_id` and `client_secret` must be provided before any authorizations can be performed. Verify the integration has been configured properly before continuing.\n\n#### IntegrationNotFoundError\n\nThe requested connector integration could not be found associated to your `application_id`. Verify your `application_id` is correct, and that this connector has been added and configured for your application.\n\n#### ConnectionNotFoundError\n\nA valid connection could not be found associated to your `application_id`. Something _may_ have interrupted the authorization flow. You may need to start the connector authorization process again.\n\n#### ConnectorNotFoundError\n\nA request was made for an unknown connector. Verify your `service_id` is spelled correctly, and that this connector is enabled for your provided `unified_api`.\n\n#### OAuthRedirectUriError\n\nA request was made either in a connector authorization flow, or attempting to revoke connector access without a valid `redirect_uri`. This is the url the user should be returned to on completion of process.\n\n#### OAuthInvalidStateError\n\nThe state param is required and is used to ensure the outgoing authorization state has not been altered before the user is redirected back. It also contains required params needed to identify the connector being used. If this has been altered, the authorization will not succeed.\n\n#### OAuthCodeExchangeError\n\nWhen attempting to exchange the authorization code for an `access_token` during an OAuth flow, an error occurred. This may be temporary. You can reattempt authorization or contact our team to resolve the issue.\n\n#### MappingError\n\nThere was an error attempting to retrieve the mapping for a given attribute. We've been notified and are working to fix this issue.\n\n#### ConnectorMappingNotFoundError\n\nIt seems the implementation for this connector is incomplete. It's possible this connector is in `beta` or still under development. We've been notified and are working to fix this issue.\n\n#### ConnectorResponseMappingNotFoundError\n\nWe were unable to retrieve the response mapping for this connector. It's possible this connector is in `beta` or still under development. We've been notified and are working to fix this issue.\n\n#### ConnectorOperationMappingNotFoundError\n\nConnector mapping has not been implemented for the requested operation. It's possible this connector is in `beta` or still under development. We've been notified and are working to fix this issue.\n\n#### ConnectorWorkflowMappingError\n\nThe composite api calls required for this operation have not been mapped entirely. It's possible this connector is in `beta` or still under development. We've been notified and are working to fix this issue.\n\n#### PaginationNotSupportedError\n\nPagination is not yet supported for this connector, try removing limit and/or cursor from the query. It's possible this connector is in `beta` or still under development. We've been notified and are working to fix this issue.\n\n## API Design\n\n### API Styles and data formats\n\n#### REST API\n\nThe API is organized around [REST](https://restfulapi.net/), providing simple and predictable URIs to access and modify objects. Requests support standard HTTP methods like GET, PUT, POST, and DELETE and standard status codes. JSON is returned by all API responses, including errors. In all API requests, you must set the content-type HTTP header to application/json. All API requests must be made over HTTPS. Calls made over HTTP will fail.\n\n##### Available HTTP methods\n\nThe Apideck API uses HTTP verbs to understand if you want to read (GET), delete (DELETE) or create (POST) an object. When your web application cannot do a POST or DELETE, we provide the ability to set the method through the query parameter \\_method.\n\n```\nPOST /messages\nGET /messages\nGET /messages/{messageId}\nPATCH /messages/{messageId}\nDELETE /messages/{messageId}\n```\n\nResponse bodies are always UTF-8 encoded JSON objects, unless explicitly documented otherwise. For some endpoints and use cases we divert from REST to provide a better developer experience.\n\n### Schema\n\nAll API requests and response bodies adhere to a common JSON format representing individual items, collections of items, links to related items and additional meta data.\n\n### Meta\n\nMeta data can be represented as a top level member named “meta”. Any information may be provided in the meta data. It’s most common use is to return the total number of records when requesting a collection of resources.\n\n### Idempotence (upcoming)\n\nTo prevent the creation of duplicate resources, every POST method (such as one that creates a consumer record) must specify a unique value for the X-Unique-Transaction-ID header name. Uniquely identifying each unique POST request ensures that the API processes a given request once and only once.\n\nUniquely identifying new resource-creation POSTs is especially important when the outcome of a response is ambiguous because of a transient service interruption, such as a server-side timeout or network disruption. If a service interruption occurs, then the client application can safely retry the uniquely identified request without creating duplicate operations. (API endpoints that guarantee that every uniquely identified request is processed only once no matter how many times that uniquely identifiable request is made are described as idempotent.)\n\n### Request IDs\n\nEach API request has an associated request identifier. You can find this value in the response headers, under Request-Id. You can also find request identifiers in the URLs of individual request logs in your Dashboard. If you need to contact us about a specific request, providing the request identifier will ensure the fastest possible resolution.\n\n### Fixed field types\n\n#### Dates\n\nThe dates returned by the API are all represented in UTC (ISO8601 format).\n\nThis example\_`2019-11-14T00:55:31.820Z`\_is defined by the\_ISO 8601\_standard. The\_T\_in the middle separates the year-month-day portion from the hour-minute-second portion. The\_Z\_on the end means UTC, that is, an offset-from-UTC of zero hours-minutes-seconds. The\_Z\_is pronounced \"Zulu\" per military/aviation tradition.\n\nThe ISO 8601 standard is more modern. The formats are wisely designed to be easy to parse by machine as well as easy to read by humans across cultures.\n\n#### Prices and Currencies\n\nAll prices returned by the API are represented as integer amounts in a currency’s smallest unit. For example, $5 USD would be returned as 500 (i.e, 500 cents).\n\nFor zero-decimal currencies, amounts will still be provided as an integer but without the need to divide by 100. For example, an amount of ¥5 (JPY) would be returned as 5.\n\nAll currency codes conform to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).\n\n## Support\n\nIf you have problems or need help with your case, you can always reach out to our Support.\n" + contact: + email: hello@apideck.com + url: 'https://developers.apideck.com' + x-logo: + url: 'https://developers.apideck.com/icon.png' + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +externalDocs: + description: Apideck Developer Docs + url: 'https://developers.apideck.com' +servers: + - url: 'https://unify.apideck.com' + description: Production +security: + - apiKey: [] + applicationId: [] + consumerId: [] +tags: + - name: Companies + description: '' +components: + schemas: + Activity: + type: object + additionalProperties: false + required: + - type + properties: + id: + type: string + readOnly: true + example: '12345' + activity_datetime: + type: string + example: '2021-05-01T12:00:00.000Z' + minLength: 1 + nullable: true + duration_seconds: + type: integer + example: 1800 + minimum: 0 + nullable: true + account_id: + type: string + example: '12345' + nullable: true + contact_id: + type: string + example: '12345' + nullable: true + company_id: + type: string + example: '12345' + nullable: true + opportunity_id: + type: string + example: '12345' + nullable: true + lead_id: + type: string + example: '12345' + nullable: true + owner_id: + type: string + example: '12345' + nullable: true + campaign_id: + type: string + example: '12345' + nullable: true + case_id: + type: string + example: '12345' + nullable: true + asset_id: + type: string + example: '12345' + nullable: true + contract_id: + type: string + example: '12345' + nullable: true + product_id: + type: string + example: '12345' + nullable: true + solution_id: + type: string + example: '12345' + nullable: true + custom_object_id: + type: string + example: '12345' + nullable: true + type: + type: string + enum: + - call + - meeting + - email + - note + - task + - send-letter + - send-quote + - other + example: meeting + title: + type: string + example: Meeting + nullable: true + description: + type: string + example: More info about the meeting + nullable: true + location: + type: string + example: Space + nullable: true + all_day_event: + type: boolean + example: false + private: + type: boolean + example: true + group_event: + type: boolean + example: true + event_sub_type: + type: string + example: debrief + nullable: true + group_event_type: + type: string + example: Proposed + nullable: true + child: + type: boolean + example: false + archived: + type: boolean + example: false + deleted: + type: boolean + example: false + show_as: + type: string + enum: + - free + - busy + example: busy + activity_date: + type: string + example: '2021-05-01' + nullable: true + duration_minutes: + type: integer + example: 30 + nullable: true + start_datetime: + type: string + example: '2021-05-01T12:00:00.000Z' + nullable: true + end_datetime: + type: string + example: '2021-05-01T12:30:00.000Z' + nullable: true + end_date: + type: string + example: '2021-05-01' + nullable: true + recurrent: + type: boolean + example: false + reminder_datetime: + type: string + example: '2021-05-01T17:00:00.000Z' + nullable: true + reminder_set: + type: boolean + example: false + nullable: true + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + Address: + type: object + properties: + id: + type: string + example: '123' + nullable: true + type: + type: string + x-graphql-type-name: AddressType + enum: + - primary + - secondary + - home + - office + - shipping + - billing + - other + example: primary + name: + type: string + example: HQ US + nullable: true + line1: + type: string + example: Main street + description: 'Line 1 of the address e.g. number, street, suite, apt #, etc.' + nullable: true + line2: + type: string + example: 'apt #' + description: Line 2 of the address + nullable: true + city: + type: string + example: San Francisco + description: Name of city. + nullable: true + state: + type: string + example: CA + description: Name of state + nullable: true + postal_code: + type: string + example: '94104' + description: Zip code or equivalent. + nullable: true + country: + type: string + example: US + description: country code according to ISO 3166-1 alpha-2. + nullable: true + latitude: + type: string + example: '40.759211' + nullable: true + longitude: + type: string + example: '-73.984638' + nullable: true + BadRequest: + properties: + status_code: + type: number + description: HTTP status code + example: 400 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Bad Request + typeName: + type: string + description: The type of error returned + example: RequestHeadersValidationError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid Params + detail: + anyOf: + - type: string + example: Missing property foobar + - type: object + example: + missing: + - - foobar: required + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#requestbodyvalidationerror' + BankAccount: + type: object + properties: + iban: + type: string + example: CH2989144532982975332 + nullable: true + bic: + type: string + example: AUDSCHGGXXX + nullable: true + CompaniesFilter: + type: object + x-graphql-type-name: CompaniesFilter + example: + name: SpaceX + properties: + name: + type: string + description: Name of the company to filter on + example: SpaceX + additionalProperties: false + CompaniesSort: + type: object + x-graphql-type-name: CompaniesSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Companies + enum: + - created_at + - updated_at + - name + example: created_at + direction: + type: string + description: The direction in which to sort the Companies + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + CompanyArray: + type: array + items: + $ref: '#/components/schemas/Company' + Company: + type: object + required: + - name + additionalProperties: false + properties: + id: + type: string + readOnly: true + example: '12345' + name: + type: string + example: Copper + minLength: 1 + interaction_count: + type: integer + example: 1 + readOnly: true + nullable: true + owner_id: + type: string + example: '12345' + image_url: + type: string + example: 'https://www.spacex.com/static/images/share.jpg' + nullable: true + description: + type: string + example: 'A crm that works for you, so you can spend time on relationships instead of data.' + nullable: true + vat_number: + description: VAT number + type: string + example: BE0689615164 + nullable: true + currency: + type: string + example: USD + nullable: true + status: + type: string + minLength: 1 + example: Open + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + bank_accounts: + type: array + items: + $ref: '#/components/schemas/BankAccount' + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + Contact: + required: + - name + x-pii: + - name + - first_name + - middle_name + - last_name + - email + properties: + id: + type: string + example: '12345' + readOnly: true + name: + type: string + example: Elon Musk + minLength: 1 + owner_id: + type: string + example: '54321' + nullable: true + company_id: + type: string + example: '23456' + nullable: true + company_name: + type: string + example: '23456' + nullable: true + lead_id: + type: string + example: '34567' + nullable: true + first_name: + type: string + example: Elon + nullable: true + middle_name: + type: string + example: D. + nullable: true + last_name: + type: string + example: Musk + nullable: true + prefix: + type: string + example: Mr. + nullable: true + suffix: + type: string + example: PhD + nullable: true + title: + type: string + example: CEO + nullable: true + department: + type: string + example: Engineering + nullable: true + language: + type: string + example: EN + description: language code according to ISO 639-1. For the United States - EN + nullable: true + gender: + type: string + enum: + - male + - female + - unisex + example: female + nullable: true + birthday: + type: string + example: '2000-08-12' + nullable: true + image: + type: string + example: 'https://logo.dev/spacex.com?s=128' + nullable: true + lead_source: + type: string + minLength: 1 + example: Cold Call + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + description: + type: string + example: Internal champion + nullable: true + status: + type: string + example: open + nullable: true + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + additionalProperties: false + ContactsFilter: + type: object + x-graphql-type-name: ContactsFilter + example: + first_name: Elon + last_name: Musk + email: elon@tesla.com + properties: + name: + type: string + description: Name of the contact to filter on + example: Elon Musk + first_name: + type: string + description: First name of the contact to filter on + example: Elon + last_name: + type: string + description: Last name of the contact to filter on + example: Musk + email: + type: string + description: E-mail of the contact to filter on + example: elon@tesla.com + additionalProperties: false + ContactsSort: + type: object + x-graphql-type-name: ContactsSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Contacts + enum: + - created_at + - updated_at + - name + - first_name + - last_name + - email + example: created_at + direction: + type: string + description: The direction in which to sort the Contacts + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + CreateActivityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateCompanyResponse: + $id: https://developers.apideck.com/CreateCompany.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateLeadResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateNoteResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateOpportunityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: opportunities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreatePipelineResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CustomField: + type: object + required: + - id + additionalProperties: false + properties: + id: + type: string + example: custom_technologies + value: + anyOf: + - type: string + example: Uses Salesforce and Marketo + nullable: true + - type: number + example: 10 + nullable: true + - type: boolean + example: true + nullable: true + - type: array + items: + type: string + DeleteActivityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteCompanyResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteLeadResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteNoteResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteOpportunityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeletePipelineResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + Email: + required: + - email + type: object + properties: + id: + type: string + example: '123' + email: + type: string + format: email + example: elon@musk.com + minLength: 1 + type: + type: string + x-graphql-type-name: EmailType + enum: + - primary + - secondary + - work + - personal + - billing + - other + example: primary + GetActivitiesResponse: + x-graphql-type-name: ActivityList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Activity' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetActivityResponse: + x-graphql-type-name: activity + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Activity' + GetCompaniesResponse: + x-graphql-type-name: CompanyList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Company' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetCompanyResponse: + x-graphql-type-name: company + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Company' + GetContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Contact' + GetContactsResponse: + x-graphql-type-name: ContactList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Contact' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetLeadResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Lead' + GetLeadsResponse: + x-graphql-type-name: LeadList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Lead' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetNoteResponse: + x-graphql-type-name: note + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Note' + GetNotesResponse: + x-graphql-type-name: NoteList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Note' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetOpportunitiesResponse: + x-graphql-type-name: OpportunityList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: opportunities + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Opportunity' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetOpportunityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: opportunities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Opportunity' + GetPipelineResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Pipeline' + GetPipelinesResponse: + x-graphql-type-name: PipelinesList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Pipeline' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/User' + GetUsersResponse: + x-graphql-type-name: UserList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/User' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + Lead: + required: + - name + - company_name + x-pii: + - name + - email + - first_name + - last_name + additionalProperties: false + properties: + id: + type: string + example: '12345' + readOnly: true + name: + type: string + example: Elon Musk + minLength: 1 + company_name: + type: string + example: Spacex + nullable: true + owner_id: + type: string + example: '54321' + company_id: + type: string + example: '2' + nullable: true + contact_id: + type: string + example: '2' + nullable: true + lead_source: + type: string + example: Cold Call + nullable: true + first_name: + type: string + example: Elon + nullable: true + last_name: + type: string + example: Musk + nullable: true + description: + type: string + example: A thinker + nullable: true + prefix: + type: string + example: Sir + nullable: true + title: + type: string + example: CEO + nullable: true + language: + type: string + example: EN + description: language code according to ISO 639-1. For the United States - EN + nullable: true + status: + type: string + example: New + nullable: true + monetary_amount: + type: number + example: 75000 + nullable: true + currency: + type: string + example: USD + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + LeadsFilter: + type: object + x-graphql-type-name: LeadsFilter + example: + first_name: Elon + last_name: Musk + email: elon@tesla.com + properties: + name: + type: string + description: Name of the lead to filter on + example: Elon Musk + first_name: + type: string + description: First name of the lead to filter on + example: Elon + last_name: + type: string + description: Last name of the lead to filter on + example: Musk + email: + type: string + description: E-mail of the lead to filter on + example: elon@tesla.com + additionalProperties: false + LeadsSort: + type: object + x-graphql-type-name: LeadsSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Leads + enum: + - created_at + - updated_at + - name + - first_name + - last_name + - email + example: created_at + direction: + type: string + description: The direction in which to sort the Leads + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + Links: + type: object + description: Links to navigate to previous or next pages through the API + properties: + previous: + type: string + description: Link to navigate to the previous page through the API + example: 'https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D' + nullable: true + current: + type: string + description: Link to navigate to the current page through the API + example: 'https://unify.apideck.com/crm/companies' + next: + type: string + description: Link to navigate to the previous page through the API + example: 'https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM' + nullable: true + Meta: + type: object + description: Reponse metadata + properties: + items_on_page: + type: integer + description: Number of items returned in the data property of the response + example: 50 + cursors: + type: object + description: Cursors to navigate to previous or next pages through the API + properties: + previous: + type: string + description: Cursor to navigate to the previous page of results through the API + example: em9oby1jcm06OnBhZ2U6OjE= + nullable: true + current: + type: string + description: Cursor to navigate to the current page of results through the API + example: em9oby1jcm06OnBhZ2U6OjI= + nullable: true + next: + type: string + description: Cursor to navigate to the next page of results through the API + example: em9oby1jcm06OnBhZ2U6OjM= + nullable: true + NotFoundResponse: + properties: + status_code: + type: number + description: HTTP status code + example: 404 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Not Found + typeName: + type: string + description: The type of error returned + example: EntityNotFoundError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unknown Widget + detail: + anyOf: + - type: string + example: "Could not find widget with id: '123'" + - type: object + example: + not_found: + entity: widget + id: '123' + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#entitynotfounderror' + NotImplemented: + properties: + status_code: + type: number + description: HTTP status code + example: 501 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Not Implemented + typeName: + type: string + description: The type of error returned + example: MappingError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unmapped Attribute + detail: + anyOf: + - type: string + example: Failed to retrieve Widget tokenUrl from 'components.securitySchemes.oauth2.flows' + - type: object + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#mappingerror' + Note: + type: object + additionalProperties: false + properties: + id: + type: string + readOnly: true + example: '12345' + title: + type: string + example: Meeting Notes + content: + type: string + example: Office hours are 9AM-6PM + owner_id: + type: string + example: '12345' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + OpportunitiesFilter: + type: object + x-graphql-type-name: OpportunitiesFilter + example: + status: Completed + monetary_amount: 75000 + properties: + title: + type: string + description: Title of the opportunity to filter on + example: Tesla deal + status: + type: string + description: Status to filter on + example: Completed + monetary_amount: + type: number + description: Monetary amount to filter on + example: 75000 + win_probability: + type: number + description: Win probability to filter on + example: 50 + additionalProperties: false + OpportunitiesSort: + type: object + x-graphql-type-name: OpportunitiesSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Opportunities + enum: + - created_at + - updated_at + - title + - win_probability + - monetary_amount + - status + example: created_at + direction: + type: string + description: The direction in which to sort the Opportunities + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + Opportunity: + type: object + required: + - title + - primary_contact_id + additionalProperties: false + properties: + id: + type: string + example: '12345' + readOnly: true + title: + type: string + example: New Rocket + minLength: 1 + primary_contact_id: + type: string + example: '12345' + nullable: true + description: + type: string + minLength: 1 + example: Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines. + nullable: true + monetary_amount: + type: number + example: 75000 + nullable: true + currency: + type: string + example: USD + nullable: true + win_probability: + type: number + example: 40 + nullable: true + close_date: + type: string + example: '2020-10-30' + format: date + nullable: true + loss_reason_id: + type: string + example: '12345' + nullable: true + loss_reason: + type: string + example: No budget + nullable: true + won_reason_id: + type: string + example: '12345' + nullable: true + won_reason: + type: string + example: Best pitch + nullable: true + pipeline_id: + type: string + example: '12345' + nullable: true + pipeline_stage_id: + type: string + example: '12345' + nullable: true + source_id: + type: string + example: '12345' + nullable: true + lead_id: + type: string + example: '12345' + nullable: true + contact_id: + type: string + example: '12345' + nullable: true + company_id: + type: string + example: '12345' + nullable: true + company_name: + type: string + example: Copper + nullable: true + owner_id: + type: string + example: '12345' + nullable: true + priority: + type: string + minLength: 1 + example: None + nullable: true + status: + type: string + minLength: 1 + example: Open + nullable: true + status_id: + type: string + example: '12345' + nullable: true + tags: + $ref: '#/components/schemas/Tags' + interaction_count: + type: number + example: 0 + readOnly: true + nullable: true + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + date_stage_changed: + type: string + example: '2020-09-30T00:00:00.000Z' + format: date-time + nullable: true + readOnly: true + date_last_contacted: + type: string + example: '2020-09-30T00:00:00.000Z' + format: date-time + nullable: true + readOnly: true + date_lead_created: + type: string + example: '2020-09-30T00:00:00.000Z' + format: date-time + nullable: true + readOnly: true + updated_by: + type: string + example: '12345' + nullable: true + readOnly: true + created_by: + type: string + example: '12345' + nullable: true + readOnly: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + format: date-time + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + format: date-time + readOnly: true + PaymentRequired: + properties: + status_code: + type: number + description: HTTP status code + example: 402 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Payment Required + typeName: + type: string + description: The type of error returned + example: RequestLimitError + message: + type: string + description: A human-readable message providing more details about the error. + example: Request Limit Reached + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: You have reached your limit of 2000 + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#requestlimiterror' + PhoneNumber: + required: + - number + type: object + properties: + id: + type: string + example: '12345' + nullable: true + number: + type: string + example: 111-111-1111 + minLength: 1 + type: + type: string + x-graphql-type-name: PhoneType + enum: + - primary + - secondary + - home + - office + - mobile + - assistant + - fax + - other + example: primary + Pipeline: + required: + - name + x-pii: [] + properties: + id: + type: string + example: default + name: + type: string + example: Sales Pipeline + minLength: 1 + currency: + type: string + example: USD + archived: + type: boolean + example: false + display_order: + type: integer + example: 1 + stages: + type: array + items: + type: object + properties: + id: + type: string + example: contractsent + readOnly: true + name: + type: string + example: Contract Sent + value: + type: string + example: CONTRACT_SENT + display_order: + type: integer + example: 1 + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + additionalProperties: false + SocialLink: + required: + - url + type: object + properties: + id: + type: string + example: '12345' + nullable: true + url: + type: string + example: 'https://www.twitter.com/apideck-io' + minLength: 1 + type: + type: string + example: twitter + nullable: true + Tags: + type: array + items: + type: string + example: + - New + User: + required: + - email + x-pii: + - username + - first_name + - last_name + - email + properties: + id: + type: string + example: '12345' + readOnly: true + email: + type: string + format: email + example: elon@musk.com + minLength: 1 + parent_id: + type: string + example: '54321' + nullable: true + username: + type: string + example: masterofcoin + nullable: true + first_name: + type: string + example: Elon + nullable: true + last_name: + type: string + example: Musk + nullable: true + image: + type: string + example: 'https://logo.dev/spacex.com?s=128' + nullable: true + language: + type: string + example: EN + nullable: true + status: + type: string + example: active + nullable: true + password: + type: string + example: supersecretpassword + writeOnly: true + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + Unauthorized: + properties: + status_code: + type: number + description: HTTP status code + example: 401 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Unauthorized + typeName: + type: string + description: The type of error returned + example: UnauthorizedError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unauthorized Request + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: Failed to generate valid JWT Session. Verify applicationId is correct + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#unauthorizederror' + UnexpectedError: + properties: + status_code: + type: number + description: HTTP status code + example: 400 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Bad Request + typeName: + type: string + description: The type of error returned + example: RequestHeadersValidationError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid Params + detail: + anyOf: + - type: string + example: 'Missing Header: x-apideck-consumer-id' + - type: object + example: + missing: + - - x-apideck-consumer-id: required + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#unauthorizederror' + UnifiedId: + title: UnifiedId + required: + - id + properties: + id: + type: string + readOnly: true + example: '12345' + Unprocessable: + properties: + status_code: + type: number + description: HTTP status code + example: 422 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Unprocessable Entity + typeName: + type: string + description: The type of error returned + example: InvalidStateError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid State + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: State did not include unified_api + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#invalidstateerror' + UpdateActivityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateCompanyResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateContactResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateLeadResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateNoteResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateOpportunityResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdatePipelineResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateUserResponse: + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + Website: + type: object + required: + - url + properties: + id: + type: string + example: '12345' + nullable: true + url: + type: string + example: 'http://example.com' + minLength: 1 + type: + type: string + x-graphql-type-name: WebsiteType + enum: + - primary + - secondary + - work + - personal + - other + example: primary + parameters: + applicationId: + name: x-apideck-app-id + in: header + required: true + description: The ID of your Unify application + schema: + type: string + serviceId: + name: x-apideck-service-id + in: header + description: 'Provide the service id you want to call (e.g., pipedrive). [See the full list in the connector section.](#section/Connectors) Only needed when a consumer has activated multiple integrations for a Unified API.' + schema: + type: string + consumerId: + name: x-apideck-consumer-id + in: header + required: true + description: ID of the consumer which you want to get or push data from + schema: + type: string + raw: + name: raw + in: query + description: Include raw response. Mostly used for debugging purposes + schema: + type: boolean + default: true + id: + in: path + name: id + schema: + type: string + required: true + description: ID of the record you are acting upon. + limit: + name: limit + in: query + description: Number of records to return + schema: + type: integer + minimum: 1 + maximum: 200 + default: 20 + cursor: + name: cursor + in: query + description: Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. + schema: + type: string + nullable: true + default: null + contactsFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/ContactsFilter' + contactsSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/ContactsSort' + opportunitiesFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/OpportunitiesFilter' + opportunitiesSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/OpportunitiesSort' + companiesFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/CompaniesFilter' + companiesSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/CompaniesSort' + leadsFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/LeadsFilter' + leadsSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/LeadsSort' + responses: + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequest' + CreateActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/CreateActivityResponse' + CreateCompany: + description: Company created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCompanyResponse' + CreateContact: + description: Contact created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContactResponse' + CreateLead: + description: Lead created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLeadResponse' + CreateNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/CreateNoteResponse' + CreateOpportunity: + description: Opportunity + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOpportunityResponse' + CreatePipeline: + description: Pipeline created + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePipelineResponse' + CreateUser: + description: User created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserResponse' + DeleteActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteActivityResponse' + DeleteCompany: + description: Company deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteCompanyResponse' + DeleteContact: + description: Contact deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteContactResponse' + DeleteLead: + description: Lead deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteLeadResponse' + DeleteNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteNoteResponse' + DeleteOpportunity: + description: Opportunity deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteOpportunityResponse' + DeletePipeline: + description: Pipeline deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeletePipelineResponse' + DeleteUser: + description: User deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteUserResponse' + GetActivitiesResponse: + description: Activities + content: + application/json: + schema: + $ref: '#/components/schemas/GetActivitiesResponse' + GetActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/GetActivityResponse' + GetCompanies: + description: Companies + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompaniesResponse' + GetCompany: + description: Company + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompanyResponse' + GetContact: + description: Contact + content: + application/json: + schema: + $ref: '#/components/schemas/GetContactResponse' + GetContacts: + description: Contacts + content: + application/json: + schema: + $ref: '#/components/schemas/GetContactsResponse' + GetLead: + description: Lead + content: + application/json: + schema: + $ref: '#/components/schemas/GetLeadResponse' + GetLeads: + description: Leads + content: + application/json: + schema: + $ref: '#/components/schemas/GetLeadsResponse' + GetNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/GetNoteResponse' + GetNotesResponse: + description: Notes + content: + application/json: + schema: + $ref: '#/components/schemas/GetNotesResponse' + GetOpportunities: + description: Opportunities + content: + application/json: + schema: + $ref: '#/components/schemas/GetOpportunitiesResponse' + GetOpportunity: + description: Opportunity + content: + application/json: + schema: + $ref: '#/components/schemas/GetOpportunityResponse' + GetPipeline: + description: Pipeline + content: + application/json: + schema: + $ref: '#/components/schemas/GetPipelineResponse' + GetPipelines: + description: Pipelines + content: + application/json: + schema: + $ref: '#/components/schemas/GetPipelinesResponse' + GetUsers: + description: Users + content: + application/json: + schema: + $ref: '#/components/schemas/GetUsersResponse' + GetUser: + description: User + content: + application/json: + schema: + $ref: '#/components/schemas/GetUserResponse' + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + NotImplemented: + description: Not Implemented + content: + application/json: + schema: + $ref: '#/components/schemas/NotImplemented' + PaymentRequired: + description: Payment Required + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequired' + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Unauthorized' + UnexpectedError: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/UnexpectedError' + Unprocessable: + description: Unprocessable + content: + application/json: + schema: + $ref: '#/components/schemas/Unprocessable' + UpdateActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateActivityResponse' + UpdateCompany: + description: Company updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateCompanyResponse' + UpdateContact: + description: Contact updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateContactResponse' + UpdateLead: + description: Lead updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateLeadResponse' + UpdateNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateNoteResponse' + UpdateOpportunity: + description: Opportunity updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOpportunityResponse' + UpdatePipeline: + description: Pipeline updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePipelineResponse' + UpdateUser: + description: User updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserResponse' + securitySchemes: + apiKey: + type: http + scheme: bearer + description: | + To use API you have to sign up and get your own API key. Unify API accounts have sandbox mode and live mode API keys. + To change modes just use the appropriate key to get a live or test object. You can find your API keys on the unify settings of your Apideck app. + Your Apideck application_id can also be found on the same page. + + Authenticate your API requests by including your test or live secret API key in the request header. + + - Bearer authorization header: `Authorization: Bearer ` + - Application id header: `x-apideck-app-id: ` + + You should use the public keys on the SDKs and the secret keys to authenticate API requests. + + **Do not share or include your secret API keys on client side code.** Your API keys carry significant privileges. Please ensure to keep them 100% secure and be sure to not share your secret API keys in areas that are publicly accessible like GitHub. + + Learn how to set the Authorization header inside Postman https://learning.postman.com/docs/postman/sending-api-requests/authorization/#api-key + + Go to Unify to grab your API KEY https://app.apideck.com/unify/api-keys + applicationId: + type: apiKey + in: header + name: x-apideck-app-id + description: The ID of your Unify application + consumerId: + type: apiKey + in: header + name: x-apideck-consumer-id + description: The ID of the consumer which you want to get or push data from +paths: + /crm/companies: + post: + tags: + - Companies + operationId: companiesAdd + summary: Create company + description: Create company + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CompanyArray' + responses: + '201': + $ref: '#/components/responses/CreateCompany' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' diff --git a/__tests__/fixtures/crm31.yml b/__tests__/fixtures/crm31.yml new file mode 100644 index 00000000..0e962716 --- /dev/null +++ b/__tests__/fixtures/crm31.yml @@ -0,0 +1,4641 @@ +openapi: 3.1.0 +info: + version: 4.1.0 + title: CRM API + description: 'Welcome to the CRM API.' + contact: + email: hello@apideck.com + url: 'https://developers.apideck.com' + x-logo: + url: 'https://developers.apideck.com/icon.png' + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +externalDocs: + description: Apideck Developer Docs + url: 'https://developers.apideck.com' +servers: + url: 'https://unify.apideck.com' + description: Production +security: + - apiKey: [] + applicationId: [] + consumerId: [] +tags: + - name: Companies + description: '' + - name: Opportunities + description: '' + - name: Leads + description: '' + - name: Contacts + description: '' + - name: Pipelines + description: '' + - name: Notes + description: '' + - name: Users + description: '' + - name: Activities + description: '' +components: + schemas: + Activity: + type: object + additionalProperties: false + required: + - type + properties: + id: + type: string + readOnly: true + example: '12345' + activity_datetime: + type: string + example: '2021-05-01T12:00:00.000Z' + minLength: 1 + nullable: true + duration_seconds: + type: integer + example: 1800 + minimum: 0 + nullable: true + account_id: + type: string + example: '12345' + nullable: true + contact_id: + type: string + example: '12345' + nullable: true + company_id: + type: string + example: '12345' + nullable: true + opportunity_id: + type: string + example: '12345' + nullable: true + lead_id: + type: string + example: '12345' + nullable: true + owner_id: + type: string + example: '12345' + nullable: true + campaign_id: + type: string + example: '12345' + nullable: true + case_id: + type: string + example: '12345' + nullable: true + asset_id: + type: string + example: '12345' + nullable: true + contract_id: + type: string + example: '12345' + nullable: true + product_id: + type: string + example: '12345' + nullable: true + solution_id: + type: string + example: '12345' + nullable: true + custom_object_id: + type: string + example: '12345' + nullable: true + type: + type: string + enum: + - call + - meeting + - email + - note + - task + - send-letter + - send-quote + - other + example: meeting + title: + type: string + example: Meeting + nullable: true + description: + type: string + example: More info about the meeting + nullable: true + location: + type: string + example: Space + nullable: true + all_day_event: + type: boolean + example: false + private: + type: boolean + example: true + group_event: + type: boolean + example: true + event_sub_type: + type: string + example: debrief + nullable: true + group_event_type: + type: string + example: Proposed + nullable: true + child: + type: boolean + example: false + archived: + type: boolean + example: false + deleted: + type: boolean + example: false + show_as: + type: string + enum: + - free + - busy + example: busy + activity_date: + type: string + example: '2021-05-01' + nullable: true + duration_minutes: + type: integer + example: 30 + nullable: true + start_datetime: + type: string + example: '2021-05-01T12:00:00.000Z' + nullable: true + end_datetime: + type: string + example: '2021-05-01T12:30:00.000Z' + nullable: true + end_date: + type: string + example: '2021-05-01' + nullable: true + recurrent: + type: boolean + example: false + reminder_datetime: + type: string + example: '2021-05-01T17:00:00.000Z' + nullable: true + reminder_set: + type: boolean + example: false + nullable: true + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + Address: + type: object + properties: + id: + type: string + example: '123' + nullable: true + type: + type: string + x-graphql-type-name: AddressType + enum: + - primary + - secondary + - home + - office + - shipping + - billing + - other + example: primary + name: + type: string + example: HQ US + nullable: true + line1: + type: string + example: Main street + description: 'Line 1 of the address e.g. number, street, suite, apt #, etc.' + nullable: true + line2: + type: string + example: 'apt #' + description: Line 2 of the address + nullable: true + city: + type: string + example: San Francisco + description: Name of city. + nullable: true + state: + type: string + example: CA + description: Name of state + nullable: true + postal_code: + type: string + example: '94104' + description: Zip code or equivalent. + nullable: true + country: + type: string + example: US + description: country code according to ISO 3166-1 alpha-2. + nullable: true + latitude: + type: string + example: '40.759211' + nullable: true + longitude: + type: string + example: '-73.984638' + nullable: true + BadRequest: + properties: + status_code: + type: number + description: HTTP status code + example: 400 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Bad Request + typeName: + type: string + description: The type of error returned + example: RequestHeadersValidationError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid Params + detail: + anyOf: + - type: string + example: Missing property foobar + - type: object + example: + missing: + - - foobar: required + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#requestbodyvalidationerror' + BankAccount: + type: object + properties: + iban: + type: string + example: CH2989144532982975332 + nullable: true + bic: + type: string + example: AUDSCHGGXXX + nullable: true + CompaniesFilter: + type: object + x-graphql-type-name: CompaniesFilter + example: + name: SpaceX + properties: + name: + type: string + description: Name of the company to filter on + example: SpaceX + additionalProperties: false + CompaniesSort: + type: object + x-graphql-type-name: CompaniesSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Companies + enum: + - created_at + - updated_at + - name + example: created_at + direction: + type: string + description: The direction in which to sort the Companies + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + Company: + type: object + required: + - name + additionalProperties: false + properties: + id: + type: string + readOnly: true + example: '12345' + name: + type: string + example: Copper + minLength: 1 + interaction_count: + type: integer + example: 1 + readOnly: true + nullable: true + owner_id: + type: string + example: '12345' + image_url: + type: string + example: 'https://www.spacex.com/static/images/share.jpg' + nullable: true + description: + type: string + example: 'A crm that works for you, so you can spend time on relationships instead of data.' + nullable: true + vat_number: + description: VAT number + type: string + example: BE0689615164 + nullable: true + currency: + type: string + example: USD + nullable: true + status: + type: string + minLength: 1 + example: Open + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + bank_accounts: + type: array + items: + $ref: '#/components/schemas/BankAccount' + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + Contact: + required: + - name + x-pii: + - name + - first_name + - middle_name + - last_name + - email + properties: + id: + type: string + example: '12345' + readOnly: true + name: + type: string + example: Elon Musk + minLength: 1 + owner_id: + type: string + example: '54321' + nullable: true + company_id: + type: string + example: '23456' + nullable: true + company_name: + type: string + example: '23456' + nullable: true + lead_id: + type: string + example: '34567' + nullable: true + first_name: + type: string + example: Elon + nullable: true + middle_name: + type: string + example: D. + nullable: true + last_name: + type: string + example: Musk + nullable: true + prefix: + type: string + example: Mr. + nullable: true + suffix: + type: string + example: PhD + nullable: true + title: + type: string + example: CEO + nullable: true + department: + type: string + example: Engineering + nullable: true + language: + type: string + example: EN + description: language code according to ISO 639-1. For the United States - EN + nullable: true + gender: + type: string + enum: + - male + - female + - unisex + example: female + nullable: true + birthday: + type: string + example: '2000-08-12' + nullable: true + image: + type: string + example: 'https://logo.dev/spacex.com?s=128' + nullable: true + lead_source: + type: string + minLength: 1 + example: Cold Call + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + description: + type: string + example: Internal champion + nullable: true + status: + type: string + example: open + nullable: true + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + additionalProperties: false + ContactsFilter: + type: object + x-graphql-type-name: ContactsFilter + example: + first_name: Elon + last_name: Musk + email: elon@tesla.com + properties: + name: + type: string + description: Name of the contact to filter on + example: Elon Musk + first_name: + type: string + description: First name of the contact to filter on + example: Elon + last_name: + type: string + description: Last name of the contact to filter on + example: Musk + email: + type: string + description: E-mail of the contact to filter on + example: elon@tesla.com + additionalProperties: false + ContactsSort: + type: object + x-graphql-type-name: ContactsSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Contacts + enum: + - created_at + - updated_at + - name + - first_name + - last_name + - email + example: created_at + direction: + type: string + description: The direction in which to sort the Contacts + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + CreateActivityResponse: + $id: https://developers.apideck.com/CreateActivity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateCompanyResponse: + $id: https://developers.apideck.com/CreateCompany.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateContactResponse: + $id: https://developers.apideck.com/CreateContact.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateLeadResponse: + $id: https://developers.apideck.com/CreateLead.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateNoteResponse: + $id: https://developers.apideck.com/CreateNote.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateOpportunityResponse: + $id: https://developers.apideck.com/CreateOpportunity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: opportunities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreatePipelineResponse: + $id: https://developers.apideck.com/CreatePipeline.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CreateUserResponse: + $id: https://developers.apideck.com/CreateUser.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + CustomField: + type: object + required: + - id + additionalProperties: false + properties: + id: + type: string + example: custom_technologies + value: + anyOf: + - type: string + example: Uses Salesforce and Marketo + nullable: true + - type: number + example: 10 + nullable: true + - type: boolean + example: true + nullable: true + - type: array + items: + type: string + DeleteActivityResponse: + $id: https://developers.apideck.com/DeleteActivity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteCompanyResponse: + $id: https://developers.apideck.com/DeleteCompany.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteContactResponse: + $id: https://developers.apideck.com/DeleteContact.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteLeadResponse: + $id: https://developers.apideck.com/DeleteLead.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteNoteResponse: + $id: https://developers.apideck.com/DeleteNote.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteOpportunityResponse: + $id: https://developers.apideck.com/DeleteOpportunity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeletePipelineResponse: + $id: https://developers.apideck.com/DeletePipeline.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + DeleteUserResponse: + $id: https://developers.apideck.com/DeleteUser.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + Email: + required: + - email + type: object + properties: + id: + type: string + example: '123' + email: + type: string + format: email + example: elon@musk.com + minLength: 1 + type: + type: string + x-graphql-type-name: EmailType + enum: + - primary + - secondary + - work + - personal + - billing + - other + example: primary + GetActivitiesResponse: + $id: https://developers.apideck.com/GetActivities.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: ActivityList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Activity' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetActivityResponse: + $id: https://developers.apideck.com/GetActivity.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: activity + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Activity' + GetCompaniesResponse: + $id: https://developers.apideck.com/GetCompanies.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: CompanyList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Company' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetCompanyResponse: + $id: https://developers.apideck.com/GetCompanyResponse.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: company + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Company' + GetContactResponse: + $id: https://developers.apideck.com/GetContact.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Contact' + GetContactsResponse: + $id: https://developers.apideck.com/GetContacts.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: ContactList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Contact' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetLeadResponse: + $id: https://developers.apideck.com/GetLead.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Lead' + GetLeadsResponse: + $id: https://developers.apideck.com/GetLeads.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: LeadList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Lead' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetNoteResponse: + $id: https://developers.apideck.com/GetNote.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: note + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Note' + GetNotesResponse: + $id: https://developers.apideck.com/GetNotes.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: NoteList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Note' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetOpportunitiesResponse: + $id: https://developers.apideck.com/GetOpportunities.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: OpportunityList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: opportunities + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Opportunity' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetOpportunityResponse: + $id: https://developers.apideck.com/GetOpportunity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: opportunities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Opportunity' + GetPipelineResponse: + $id: https://developers.apideck.com/GetPipeline.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/Pipeline' + GetPipelinesResponse: + $id: https://developers.apideck.com/GetPipelines.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: PipelinesList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/Pipeline' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + GetUserResponse: + $id: https://developers.apideck.com/GetUser.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/User' + GetUsersResponse: + $id: https://developers.apideck.com/GetUsers.json + $schema: http://json-schema.org/draft-07/schema# + x-graphql-type-name: UserList + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: users + operation: + type: string + description: Operation performed + example: one + data: + type: array + items: + $ref: '#/components/schemas/User' + meta: + $ref: '#/components/schemas/Meta' + links: + $ref: '#/components/schemas/Links' + Lead: + required: + - name + - company_name + x-pii: + - name + - email + - first_name + - last_name + additionalProperties: false + properties: + id: + type: string + example: '12345' + readOnly: true + name: + type: string + example: Elon Musk + minLength: 1 + company_name: + type: string + example: Spacex + nullable: true + owner_id: + type: string + example: '54321' + company_id: + type: string + example: '2' + nullable: true + contact_id: + type: string + example: '2' + nullable: true + lead_source: + type: string + example: Cold Call + nullable: true + first_name: + type: string + example: Elon + nullable: true + last_name: + type: string + example: Musk + nullable: true + description: + type: string + example: A thinker + nullable: true + prefix: + type: string + example: Sir + nullable: true + title: + type: string + example: CEO + nullable: true + language: + type: string + example: EN + description: language code according to ISO 639-1. For the United States - EN + nullable: true + status: + type: string + example: New + nullable: true + monetary_amount: + type: number + example: 75000 + nullable: true + currency: + type: string + example: USD + nullable: true + fax: + type: string + example: '+12129876543' + nullable: true + websites: + type: array + items: + $ref: '#/components/schemas/Website' + addresses: + type: array + items: + $ref: '#/components/schemas/Address' + social_links: + type: array + items: + $ref: '#/components/schemas/SocialLink' + phone_numbers: + type: array + items: + $ref: '#/components/schemas/PhoneNumber' + emails: + type: array + items: + $ref: '#/components/schemas/Email' + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + tags: + $ref: '#/components/schemas/Tags' + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + LeadsFilter: + type: object + x-graphql-type-name: LeadsFilter + example: + first_name: Elon + last_name: Musk + email: elon@tesla.com + properties: + name: + type: string + description: Name of the lead to filter on + example: Elon Musk + first_name: + type: string + description: First name of the lead to filter on + example: Elon + last_name: + type: string + description: Last name of the lead to filter on + example: Musk + email: + type: string + description: E-mail of the lead to filter on + example: elon@tesla.com + additionalProperties: false + LeadsSort: + type: object + x-graphql-type-name: LeadsSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Leads + enum: + - created_at + - updated_at + - name + - first_name + - last_name + - email + example: created_at + direction: + type: string + description: The direction in which to sort the Leads + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + Links: + type: object + description: Links to navigate to previous or next pages through the API + properties: + previous: + type: string + description: Link to navigate to the previous page through the API + example: 'https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D' + nullable: true + current: + type: string + description: Link to navigate to the current page through the API + example: 'https://unify.apideck.com/crm/companies' + next: + type: string + description: Link to navigate to the previous page through the API + example: 'https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM' + nullable: true + Meta: + type: object + description: Reponse metadata + properties: + items_on_page: + type: integer + description: Number of items returned in the data property of the response + example: 50 + cursors: + type: object + description: Cursors to navigate to previous or next pages through the API + properties: + previous: + type: string + description: Cursor to navigate to the previous page of results through the API + example: em9oby1jcm06OnBhZ2U6OjE= + nullable: true + current: + type: string + description: Cursor to navigate to the current page of results through the API + example: em9oby1jcm06OnBhZ2U6OjI= + nullable: true + next: + type: string + description: Cursor to navigate to the next page of results through the API + example: em9oby1jcm06OnBhZ2U6OjM= + nullable: true + NotFoundResponse: + $id: https://developers.apideck.com/NotFound.json + $schema: http://json-schema.org/draft-07/schema# + properties: + status_code: + type: number + description: HTTP status code + example: 404 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Not Found + typeName: + type: string + description: The type of error returned + example: EntityNotFoundError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unknown Widget + detail: + anyOf: + - type: string + example: "Could not find widget with id: '123'" + - type: object + example: + not_found: + entity: widget + id: '123' + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#entitynotfounderror' + NotImplemented: + properties: + status_code: + type: number + description: HTTP status code + example: 501 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Not Implemented + typeName: + type: string + description: The type of error returned + example: MappingError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unmapped Attribute + detail: + anyOf: + - type: string + example: Failed to retrieve Widget tokenUrl from 'components.securitySchemes.oauth2.flows' + - type: object + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#mappingerror' + Note: + type: object + additionalProperties: false + properties: + id: + type: string + readOnly: true + example: '12345' + title: + type: string + example: Meeting Notes + content: + type: string + example: Office hours are 9AM-6PM + owner_id: + type: string + example: '12345' + updated_by: + type: string + example: '12345' + readOnly: true + nullable: true + created_by: + type: string + example: '12345' + readOnly: true + nullable: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + readOnly: true + OpportunitiesFilter: + type: object + x-graphql-type-name: OpportunitiesFilter + example: + status: Completed + monetary_amount: 75000 + properties: + title: + type: string + description: Title of the opportunity to filter on + example: Tesla deal + status: + type: string + description: Status to filter on + example: Completed + monetary_amount: + type: number + description: Monetary amount to filter on + example: 75000 + win_probability: + type: number + description: Win probability to filter on + example: 50 + additionalProperties: false + OpportunitiesSort: + type: object + x-graphql-type-name: OpportunitiesSort + example: + by: created_at + direction: desc + properties: + by: + type: string + description: The field on which to sort the Opportunities + enum: + - created_at + - updated_at + - title + - win_probability + - monetary_amount + - status + example: created_at + direction: + type: string + description: The direction in which to sort the Opportunities + enum: + - asc + - desc + default: asc + required: + - by + additionalProperties: false + Opportunity: + type: object + required: + - title + - primary_contact_id + additionalProperties: false + properties: + id: + type: string + example: '12345' + readOnly: true + title: + type: string + example: New Rocket + minLength: 1 + primary_contact_id: + type: string + example: '12345' + nullable: true + description: + type: string + minLength: 1 + example: Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines. + nullable: true + monetary_amount: + type: number + example: 75000 + nullable: true + currency: + type: string + example: USD + nullable: true + win_probability: + type: number + example: 40 + nullable: true + close_date: + type: string + example: '2020-10-30' + format: date + nullable: true + loss_reason_id: + type: string + example: '12345' + nullable: true + loss_reason: + type: string + example: No budget + nullable: true + won_reason_id: + type: string + example: '12345' + nullable: true + won_reason: + type: string + example: Best pitch + nullable: true + pipeline_id: + type: string + example: '12345' + nullable: true + pipeline_stage_id: + type: string + example: '12345' + nullable: true + source_id: + type: string + example: '12345' + nullable: true + lead_id: + type: string + example: '12345' + nullable: true + contact_id: + type: string + example: '12345' + nullable: true + company_id: + type: string + example: '12345' + nullable: true + company_name: + type: string + example: Copper + nullable: true + owner_id: + type: string + example: '12345' + nullable: true + priority: + type: string + minLength: 1 + example: None + nullable: true + status: + type: string + minLength: 1 + example: Open + nullable: true + status_id: + type: string + example: '12345' + nullable: true + tags: + $ref: '#/components/schemas/Tags' + interaction_count: + type: number + example: 0 + readOnly: true + nullable: true + custom_fields: + type: array + items: + $ref: '#/components/schemas/CustomField' + date_stage_changed: + type: string + example: '2020-09-30T00:00:00.000Z' + format: date-time + nullable: true + readOnly: true + date_last_contacted: + type: string + example: '2020-09-30T00:00:00.000Z' + format: date-time + nullable: true + readOnly: true + date_lead_created: + type: string + example: '2020-09-30T00:00:00.000Z' + format: date-time + nullable: true + readOnly: true + updated_by: + type: string + example: '12345' + nullable: true + readOnly: true + created_by: + type: string + example: '12345' + nullable: true + readOnly: true + updated_at: + type: string + example: '2020-09-30T07:43:32.000Z' + format: date-time + readOnly: true + created_at: + type: string + example: '2020-09-30T07:43:32.000Z' + format: date-time + readOnly: true + PaymentRequired: + properties: + status_code: + type: number + description: HTTP status code + example: 402 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Payment Required + typeName: + type: string + description: The type of error returned + example: RequestLimitError + message: + type: string + description: A human-readable message providing more details about the error. + example: Request Limit Reached + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: You have reached your limit of 2000 + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#requestlimiterror' + PhoneNumber: + required: + - number + type: object + properties: + id: + type: string + example: '12345' + nullable: true + number: + type: string + example: 111-111-1111 + minLength: 1 + type: + type: string + x-graphql-type-name: PhoneType + enum: + - primary + - secondary + - home + - office + - mobile + - assistant + - fax + - other + example: primary + Pipeline: + required: + - name + x-pii: [] + properties: + id: + type: string + example: default + name: + type: string + example: Sales Pipeline + minLength: 1 + currency: + type: string + example: USD + archived: + type: boolean + example: false + display_order: + type: integer + example: 1 + stages: + type: array + items: + type: object + properties: + id: + type: string + example: contractsent + readOnly: true + name: + type: string + example: Contract Sent + value: + type: string + example: CONTRACT_SENT + display_order: + type: integer + example: 1 + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + additionalProperties: false + SocialLink: + required: + - url + type: object + properties: + id: + type: string + example: '12345' + nullable: true + url: + type: string + example: 'https://www.twitter.com/apideck-io' + minLength: 1 + type: + type: string + example: twitter + nullable: true + Tags: + type: array + items: + type: string + example: + - New + User: + required: + - email + x-pii: + - username + - first_name + - last_name + - email + properties: + id: + type: string + example: '12345' + readOnly: true + email: + type: string + format: email + example: elon@musk.com + minLength: 1 + parent_id: + type: string + example: '54321' + nullable: true + username: + type: string + example: masterofcoin + nullable: true + first_name: + type: string + example: Elon + nullable: true + last_name: + type: string + example: Musk + nullable: true + image: + type: string + example: 'https://logo.dev/spacex.com?s=128' + nullable: true + language: + type: string + example: EN + nullable: true + status: + type: string + example: active + nullable: true + password: + type: string + example: supersecretpassword + writeOnly: true + updated_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + created_at: + type: string + example: '2017-08-12T20:43:21.291Z' + readOnly: true + Unauthorized: + properties: + status_code: + type: number + description: HTTP status code + example: 401 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Unauthorized + typeName: + type: string + description: The type of error returned + example: UnauthorizedError + message: + type: string + description: A human-readable message providing more details about the error. + example: Unauthorized Request + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: Failed to generate valid JWT Session. Verify applicationId is correct + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#unauthorizederror' + UnexpectedError: + properties: + status_code: + type: number + description: HTTP status code + example: 400 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Bad Request + typeName: + type: string + description: The type of error returned + example: RequestHeadersValidationError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid Params + detail: + anyOf: + - type: string + example: 'Missing Header: x-apideck-consumer-id' + - type: object + example: + missing: + - - x-apideck-consumer-id: required + description: Contains parameter or domain specific information related to the error and why it occured. + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#unauthorizederror' + UnifiedId: + title: UnifiedId + required: + - id + properties: + id: + type: string + readOnly: true + example: '12345' + Unprocessable: + properties: + status_code: + type: number + description: HTTP status code + example: 422 + error: + type: string + description: Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) + example: Unprocessable Entity + typeName: + type: string + description: The type of error returned + example: InvalidStateError + message: + type: string + description: A human-readable message providing more details about the error. + example: Invalid State + detail: + type: string + description: Contains parameter or domain specific information related to the error and why it occured. + example: State did not include unified_api + ref: + type: string + description: Link to documentation of error type + example: 'https://developers.apideck.com/errors#invalidstateerror' + UpdateActivityResponse: + $id: https://developers.apideck.com/UpdateActivity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: activities + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateCompanyResponse: + $id: https://developers.apideck.com/UpdateCompany.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateContactResponse: + $id: https://developers.apideck.com/UpdateContact.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateLeadResponse: + $id: https://developers.apideck.com/UpdateLead.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateNoteResponse: + $id: https://developers.apideck.com/UpdateNote.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: notes + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateOpportunityResponse: + $id: https://developers.apideck.com/UpdateOpportunity.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdatePipelineResponse: + $id: https://developers.apideck.com/UpdatePipeline.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: pipelines + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + UpdateUserResponse: + $id: https://developers.apideck.com/UpdateUser.json + $schema: http://json-schema.org/draft-07/schema# + type: object + required: + - status_code + - status + - service + - resource + - operation + - data + properties: + status_code: + type: integer + description: HTTP Response Status Code + example: 200 + status: + type: string + description: HTTP Response Status + example: OK + service: + type: string + description: Apideck ID of service provider + example: zoho-crm + resource: + type: string + description: Unified API resource name + example: companies + operation: + type: string + description: Operation performed + example: one + data: + $ref: '#/components/schemas/UnifiedId' + Website: + type: object + required: + - url + properties: + id: + type: string + example: '12345' + nullable: true + url: + type: string + example: 'http://example.com' + minLength: 1 + type: + type: string + x-graphql-type-name: WebsiteType + enum: + - primary + - secondary + - work + - personal + - other + example: primary + parameters: + applicationId: + name: x-apideck-app-id + in: header + required: true + description: The ID of your Unify application + schema: + type: string + serviceId: + name: x-apideck-service-id + in: header + description: 'Provide the service id you want to call (e.g., pipedrive). [See the full list in the connector section.](#section/Connectors) Only needed when a consumer has activated multiple integrations for a Unified API.' + schema: + type: string + consumerId: + name: x-apideck-consumer-id + in: header + required: true + description: ID of the consumer which you want to get or push data from + schema: + type: string + raw: + name: raw + in: query + description: Include raw response. Mostly used for debugging purposes + schema: + type: boolean + default: true + id: + in: path + name: id + schema: + type: string + required: true + description: ID of the record you are acting upon. + limit: + name: limit + in: query + description: Number of records to return + schema: + type: integer + minimum: 1 + maximum: 200 + default: 20 + cursor: + name: cursor + in: query + description: Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. + schema: + type: string + nullable: true + default: null + contactsFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/ContactsFilter' + contactsSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/ContactsSort' + opportunitiesFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/OpportunitiesFilter' + opportunitiesSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/OpportunitiesSort' + companiesFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/CompaniesFilter' + companiesSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/CompaniesSort' + leadsFilter: + name: filter + in: query + description: Apply filters (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/LeadsFilter' + leadsSort: + name: sort + in: query + description: Apply sorting (beta) + style: deepObject + explode: true + schema: + $ref: '#/components/schemas/LeadsSort' + responses: + BadRequest: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequest' + CreateActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/CreateActivityResponse' + CreateCompany: + description: Company created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCompanyResponse' + CreateContact: + description: Contact created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateContactResponse' + CreateLead: + description: Lead created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLeadResponse' + CreateNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/CreateNoteResponse' + CreateOpportunity: + description: Opportunity + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOpportunityResponse' + CreatePipeline: + description: Pipeline created + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePipelineResponse' + CreateUser: + description: User created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserResponse' + DeleteActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteActivityResponse' + DeleteCompany: + description: Company deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteCompanyResponse' + DeleteContact: + description: Contact deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteContactResponse' + DeleteLead: + description: Lead deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteLeadResponse' + DeleteNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteNoteResponse' + DeleteOpportunity: + description: Opportunity deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteOpportunityResponse' + DeletePipeline: + description: Pipeline deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeletePipelineResponse' + DeleteUser: + description: User deleted + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteUserResponse' + GetActivitiesResponse: + description: Activities + content: + application/json: + schema: + $ref: '#/components/schemas/GetActivitiesResponse' + GetActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/GetActivityResponse' + GetCompanies: + description: Companies + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompaniesResponse' + GetCompany: + description: Company + content: + application/json: + schema: + $ref: '#/components/schemas/GetCompanyResponse' + GetContact: + description: Contact + content: + application/json: + schema: + $ref: '#/components/schemas/GetContactResponse' + GetContacts: + description: Contacts + content: + application/json: + schema: + $ref: '#/components/schemas/GetContactsResponse' + GetLead: + description: Lead + content: + application/json: + schema: + $ref: '#/components/schemas/GetLeadResponse' + GetLeads: + description: Leads + content: + application/json: + schema: + $ref: '#/components/schemas/GetLeadsResponse' + GetNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/GetNoteResponse' + GetNotesResponse: + description: Notes + content: + application/json: + schema: + $ref: '#/components/schemas/GetNotesResponse' + GetOpportunities: + description: Opportunities + content: + application/json: + schema: + $ref: '#/components/schemas/GetOpportunitiesResponse' + GetOpportunity: + description: Opportunity + content: + application/json: + schema: + $ref: '#/components/schemas/GetOpportunityResponse' + GetPipeline: + description: Pipeline + content: + application/json: + schema: + $ref: '#/components/schemas/GetPipelineResponse' + GetPipelines: + description: Pipelines + content: + application/json: + schema: + $ref: '#/components/schemas/GetPipelinesResponse' + GetUsers: + description: Users + content: + application/json: + schema: + $ref: '#/components/schemas/GetUsersResponse' + GetUser: + description: User + content: + application/json: + schema: + $ref: '#/components/schemas/GetUserResponse' + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + NotImplemented: + description: Not Implemented + content: + application/json: + schema: + $ref: '#/components/schemas/NotImplemented' + PaymentRequired: + description: Payment Required + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequired' + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Unauthorized' + UnexpectedError: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/UnexpectedError' + Unprocessable: + description: Unprocessable + content: + application/json: + schema: + $ref: '#/components/schemas/Unprocessable' + UpdateActivityResponse: + description: Activity + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateActivityResponse' + UpdateCompany: + description: Company updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateCompanyResponse' + UpdateContact: + description: Contact updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateContactResponse' + UpdateLead: + description: Lead updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateLeadResponse' + UpdateNoteResponse: + description: Note + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateNoteResponse' + UpdateOpportunity: + description: Opportunity updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOpportunityResponse' + UpdatePipeline: + description: Pipeline updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePipelineResponse' + UpdateUser: + description: User updated + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserResponse' + securitySchemes: + apiKey: + type: http + scheme: bearer + description: | + To use API you have to sign up and get your own API key. Unify API accounts have sandbox mode and live mode API keys. + To change modes just use the appropriate key to get a live or test object. You can find your API keys on the unify settings of your Apideck app. + Your Apideck application_id can also be found on the same page. + + Authenticate your API requests by including your test or live secret API key in the request header. + + - Bearer authorization header: `Authorization: Bearer ` + - Application id header: `x-apideck-app-id: ` + + You should use the public keys on the SDKs and the secret keys to authenticate API requests. + + **Do not share or include your secret API keys on client side code.** Your API keys carry significant privileges. Please ensure to keep them 100% secure and be sure to not share your secret API keys in areas that are publicly accessible like GitHub. + + Learn how to set the Authorization header inside Postman https://learning.postman.com/docs/postman/sending-api-requests/authorization/#api-key + + Go to Unify to grab your API KEY https://app.apideck.com/unify/api-keys + applicationId: + type: apiKey + in: header + name: x-apideck-app-id + description: The ID of your Unify application + consumerId: + type: apiKey + in: header + name: x-apideck-consumer-id + description: The ID of the consumer which you want to get or push data from +paths: + /crm/companies: + get: + tags: + - Companies + operationId: companiesAll + x-graphql-field-name: companies + summary: List companies + description: List companies + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/companiesFilter' + - $ref: '#/components/parameters/companiesSort' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetCompanies' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Companies + operationId: companiesAdd + summary: Create company + description: Create company + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Company' + responses: + '201': + $ref: '#/components/responses/CreateCompany' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/companies/{id}': + get: + tags: + - Companies + operationId: companiesOne + summary: Get company + description: Get company + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetCompany' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Companies + operationId: companiesUpdate + summary: Update company + description: Update company + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Company' + responses: + '200': + $ref: '#/components/responses/UpdateCompany' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Companies + operationId: companiesDelete + summary: Delete company + description: Delete company + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteCompany' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/contacts: + get: + tags: + - Contacts + x-graphql-field-name: contacts + operationId: contactsAll + summary: List contacts + description: List contacts + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/contactsFilter' + - $ref: '#/components/parameters/contactsSort' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetContacts' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Contacts + operationId: contactsAdd + summary: Create contact + description: Create contact + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Contact' + responses: + '201': + $ref: '#/components/responses/CreateContact' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/contacts/{id}': + get: + tags: + - Contacts + operationId: contactsOne + summary: Get contact + description: Get contact + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetContact' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Contacts + operationId: contactsUpdate + summary: Update contact + description: Update contact + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Contact' + responses: + '200': + $ref: '#/components/responses/UpdateContact' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Contacts + operationId: contactsDelete + summary: Delete contact + description: Delete contact + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteContact' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/opportunities: + get: + tags: + - Opportunities + x-graphql-field-name: opportunities + operationId: opportunitiesAll + summary: List opportunities + description: List opportunities + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/opportunitiesFilter' + - $ref: '#/components/parameters/opportunitiesSort' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetOpportunities' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Opportunities + operationId: opportunitiesAdd + summary: Create opportunity + description: Create opportunity + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Opportunity' + responses: + '201': + $ref: '#/components/responses/CreateOpportunity' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/opportunities/{id}': + get: + tags: + - Opportunities + operationId: opportunitiesOne + summary: Get opportunity + description: Get opportunity + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetOpportunity' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Opportunities + operationId: opportunitiesUpdate + summary: Update opportunity + description: Update opportunity + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Opportunity' + responses: + '200': + $ref: '#/components/responses/UpdateOpportunity' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Opportunities + operationId: opportunitiesDelete + summary: Delete opportunity + description: Delete opportunity + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteOpportunity' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/leads: + get: + tags: + - Leads + x-graphql-field-name: leads + operationId: leadsAll + summary: List leads + description: List leads + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/leadsFilter' + - $ref: '#/components/parameters/leadsSort' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetLeads' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Leads + operationId: leadsAdd + summary: Create lead + description: Create lead + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Lead' + responses: + '201': + $ref: '#/components/responses/CreateLead' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/leads/{id}': + get: + tags: + - Leads + operationId: leadsOne + summary: Get lead + description: Get lead + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetLead' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Leads + operationId: leadsUpdate + summary: Update lead + description: Update lead + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Lead' + responses: + '200': + $ref: '#/components/responses/UpdateLead' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Leads + operationId: leadsDelete + summary: Delete lead + description: Delete lead + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteLead' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/pipelines: + get: + tags: + - Pipelines + x-graphql-field-name: pipelines + operationId: pipelinesAll + summary: List pipelines + description: List pipelines + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetPipelines' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Pipelines + operationId: pipelinesAdd + summary: Create pipeline + description: Create pipeline + x-apideck-upcoming: true + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Pipeline' + responses: + '201': + $ref: '#/components/responses/CreatePipeline' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/pipelines/{id}': + get: + tags: + - Pipelines + operationId: pipelinesOne + summary: Get pipeline + description: Get pipeline + x-apideck-upcoming: true + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetPipeline' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Pipelines + operationId: pipelinesUpdate + summary: Update pipeline + description: Update pipeline + x-apideck-upcoming: true + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Pipeline' + responses: + '200': + $ref: '#/components/responses/UpdatePipeline' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Pipelines + operationId: pipelinesDelete + summary: Delete pipeline + description: Delete pipeline + x-apideck-upcoming: true + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeletePipeline' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/notes: + get: + tags: + - Notes + x-graphql-field-name: notes + operationId: notesAll + summary: List notes + description: List notes + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetNotesResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Notes + operationId: notesAdd + summary: Create note + description: Create note + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Note' + responses: + '201': + $ref: '#/components/responses/CreateNoteResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/notes/{id}': + get: + tags: + - Notes + operationId: notesOne + summary: Get note + description: Get note + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetNoteResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Notes + operationId: notesUpdate + summary: Update note + description: Update note + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Note' + responses: + '200': + $ref: '#/components/responses/UpdateNoteResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Notes + operationId: notesDelete + summary: Delete note + description: Delete note + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteNoteResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/users: + get: + tags: + - Users + x-graphql-field-name: users + operationId: usersAll + summary: List users + description: List users + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetUsers' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Users + operationId: usersAdd + summary: Create user + description: Create user + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + '201': + $ref: '#/components/responses/CreateUser' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/users/{id}': + get: + tags: + - Users + operationId: usersOne + summary: Get user + description: Get user + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetUser' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Users + operationId: usersUpdate + summary: Update user + description: Update user + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + '200': + $ref: '#/components/responses/UpdateUser' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Users + operationId: usersDelete + summary: Delete user + description: Delete user + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteUser' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + /crm/activities: + get: + tags: + - Activities + x-graphql-field-name: activities + operationId: activitiesAll + summary: List activities + description: List activities + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/limit' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetActivitiesResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + post: + tags: + - Activities + operationId: activitiesAdd + summary: Create activity + description: Create activity + parameters: + - $ref: '#/components/parameters/raw' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Activity' + responses: + '201': + $ref: '#/components/responses/CreateActivityResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + '/crm/activities/{id}': + get: + tags: + - Activities + operationId: activitiesOne + summary: Get activity + description: Get activity + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/GetActivityResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + patch: + tags: + - Activities + operationId: activitiesUpdate + summary: Update activity + description: Update activity + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Activity' + responses: + '200': + $ref: '#/components/responses/UpdateActivityResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' + delete: + tags: + - Activities + operationId: activitiesDelete + summary: Delete activity + description: Delete activity + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/consumerId' + - $ref: '#/components/parameters/applicationId' + - $ref: '#/components/parameters/serviceId' + - $ref: '#/components/parameters/raw' + security: + - apiKey: [] + responses: + '200': + $ref: '#/components/responses/DeleteActivityResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '402': + $ref: '#/components/responses/PaymentRequired' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/Unprocessable' + default: + $ref: '#/components/responses/UnexpectedError' diff --git a/__tests__/testUtils/getOasMappedOperation.ts b/__tests__/testUtils/getOasMappedOperation.ts index 40516814..4692e966 100644 --- a/__tests__/testUtils/getOasMappedOperation.ts +++ b/__tests__/testUtils/getOasMappedOperation.ts @@ -31,3 +31,35 @@ export const getOasMappedListArrayOperation = async (): Promise => { + const oasYml = '__tests__/fixtures/crm31.yml' + const oasParser = new OpenApiParser() + + await oasParser.convert({ inputFile: oasYml }) + return oasParser.mappedOperations[2] +} + +export const getOasV31MappedCreateOperation = async (): Promise => { + const oasYml = '__tests__/fixtures/crm31.yml' + const oasParser = new OpenApiParser() + + await oasParser.convert({ inputFile: oasYml }) + return oasParser.mappedOperations[1] +} + +export const getOasV31MappedCreateArrayOperation = async (): Promise => { + const oasYml = '__tests__/fixtures/crm-request-items31.yml' + const oasParser = new OpenApiParser() + + await oasParser.convert({ inputFile: oasYml }) + return oasParser.mappedOperations[0] +} + +export const getOasV31MappedListArrayOperation = async (): Promise => { + const oasYml = '__tests__/fixtures/crm-request-array.yml' + const oasParser = new OpenApiParser() + + await oasParser.convert({ inputFile: oasYml }) + return oasParser.mappedOperations[1] +} diff --git a/package-lock.json b/package-lock.json index 0464bef7..b8b60063 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@apidevtools/swagger-parser": "^10.1.1", "@faker-js/faker": "5.5.3", "ajv": "^8.17.1", + "ajv-draft-04": "^1.0.0", "axios": "^1.12.0", "chalk": "^4.1.2", "dot-object": "^2.1.5", @@ -25,7 +26,7 @@ "node-emoji": "^1.11.0", "openapi-format": "^1.28.0", "openapi-to-postmanv2": "5.0.0", - "openapi-types": "9.1.0", + "openapi-types": "^12.1.3", "ora": "^5.4.1", "pluralize": "^8.0.0", "postman-collection": "5.0.2", @@ -1978,6 +1979,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", + "license": "MIT", "peerDependencies": { "ajv": "^8.5.0" }, @@ -6771,9 +6773,10 @@ } }, "node_modules/openapi-types": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-9.1.0.tgz", - "integrity": "sha512-mhXh8QN8sbErlxfxBeZ/pzgvmDn443p8CXlxwGSi2bWANZAFvjLPI0PoGjqHW+JdBbXg6uvmvM81WXaweh/SVA==" + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.1.3.tgz", + "integrity": "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==", + "license": "MIT" }, "node_modules/optionator": { "version": "0.9.3", diff --git a/package.json b/package.json index ecdcb323..de6bcc81 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "@apidevtools/swagger-parser": "^10.1.1", "@faker-js/faker": "5.5.3", "ajv": "^8.17.1", + "ajv-draft-04": "^1.0.0", "axios": "^1.12.0", "chalk": "^4.1.2", "dot-object": "^2.1.5", @@ -82,7 +83,7 @@ "node-emoji": "^1.11.0", "openapi-format": "^1.28.0", "openapi-to-postmanv2": "5.0.0", - "openapi-types": "9.1.0", + "openapi-types": "^12.1.3", "ora": "^5.4.1", "pluralize": "^8.0.0", "postman-collection": "5.0.2", diff --git a/src/__tests__/Portman.test.ts b/src/__tests__/Portman.test.ts index 70739f91..e0c3d70b 100644 --- a/src/__tests__/Portman.test.ts +++ b/src/__tests__/Portman.test.ts @@ -2,7 +2,7 @@ import SwaggerParser from '@apidevtools/swagger-parser' import fs from 'fs-extra' import * as Either from 'fp-ts/lib/Either' import { ValidationError } from '@apideck/better-ajv-errors' -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPI } from 'openapi-types' import { CollectionDefinition } from 'postman-collection' import * as mockOAS from '../../__tests__/fixtures/mockOAS.json' import * as mockPostman from '../../__tests__/fixtures/mockPostman.json' @@ -56,10 +56,10 @@ describe('Portman', () => { // mock conversions jest .spyOn(SwaggerParser.prototype, 'dereference') - .mockImplementation(() => Promise.resolve(mockOAS as OpenAPIV3.Document)) + .mockImplementation(() => Promise.resolve(mockOAS as OpenAPI.Document)) jest .spyOn(SwaggerParser.prototype, 'bundle') - .mockImplementation(() => Promise.resolve(mockOAS as OpenAPIV3.Document)) + .mockImplementation(() => Promise.resolve(mockOAS as OpenAPI.Document)) jest .spyOn(OpenApiToPostmanService.prototype, 'convert') .mockImplementation(() => Promise.resolve(mockPostman)) diff --git a/src/application/Fuzzer.ts b/src/application/Fuzzer.ts index 8d0a60c9..d13bac88 100644 --- a/src/application/Fuzzer.ts +++ b/src/application/Fuzzer.ts @@ -17,7 +17,7 @@ import { } from '../types' import traverse from 'neotraverse/legacy' import { TestSuite, VariationWriter } from './' -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' import { getByPath, getJsonContentType } from '../utils' import { QueryParam } from 'postman-collection' import { PostmanDynamicVarGenerator } from '../services/PostmanDynamicVarGenerator' @@ -54,14 +54,18 @@ export class Fuzzer { if (!oaOperation?.schema?.requestBody) return // Analyse request body & content-type - const reqBody = oaOperation?.schema?.requestBody as unknown as OpenAPIV3.RequestBodyObject + const reqBody = oaOperation?.schema?.requestBody as unknown as + | OpenAPIV3.RequestBodyObject + | OpenAPIV3_1.RequestBodyObject const jsonContentType = getJsonContentType(Object.keys(reqBody?.content)) // No JSON content-type defined if (!jsonContentType) return // Analyse JSON schema - const schema = reqBody?.content?.[jsonContentType]?.schema as OpenAPIV3.SchemaObject + const schema = reqBody?.content?.[jsonContentType]?.schema as + | OpenAPIV3.SchemaObject + | OpenAPIV3_1.SchemaObject const fuzzItems = this.analyzeFuzzJsonSchema(schema) const fuzzReqBodySet = fuzzingSet.filter(fuzz => fuzz?.requestBody) as fuzzingConfig[] @@ -136,7 +140,9 @@ export class Fuzzer { // No request query params defined if (!oaOperation?.queryParams) return - const reqQueryParams = oaOperation?.queryParams as unknown as OpenAPIV3.ParameterObject[] + const reqQueryParams = oaOperation?.queryParams as unknown as + | OpenAPIV3.ParameterObject[] + | OpenAPIV3_1.ParameterObject[] reqQueryParams.map(queryParam => { // Analyse query param schema const fuzzItems = this.analyzeQuerySchema(queryParam) @@ -214,7 +220,9 @@ export class Fuzzer { // No request headers defined if (!oaOperation?.requestHeaders) return - const reqHeaders = oaOperation?.requestHeaders as unknown as OpenAPIV3.ParameterObject[] + const reqHeaders = oaOperation?.requestHeaders as unknown as + | OpenAPIV3.ParameterObject[] + | OpenAPIV3_1.ParameterObject[] reqHeaders.map(header => { // Analyse header schema const fuzzItems = this.analyzeHeaderSchema(header) @@ -808,7 +816,7 @@ export class Fuzzer { } public analyzeFuzzJsonSchema( - originalJsonSchema: OpenAPIV3.SchemaObject | undefined + originalJsonSchema: OpenAPIV3.SchemaObject | OpenAPIV3_1.SchemaObject | undefined ): FuzzingSchemaItems | null { const fuzzItems = { fuzzType: PortmanFuzzTypes.requestBody, @@ -821,7 +829,9 @@ export class Fuzzer { if (!originalJsonSchema) return fuzzItems // Copy jsonSchema to keep the original jsonSchema untouched - const jsonSchema = { ...originalJsonSchema } as OpenAPIV3.SchemaObject + const jsonSchema = { ...originalJsonSchema } as + | OpenAPIV3.SchemaObject + | OpenAPIV3_1.SchemaObject const skipSchemaKeys = ['properties', 'items', 'allOf', 'anyOf', 'oneOf'] traverse(jsonSchema).forEach(function (node) { @@ -958,7 +968,7 @@ export class Fuzzer { } public analyzeQuerySchema( - queryParam: OpenAPIV3.ParameterObject | undefined + queryParam: OpenAPIV3.ParameterObject | OpenAPIV3_1.ParameterObject | undefined ): FuzzingSchemaItems | null { const fuzzItems = { fuzzType: PortmanFuzzTypes.requestQueryParam, @@ -971,7 +981,7 @@ export class Fuzzer { if (!queryParam?.schema || !queryParam.name) return fuzzItems - const schema = queryParam?.schema as OpenAPIV3.BaseSchemaObject + const schema = queryParam?.schema as OpenAPIV3.BaseSchemaObject | OpenAPIV3_1.BaseSchemaObject // Register all fuzz-able items if (queryParam?.required) { @@ -1010,7 +1020,7 @@ export class Fuzzer { } public analyzeHeaderSchema( - header: OpenAPIV3.ParameterObject | undefined + header: OpenAPIV3.ParameterObject | OpenAPIV3_1.ParameterObject | undefined ): FuzzingSchemaItems | null { const fuzzItems = { fuzzType: PortmanFuzzTypes.requestHeader, @@ -1023,7 +1033,7 @@ export class Fuzzer { if (!header?.schema || !header.name) return fuzzItems - const schema = header?.schema as OpenAPIV3.BaseSchemaObject + const schema = header?.schema as OpenAPIV3.BaseSchemaObject | OpenAPIV3_1.BaseSchemaObject // Register all fuzz-able items if (header?.required) { diff --git a/src/application/TestSuite.ts b/src/application/TestSuite.ts index b3b062fe..1944030b 100644 --- a/src/application/TestSuite.ts +++ b/src/application/TestSuite.ts @@ -1,4 +1,4 @@ -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' import { Collection, Header } from 'postman-collection' import { applyOverwrites, @@ -120,7 +120,9 @@ export class TestSuite { const reqInfo = parseOpenApiRequest(contractTest.openApiRequest) let reqContentType = reqInfo?.contentType if (reqContentType && reqContentType.includes('*') && operation.schema?.requestBody) { - const reqObj = operation.schema.requestBody as OpenAPIV3.RequestBodyObject + const reqObj = operation.schema.requestBody as + | OpenAPIV3.RequestBodyObject + | OpenAPIV3_1.RequestBodyObject const matchCt = Object.keys(reqObj.content || {}).find(ct => matchWildcard(ct, reqContentType as string) ) @@ -133,7 +135,9 @@ export class TestSuite { value: reqContentType } as Header) - const reqBodyObj = operation.schema.requestBody as OpenAPIV3.RequestBodyObject + const reqBodyObj = operation.schema.requestBody as + | OpenAPIV3.RequestBodyObject + | OpenAPIV3_1.RequestBodyObject const example = getRequestBodyExample(reqBodyObj, reqContentType) if (example && pmOperation.item.request.body) { pmOperation.item.request.body.mode = 'raw' @@ -158,7 +162,9 @@ export class TestSuite { respContentType.includes('*') && operation.schema?.responses?.[respCode] ) { - const respObj = operation.schema.responses[respCode] as OpenAPIV3.ResponseObject + const respObj = operation.schema.responses[respCode] as + | OpenAPIV3.ResponseObject + | OpenAPIV3_1.ResponseObject const matchCt = Object.keys(respObj.content || {}).find(ct => matchWildcard(ct, respContentType as string) ) @@ -319,7 +325,7 @@ export class TestSuite { const responseKey = response[0][0] const responseCode = parseInt(responseKey) as number - const responseObject = response[0][1] as OpenAPIV3.ResponseObject + const responseObject = response[0][1] as OpenAPIV3.ResponseObject | OpenAPIV3_1.ResponseObject // List excludeForOperations const optStatusSuccess = contractTest['statusSuccess'] @@ -379,7 +385,10 @@ export class TestSuite { // Add response content checks if (responseObject.content) { - const processContent = (contentType: string, content: OpenAPIV3.MediaTypeObject): void => { + const processContent = ( + contentType: string, + content: OpenAPIV3.MediaTypeObject | OpenAPIV3_1.MediaTypeObject + ): void => { // Add contentType check if ( optContentType && @@ -445,7 +454,9 @@ export class TestSuite { // Early skip if no schema defined if (!headerKey) continue - const header = responseObject.headers[headerKey] as OpenAPIV3.HeaderObject + const header = responseObject.headers[headerKey] as + | OpenAPIV3.HeaderObject + | OpenAPIV3_1.HeaderObject const headerRequired = header.required || false const headerName = headerKey as string diff --git a/src/application/globals/renamePostmanCollection.ts b/src/application/globals/renamePostmanCollection.ts index 1749efb7..b5f57da6 100644 --- a/src/application/globals/renamePostmanCollection.ts +++ b/src/application/globals/renamePostmanCollection.ts @@ -1,10 +1,10 @@ import { PortmanOptions } from '../../types' -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPI } from 'openapi-types' export const renamePostmanCollection = ( - oas: OpenAPIV3.Document, + oas: OpenAPI.Document, options: PortmanOptions -): OpenAPIV3.Document => { +): OpenAPI.Document => { if (!oas?.info?.title) { throw new Error(`OpenAPI title is required. Please ensure your OpenAPI document has title.`) } diff --git a/src/application/tests/__snapshots__/testResponseJsonSchema.test.ts.snap b/src/application/tests/__snapshots__/testResponseJsonSchema.test.ts.snap index a9d14034..72f32535 100644 --- a/src/application/tests/__snapshots__/testResponseJsonSchema.test.ts.snap +++ b/src/application/tests/__snapshots__/testResponseJsonSchema.test.ts.snap @@ -26,6 +26,32 @@ pm.test(\\"[GET]::/crm/companies/:id - Schema is valid\\", function() { ] `; +exports[`testResponseJsonSchema should add test for valid json schema v4 1`] = ` +Array [ + "// Response Validation +const schema = {\\"$id\\":\\"https://developers.apideck.com/GetCompanyResponse.json\\",\\"$schema\\":\\"http://json-schema.org/draft-04/schema#\\",\\"x-graphql-type-name\\":\\"company\\",\\"type\\":\\"object\\",\\"required\\":[\\"status_code\\",\\"status\\",\\"service\\",\\"resource\\",\\"operation\\",\\"data\\"],\\"properties\\":{\\"status_code\\":{\\"type\\":\\"integer\\",\\"description\\":\\"HTTP Response Status Code\\"},\\"status\\":{\\"type\\":\\"string\\",\\"description\\":\\"HTTP Response Status\\"},\\"service\\":{\\"type\\":\\"string\\",\\"description\\":\\"Apideck ID of service provider\\"},\\"resource\\":{\\"type\\":\\"string\\",\\"description\\":\\"Unified API resource name\\"},\\"operation\\":{\\"type\\":\\"string\\",\\"description\\":\\"Operation performed\\"},\\"data\\":{\\"type\\":\\"object\\",\\"required\\":[\\"name\\"],\\"additionalProperties\\":false,\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"name\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"interaction_count\\":{\\"type\\":[\\"integer\\",\\"null\\"]},\\"owner_id\\":{\\"type\\":\\"string\\"},\\"image_url\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"description\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"vat_number\\":{\\"description\\":\\"VAT number\\",\\"type\\":[\\"string\\",\\"null\\"]},\\"currency\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"status\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"minLength\\":1},\\"fax\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"bank_accounts\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"properties\\":{\\"iban\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"bic\\":{\\"type\\":[\\"string\\",\\"null\\"]}}}},\\"websites\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"required\\":[\\"url\\"],\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"url\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"WebsiteType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"work\\",\\"personal\\",\\"other\\"]}}}},\\"addresses\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"AddressType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"home\\",\\"office\\",\\"shipping\\",\\"billing\\",\\"other\\"]},\\"name\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"line1\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Line 1 of the address e.g. number, street, suite, apt #, etc.\\"},\\"line2\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Line 2 of the address\\"},\\"city\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Name of city.\\"},\\"state\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Name of state\\"},\\"postal_code\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Zip code or equivalent.\\"},\\"country\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"country code according to ISO 3166-1 alpha-2.\\"},\\"latitude\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"longitude\\":{\\"type\\":[\\"string\\",\\"null\\"]}}}},\\"social_links\\":{\\"type\\":\\"array\\",\\"items\\":{\\"required\\":[\\"url\\"],\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"url\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"type\\":{\\"type\\":[\\"string\\",\\"null\\"]}}}},\\"phone_numbers\\":{\\"type\\":\\"array\\",\\"items\\":{\\"required\\":[\\"number\\"],\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"number\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"PhoneType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"home\\",\\"office\\",\\"mobile\\",\\"assistant\\",\\"fax\\",\\"other\\"]}}}},\\"emails\\":{\\"type\\":\\"array\\",\\"items\\":{\\"required\\":[\\"email\\"],\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"email\\":{\\"type\\":\\"string\\",\\"format\\":\\"email\\",\\"minLength\\":1},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"EmailType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"work\\",\\"personal\\",\\"billing\\",\\"other\\"]}}}},\\"custom_fields\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"required\\":[\\"id\\"],\\"additionalProperties\\":false,\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"value\\":{\\"anyOf\\":[{\\"type\\":[\\"string\\",\\"null\\"]},{\\"type\\":[\\"number\\",\\"null\\"]},{\\"type\\":[\\"boolean\\",\\"null\\"]},{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"string\\"}}]}}}},\\"tags\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"string\\"}},\\"updated_by\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"created_by\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"updated_at\\":{\\"type\\":\\"string\\"},\\"created_at\\":{\\"type\\":\\"string\\"}}}}} + +// Validate if response matches JSON schema +pm.test(\\"[GET]::/crm/companies/:id - Schema is valid\\", function() { + pm.response.to.have.jsonSchema(schema,{unknownFormats: [\\"int32\\", \\"int64\\", \\"float\\", \\"double\\"]}); +}); +", +] +`; + +exports[`testResponseJsonSchema should add test for valid json schema v7 1`] = ` +Array [ + "// Response Validation +const schema = {\\"$id\\":\\"https://developers.apideck.com/GetCompanyResponse.json\\",\\"$schema\\":\\"http://json-schema.org/draft-07/schema#\\",\\"x-graphql-type-name\\":\\"company\\",\\"type\\":\\"object\\",\\"required\\":[\\"status_code\\",\\"status\\",\\"service\\",\\"resource\\",\\"operation\\",\\"data\\"],\\"properties\\":{\\"status_code\\":{\\"type\\":\\"integer\\",\\"description\\":\\"HTTP Response Status Code\\"},\\"status\\":{\\"type\\":\\"string\\",\\"description\\":\\"HTTP Response Status\\"},\\"service\\":{\\"type\\":\\"string\\",\\"description\\":\\"Apideck ID of service provider\\"},\\"resource\\":{\\"type\\":\\"string\\",\\"description\\":\\"Unified API resource name\\"},\\"operation\\":{\\"type\\":\\"string\\",\\"description\\":\\"Operation performed\\"},\\"data\\":{\\"type\\":\\"object\\",\\"required\\":[\\"name\\"],\\"additionalProperties\\":false,\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"name\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"interaction_count\\":{\\"type\\":[\\"integer\\",\\"null\\"]},\\"owner_id\\":{\\"type\\":\\"string\\"},\\"image_url\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"description\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"vat_number\\":{\\"description\\":\\"VAT number\\",\\"type\\":[\\"string\\",\\"null\\"]},\\"currency\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"status\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"minLength\\":1},\\"fax\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"bank_accounts\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"properties\\":{\\"iban\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"bic\\":{\\"type\\":[\\"string\\",\\"null\\"]}}}},\\"websites\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"required\\":[\\"url\\"],\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"url\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"WebsiteType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"work\\",\\"personal\\",\\"other\\"]}}}},\\"addresses\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"AddressType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"home\\",\\"office\\",\\"shipping\\",\\"billing\\",\\"other\\"]},\\"name\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"line1\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Line 1 of the address e.g. number, street, suite, apt #, etc.\\"},\\"line2\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Line 2 of the address\\"},\\"city\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Name of city.\\"},\\"state\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Name of state\\"},\\"postal_code\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"Zip code or equivalent.\\"},\\"country\\":{\\"type\\":[\\"string\\",\\"null\\"],\\"description\\":\\"country code according to ISO 3166-1 alpha-2.\\"},\\"latitude\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"longitude\\":{\\"type\\":[\\"string\\",\\"null\\"]}}}},\\"social_links\\":{\\"type\\":\\"array\\",\\"items\\":{\\"required\\":[\\"url\\"],\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"url\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"type\\":{\\"type\\":[\\"string\\",\\"null\\"]}}}},\\"phone_numbers\\":{\\"type\\":\\"array\\",\\"items\\":{\\"required\\":[\\"number\\"],\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"number\\":{\\"type\\":\\"string\\",\\"minLength\\":1},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"PhoneType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"home\\",\\"office\\",\\"mobile\\",\\"assistant\\",\\"fax\\",\\"other\\"]}}}},\\"emails\\":{\\"type\\":\\"array\\",\\"items\\":{\\"required\\":[\\"email\\"],\\"type\\":\\"object\\",\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"email\\":{\\"type\\":\\"string\\",\\"format\\":\\"email\\",\\"minLength\\":1},\\"type\\":{\\"type\\":\\"string\\",\\"x-graphql-type-name\\":\\"EmailType\\",\\"enum\\":[\\"primary\\",\\"secondary\\",\\"work\\",\\"personal\\",\\"billing\\",\\"other\\"]}}}},\\"custom_fields\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"object\\",\\"required\\":[\\"id\\"],\\"additionalProperties\\":false,\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"value\\":{\\"anyOf\\":[{\\"type\\":[\\"string\\",\\"null\\"]},{\\"type\\":[\\"number\\",\\"null\\"]},{\\"type\\":[\\"boolean\\",\\"null\\"]},{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"string\\"}}]}}}},\\"tags\\":{\\"type\\":\\"array\\",\\"items\\":{\\"type\\":\\"string\\"}},\\"updated_by\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"created_by\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"updated_at\\":{\\"type\\":\\"string\\"},\\"created_at\\":{\\"type\\":\\"string\\"}}}}} + +// Validate if response matches JSON schema +pm.test(\\"[GET]::/crm/companies/:id - Schema is valid\\", function() { + pm.response.to.have.jsonSchema(schema,{unknownFormats: [\\"int32\\", \\"int64\\", \\"float\\", \\"double\\"]}); +}); +", +] +`; + exports[`testResponseJsonSchema should add test with separator symbol for valid json schema 1`] = ` Array [ "// Response Validation @@ -151,6 +177,14 @@ console.log('GET]::/crm/companies/:id response is not being validated against yo ] `; +exports[`testResponseJsonSchema should skip test for invalid json schema v4 1`] = ` +Array [ + "// Response Validation - Disabled due to Invalid JSON Schema +console.log('GET]::/crm/companies/:id response is not being validated against your spec!'); +", +] +`; + exports[`testResponseJsonSchema should skip test for json schema with $ref 1`] = ` Array [ "// Response Validation - Disabled due to Circular Reference diff --git a/src/application/tests/testJsonSchema.ts b/src/application/tests/testJsonSchema.ts new file mode 100644 index 00000000..9bcd2f9a --- /dev/null +++ b/src/application/tests/testJsonSchema.ts @@ -0,0 +1,22 @@ +import Ajv from 'ajv' +import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' + +interface jsonSchemaTest { + validJsonSchema: boolean + error?: unknown +} + +export const testJsonSchema = ( + jsonSchema: OpenAPIV3.SchemaObject | OpenAPIV3_1.SchemaObject +): jsonSchemaTest => { + const validJsonSchema: jsonSchemaTest = { validJsonSchema: true } + try { + const ajv = new Ajv({ allErrors: true, strict: false, logger: false }) + ajv.compile(jsonSchema) + } catch (e) { + validJsonSchema.validJsonSchema = false + validJsonSchema.error = e + } + + return validJsonSchema +} diff --git a/src/application/tests/testJsonSchemav4.ts b/src/application/tests/testJsonSchemav4.ts new file mode 100644 index 00000000..2b5997cd --- /dev/null +++ b/src/application/tests/testJsonSchemav4.ts @@ -0,0 +1,20 @@ +import Ajv from 'ajv-draft-04' +import { OpenAPIV3_1 } from 'openapi-types' + +interface jsonSchemaTest { + validJsonSchema: boolean + error?: unknown +} + +export const testJsonSchemav4 = (jsonSchema: OpenAPIV3_1.SchemaObject): jsonSchemaTest => { + const validJsonSchema: jsonSchemaTest = { validJsonSchema: true } + try { + const ajv = new Ajv({ allErrors: true, strict: false, logger: false }) + ajv.compile(jsonSchema) + } catch (e) { + validJsonSchema.validJsonSchema = false + validJsonSchema.error = e + } + + return validJsonSchema +} diff --git a/src/application/tests/testResponseJsonSchema.test.ts b/src/application/tests/testResponseJsonSchema.test.ts index e93cfed2..4933708e 100644 --- a/src/application/tests/testResponseJsonSchema.test.ts +++ b/src/application/tests/testResponseJsonSchema.test.ts @@ -1,5 +1,8 @@ -import { OpenAPIV3 } from 'openapi-types' -import { getOasMappedOperation } from '../../../__tests__/testUtils/getOasMappedOperation' +import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' +import { + getOasMappedOperation, + getOasV31MappedOperation +} from '../../../__tests__/testUtils/getOasMappedOperation' import { getPostmanMappedOperation } from '../../../__tests__/testUtils/getPostmanMappedOperation' import { convertUnsupportedJsonSchemaProperties, testResponseJsonSchema } from '../../application' import { OasMappedOperation } from '../../oas' @@ -8,10 +11,12 @@ import { ContractTestConfig, GlobalConfig } from '../../types' describe('testResponseJsonSchema', () => { let oasOperation: OasMappedOperation + let oas31Operation: OasMappedOperation let pmOperation: PostmanMappedOperation beforeEach(async () => { oasOperation = await getOasMappedOperation() + oas31Operation = await getOasV31MappedOperation() pmOperation = await getPostmanMappedOperation() }) @@ -28,6 +33,40 @@ describe('testResponseJsonSchema', () => { expect(pmTest.script.exec).toMatchSnapshot() }) + it('should add test for valid json schema v4', async () => { + const response = ( + oas31Operation.schema?.responses?.['200'] as unknown as OpenAPIV3_1.ResponsesObject + )?.content + const schema = response?.['application/json'].schema + schema.$schema = 'http://json-schema.org/draft-04/schema#' + + pmOperation = testResponseJsonSchema( + { enabled: true } as ContractTestConfig, + schema, + pmOperation, + oasOperation + ) + const pmTest = pmOperation.getTests() + expect(pmTest.script.exec).toMatchSnapshot() + }) + + it('should add test for valid json schema v7', async () => { + const response = ( + oas31Operation.schema?.responses?.['200'] as unknown as OpenAPIV3_1.ResponsesObject + )?.content + const schema = response?.['application/json'].schema + schema.$schema = 'http://json-schema.org/draft-07/schema#' + + pmOperation = testResponseJsonSchema( + { enabled: true } as ContractTestConfig, + schema, + pmOperation, + oasOperation + ) + const pmTest = pmOperation.getTests() + expect(pmTest.script.exec).toMatchSnapshot() + }) + it('should add test with separator symbol for valid json schema', async () => { const globalConfig = { separatorSymbol: '==' } as GlobalConfig const schema = (oasOperation.schema?.responses?.['200'] as OpenAPIV3.ResponseObject)?.content @@ -89,6 +128,33 @@ describe('testResponseJsonSchema', () => { expect(pmTest.script.exec).toMatchSnapshot() }) + it('should skip test for invalid json schema v4', async () => { + const schema = { + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'array', + maxItems: 100, + items: { + typess: ['object', 'null'], + required: ['id', 'name'], + properties: { + id: { type: 'integer', format: 'int64' }, + name: { type: 'string' }, + tag: { type: 'string' } + }, + type: [null, 'null'] + } + } + + pmOperation = testResponseJsonSchema( + {} as ContractTestConfig, + schema, + pmOperation, + oasOperation + ) + const pmTest = pmOperation.getTests() + expect(pmTest.script.exec).toMatchSnapshot() + }) + it('should add extra unknown formats', async () => { const schema = (oasOperation.schema?.responses?.['200'] as OpenAPIV3.ResponseObject)?.content pmOperation = testResponseJsonSchema( diff --git a/src/application/tests/testResponseJsonSchema.ts b/src/application/tests/testResponseJsonSchema.ts index 6903277a..7242342e 100644 --- a/src/application/tests/testResponseJsonSchema.ts +++ b/src/application/tests/testResponseJsonSchema.ts @@ -1,10 +1,11 @@ +import { testJsonSchema } from './testJsonSchema' +import { testJsonSchemav4 } from './testJsonSchemav4' import { writeOperationTestScript } from '../../application' import { OasMappedOperation } from '../../oas' import { PostmanMappedOperation } from '../../postman' import { additionalProperties, ContractTestConfig, GlobalConfig } from 'types' import traverse from 'neotraverse/legacy' import { OpenAPIV3 } from 'openapi-types' -import Ajv from 'ajv' import chalk from 'chalk' export const testResponseJsonSchema = ( @@ -32,17 +33,21 @@ export const testResponseJsonSchema = ( // Validate jsonSchema with AJV let validJsonSchema = true - try { - const ajv = new Ajv({ allErrors: true, strict: false, logger: false }) - ajv.compile(jsonSchema) - } catch (e) { - validJsonSchema = false - // When invalid JSON schema, show a warning during conversion + let validJsonSchemaTest + if (jsonSchema?.$schema === 'http://json-schema.org/draft-04/schema#') { + validJsonSchemaTest = testJsonSchemav4(jsonSchema) + validJsonSchema = validJsonSchemaTest.validJsonSchema + } else { + validJsonSchemaTest = testJsonSchema(jsonSchema) + validJsonSchema = validJsonSchemaTest.validJsonSchema + } + + if (validJsonSchemaTest.validJsonSchema === false) { console.log( chalk.red( `schemaValidation skipped for[${pmOperation.method.toUpperCase()}]${split}${ pmOperation.path - } ` + `${e.message}` + } ` + `${validJsonSchemaTest.error.message}` ) ) } diff --git a/src/oas/OasMappedOperation.test.ts b/src/oas/OasMappedOperation.test.ts index 49726854..a78f5bab 100644 --- a/src/oas/OasMappedOperation.test.ts +++ b/src/oas/OasMappedOperation.test.ts @@ -1,24 +1,36 @@ -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' import { OasMappedOperation, OpenApiParser } from '../oas' describe('OasMappedOperation', () => { let specOperation: OpenAPIV3.OperationObject + let specOperation31: OpenAPIV3_1.OperationObject let mappedOperation: OasMappedOperation + let mappedOperation31: OasMappedOperation const oasYml = '__tests__/fixtures/crm.yml' + const oas31Yml = '__tests__/fixtures/crm31.yml' const parser = new OpenApiParser() + const parser31 = new OpenApiParser() const path = '/crm/companies' const method = 'post' beforeEach(async () => { await parser.convert({ inputFile: oasYml }) - const paths = parser.oas?.paths + const paths = parser.oas?.paths as OpenAPIV3.PathsObject expect(paths).toBeDefined() - specOperation = Object.values(paths)?.[0]?.['post'] || {} + specOperation = Object.values(paths)?.[0]?.['post'] || ({} as OpenAPIV3.OperationObject) expect(specOperation).toBeDefined() mappedOperation = new OasMappedOperation(path, method, specOperation) + + await parser31.convert({ inputFile: oas31Yml }) + const paths31 = parser.oas?.paths as OpenAPIV3_1.PathsObject + expect(paths31).toBeDefined() + + specOperation31 = Object.values(paths31)?.[0]?.['post'] || {} + expect(specOperation31).toBeDefined() + mappedOperation31 = new OasMappedOperation(path, method, specOperation31) }) it(`should set itself up using operation and params`, () => { @@ -31,6 +43,12 @@ describe('OasMappedOperation', () => { expect(mappedOperation.id).not.toBeDefined() }) + it('should handle operationId not present in OpenAPI 3.1', () => { + const { operationId, ...operation } = specOperation31 + mappedOperation = new OasMappedOperation(path, method, operation) + expect(mappedOperation.id).not.toBeDefined() + }) + describe('requestBodySchema', () => { it('should have access to the requestBody for mediaType', () => { const mediaType = 'application/json' @@ -40,7 +58,10 @@ describe('OasMappedOperation', () => { it('should return null for unknown mediaType', () => { const mediaType = 'application/xml' - const requestBodySchema = mappedOperation.requestBodySchema(mediaType) + let requestBodySchema = mappedOperation.requestBodySchema(mediaType) + expect(requestBodySchema).not.toBeDefined() + + requestBodySchema = mappedOperation31.requestBodySchema(mediaType) expect(requestBodySchema).not.toBeDefined() }) @@ -52,5 +73,14 @@ describe('OasMappedOperation', () => { const requestBodySchema = mappedOperation.requestBodySchema(mediaType) expect(requestBodySchema).not.toBeDefined() }) + + it('should return null when no requestBody schema exists in OpenAPI 3.1', () => { + const mediaType = 'application/xml' + const { requestBody, ...operation } = specOperation31 + mappedOperation31 = new OasMappedOperation(path, method, operation) + + const requestBodySchema = mappedOperation31.requestBodySchema(mediaType) + expect(requestBodySchema).not.toBeDefined() + }) }) }) diff --git a/src/oas/OasMappedOperation.ts b/src/oas/OasMappedOperation.ts index c3c09e31..9a56dab3 100644 --- a/src/oas/OasMappedOperation.ts +++ b/src/oas/OasMappedOperation.ts @@ -1,4 +1,14 @@ -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPI, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' + +type requestBody = OpenAPIV3.RequestBodyObject | OpenAPIV3_1.RequestBodyObject +type responseObject = OpenAPIV3.ResponseObject | OpenAPIV3_1.ResponseObject +type schemaObject = + | OpenAPIV3.SchemaObject + | OpenAPIV3_1.SchemaObject + | OpenAPIV3.ReferenceObject + | OpenAPIV3_1.ReferenceObject +type operationObject = OpenAPIV3.OperationObject | OpenAPIV3_1.OperationObject +type parameterObject = OpenAPIV3.ParameterObject[] | OpenAPIV3_1.ParameterObject[] export interface IOasMappedOperation { id?: string @@ -6,13 +16,13 @@ export interface IOasMappedOperation { method: string pathRef: string tags: string[] - schema: OpenAPIV3.OperationObject - requestHeaders: OpenAPIV3.ParameterObject[] - pathParams: OpenAPIV3.ParameterObject[] - queryParams: OpenAPIV3.ParameterObject[] - cookieParams: OpenAPIV3.ParameterObject[] + schema: operationObject + requestHeaders: OpenAPI.Parameters + pathParams: OpenAPI.Parameters + queryParams: OpenAPI.Parameters + cookieParams: OpenAPI.Parameters - requestBody(): OpenAPIV3.RequestBodyObject | undefined + requestBody(): requestBody | undefined } export class OasMappedOperation implements IOasMappedOperation { @@ -21,15 +31,15 @@ export class OasMappedOperation implements IOasMappedOperation { public method: string public pathRef: string public tags: string[] - public requestHeaders: OpenAPIV3.ParameterObject[] - public pathParams: OpenAPIV3.ParameterObject[] - public queryParams: OpenAPIV3.ParameterObject[] - public cookieParams: OpenAPIV3.ParameterObject[] - public schema: OpenAPIV3.OperationObject + public requestHeaders: parameterObject + public pathParams: parameterObject + public queryParams: parameterObject + public cookieParams: parameterObject + public schema: operationObject public responseCodes: string[] - constructor(path: string, method: string, operation: OpenAPIV3.OperationObject) { - this.schema = { ...operation } + constructor(path: string, method: string, operation: operationObject) { + this.schema = { ...operation } as operationObject this.id = this.schema?.operationId this.method = method.toUpperCase() this.path = path @@ -42,30 +52,30 @@ export class OasMappedOperation implements IOasMappedOperation { this.tags = this.schema?.tags as string[] } - private mapParameters(paramIn: string): OpenAPIV3.ParameterObject[] { + private mapParameters(paramIn: string): parameterObject { if (!this.schema?.parameters) return [] return ( - (this.schema.parameters as OpenAPIV3.ParameterObject[]).filter( + (this.schema.parameters as parameterObject).filter( parameter => (parameter.in as string) === paramIn ) || [] ) } - requestBody(): OpenAPIV3.RequestBodyObject | undefined { - return this.schema?.requestBody as OpenAPIV3.RequestBodyObject + requestBody(): requestBody | undefined { + return this.schema?.requestBody as requestBody } - requestBodySchema(mediaType: string): OpenAPIV3.SchemaObject | undefined { + requestBodySchema(mediaType: string): schemaObject | undefined { const requestBody = this.requestBody() if (!requestBody || !requestBody?.content?.[mediaType]?.schema) return - return requestBody.content[mediaType].schema as OpenAPIV3.SchemaObject + return requestBody.content[mediaType].schema as schemaObject } private mapResponseCodes(): string[] { if (this?.schema?.responses) { - return Object.keys(this.schema?.responses as OpenAPIV3.ResponsesObject) + return Object.keys(this.schema?.responses as unknown as responseObject) } return [] } diff --git a/src/oas/OpenApiFormat.test.ts b/src/oas/OpenApiFormat.test.ts index b5585064..08cd1c64 100644 --- a/src/oas/OpenApiFormat.test.ts +++ b/src/oas/OpenApiFormat.test.ts @@ -4,17 +4,22 @@ import { changeCase } from 'openapi-format' describe('OpenApiFormat', () => { let oas: OpenAPI.Document + let oas31: OpenAPI.Document const oasFormatter = new OpenApiFormatter() + const oas31Formatter = new OpenApiFormatter() describe('filter', () => { beforeEach(async () => { const oasYml = '__tests__/fixtures/crm.yml' + const oas31Yml = '__tests__/fixtures/crm31.yml' const filterJson = '__tests__/fixtures/oas-format-filter.json' oas = await oasFormatter.filter({ inputFile: oasYml, filterFile: filterJson }) + oas31 = await oas31Formatter.filter({ inputFile: oas31Yml, filterFile: filterJson }) }) it('should filter an openapispec.yml and return an OpenAPI.Document', () => { expect(oas.info.title).toStrictEqual('CRM API') + expect(oas31.info.title).toStrictEqual('CRM API') expect(oas).toMatchSnapshot() }) }) diff --git a/src/oas/OpenApiFormat.ts b/src/oas/OpenApiFormat.ts index bfe9609b..bcc49ea9 100644 --- a/src/oas/OpenApiFormat.ts +++ b/src/oas/OpenApiFormat.ts @@ -1,4 +1,4 @@ -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPI } from 'openapi-types' import openapiFormat, { OpenAPIFilterOptions, OpenAPIFilterSet } from 'openapi-format' export interface IOpenApiFormatterConfig { @@ -8,9 +8,9 @@ export interface IOpenApiFormatterConfig { } export class OpenApiFormatter { - public oas: OpenAPIV3.Document + public oas: OpenAPI.Document - async filter(options: IOpenApiFormatterConfig): Promise { + async filter(options: IOpenApiFormatterConfig): Promise { const inputFilePath = options.inputFile const filterFilePath = options.filterFile const filterOptions = {} as OpenAPIFilterOptions @@ -18,7 +18,7 @@ export class OpenApiFormatter { // Load OpenAPI file this.oas = (await openapiFormat.parseFile(inputFilePath, { bundle: true - })) as unknown as OpenAPIV3.Document + })) as unknown as OpenAPI.Document // Load filter file const filterSet = (await openapiFormat.parseFile(filterFilePath)) as OpenAPIFilterSet @@ -26,7 +26,7 @@ export class OpenApiFormatter { // Filter OpenAPI file const resFilter = await openapiFormat.openapiFilter(this.oas, filterOptions) - this.oas = resFilter.data as OpenAPIV3.Document + this.oas = resFilter.data as OpenAPI.Document // Write filtered OpenAPI file as YAML if (options.outputFile) { diff --git a/src/oas/OpenApiParser.test.ts b/src/oas/OpenApiParser.test.ts index c4848e73..5e88d65d 100644 --- a/src/oas/OpenApiParser.test.ts +++ b/src/oas/OpenApiParser.test.ts @@ -3,21 +3,27 @@ import { OpenApiParser } from './OpenApiParser' describe('OpenApiParser', () => { let oas: OpenAPI.Document + let oas31: OpenAPI.Document const oasParser = new OpenApiParser() + const oasParser31 = new OpenApiParser() // Happy Path for OAS Parsing describe('convert', () => { beforeEach(async () => { const oasYml = '__tests__/fixtures/crm.yml' + const oas31Yml = '__tests__/fixtures/crm31.yml' oas = await oasParser.convert({ inputFile: oasYml }) + oas31 = await oasParser31.convert({ inputFile: oas31Yml }) }) it('should parse an openapispec.yml and return an OpenAPI.Document', () => { expect(oas.info.title).toStrictEqual('CRM API') + expect(oas31.info.title).toStrictEqual('CRM API') expect(oas).toMatchSnapshot() }) it(`provides an public instance to it's OpenApiSpec`, () => { expect(oasParser.oas.info.title).toStrictEqual('CRM API') + expect(oasParser31.oas.info.title).toStrictEqual('CRM API') }) }) @@ -26,11 +32,18 @@ describe('OpenApiParser', () => { const operation = oasParser.getOperationById('usersAll') expect(operation?.id).toStrictEqual('usersAll') expect(operation?.schema).toMatchSnapshot() + + const operation31 = oasParser31.getOperationById('usersAll') + expect(operation31?.id).toStrictEqual('usersAll') + expect(operation31?.schema).toMatchSnapshot() }) it('should be fail gracefully if not found', async () => { const operation = oasParser.getOperationById('notAnOperation') expect(operation).toStrictEqual(null) + + const operation31 = oasParser31.getOperationById('notAnOperation') + expect(operation31).toStrictEqual(null) }) }) @@ -39,17 +52,28 @@ describe('OpenApiParser', () => { const operation = oasParser.getOperationByPath('GET::/crm/companies/{id}') expect(operation?.id).toStrictEqual('companiesOne') expect(operation?.schema).toMatchSnapshot() + + const operation31 = oasParser31.getOperationByPath('GET::/crm/companies/{id}') + expect(operation31?.id).toStrictEqual('companiesOne') + expect(operation31?.schema).toMatchSnapshot() }) it('should be able to retrieve a OasMappedOperation by pathRef with path param', async () => { const operation = oasParser.getOperationByPath('POST::/crm/companies') expect(operation?.id).toStrictEqual('companiesAdd') expect(operation?.schema).toMatchSnapshot() + + const operation31 = oasParser31.getOperationByPath('POST::/crm/companies') + expect(operation31?.id).toStrictEqual('companiesAdd') + expect(operation31?.schema).toMatchSnapshot() }) it('should be fail gracefully if not found', async () => { const operation = oasParser.getOperationByPath('GET::/crm/notAResource') expect(operation).toStrictEqual(null) + + const operation31 = oasParser31.getOperationByPath('GET::/crm/notAResource') + expect(operation31).toStrictEqual(null) }) }) @@ -57,11 +81,17 @@ describe('OpenApiParser', () => { it('should be able to retrieve OasMappedOperations by operationIds', async () => { const operations = oasParser.getOperationsByIds(['usersAll', 'companiesOne']) expect(operations.map(({ id }) => id)).toEqual(['companiesOne', 'usersAll']) + + const operations31 = oasParser31.getOperationsByIds(['usersAll', 'companiesOne']) + expect(operations31.map(({ id }) => id)).toEqual(['companiesOne', 'usersAll']) }) it('should be fail gracefully if not found', async () => { const operations = oasParser.getOperationsByIds(['notAnOperation']) expect(operations).toStrictEqual([]) + + const operations31 = oasParser31.getOperationsByIds(['notAnOperation']) + expect(operations31).toStrictEqual([]) }) }) @@ -69,6 +99,9 @@ describe('OpenApiParser', () => { it('should be able to retrieve OasMappedOperations by pathRef', async () => { const operations = oasParser.getOperationsByPath('GET::/crm/companies') expect(operations.map(({ id }) => id)).toEqual(['companiesAll']) + + const operations31 = oasParser31.getOperationsByPath('GET::/crm/companies') + expect(operations31.map(({ id }) => id)).toEqual(['companiesAll']) }) it('should be able to retrieve OasMappedOperations via wildcarded pathRef', async () => { @@ -78,11 +111,21 @@ describe('OpenApiParser', () => { 'companiesUpdate', 'companiesDelete' ]) + + const operations31 = oasParser31.getOperationsByPath('*::/crm/companies/*') + expect(operations31.map(({ id }) => id)).toEqual([ + 'companiesOne', + 'companiesUpdate', + 'companiesDelete' + ]) }) it('should be able to retrieve OasMappedOperations by pathRef with wildcard method', async () => { const operations = oasParser.getOperationsByPath('*::/crm/companies') expect(operations.map(({ id }) => id)).toEqual(['companiesAll', 'companiesAdd']) + + const operations31 = oasParser31.getOperationsByPath('*::/crm/companies') + expect(operations31.map(({ id }) => id)).toEqual(['companiesAll', 'companiesAdd']) }) }) }) diff --git a/src/oas/OpenApiParser.ts b/src/oas/OpenApiParser.ts index 0d810502..7cc1a460 100644 --- a/src/oas/OpenApiParser.ts +++ b/src/oas/OpenApiParser.ts @@ -1,5 +1,5 @@ import SwaggerParser from '@apidevtools/swagger-parser' -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPI, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types' import path from 'path' import { matchPath, METHODS } from '../utils' import { OasMappedOperation } from './OasMappedOperation' @@ -10,7 +10,7 @@ export interface OpenApiParserConfig { } export interface IOpenApiParser { - oas: OpenAPIV3.Document + oas: OpenAPI.Document mappedOperations: OasMappedOperation[] operationIdMap: Record getOperationById(operationId: string): OasMappedOperation | null @@ -18,11 +18,11 @@ export interface IOpenApiParser { } export class OpenApiParser { - public oas: OpenAPIV3.Document + public oas: OpenAPI.Document public mappedOperations: OasMappedOperation[] public operationIdMap: Record - async convert(options: OpenApiParserConfig): Promise { + async convert(options: OpenApiParserConfig): Promise { const inputFile = path.resolve(options.inputFile) const ignoreCircularRefs = !!options.ignoreCircularRefs ?? false @@ -46,7 +46,7 @@ export class OpenApiParser { validate: { spec: false // Don't validate against the Swagger spec } - })) as OpenAPIV3.Document + })) as OpenAPI.Document this.oas = oasDoc this.pathsToOperations() @@ -55,7 +55,7 @@ export class OpenApiParser { } pathsToOperations = (): OasMappedOperation[] => { - const paths = this.oas.paths as OpenAPIV3.PathsObject + const paths = this.oas.paths as OpenAPIV3.PathsObject | OpenAPIV3_1.PathsObject // Merge path parameters with operation parameters Object.entries(paths).map(path => { @@ -75,7 +75,11 @@ export class OpenApiParser { return ( operations && Object.entries(operations).map(([method, operation]): OasMappedOperation => { - return new OasMappedOperation(path, method, operation as OpenAPIV3.OperationObject) + return new OasMappedOperation( + path, + method, + operation as OpenAPIV3.OperationObject | OpenAPIV3_1.OperationObject + ) }) ) }) diff --git a/src/oas/__snapshots__/OpenApiParser.test.ts.snap b/src/oas/__snapshots__/OpenApiParser.test.ts.snap index 26843059..0731bf43 100644 --- a/src/oas/__snapshots__/OpenApiParser.test.ts.snap +++ b/src/oas/__snapshots__/OpenApiParser.test.ts.snap @@ -40516,10 +40516,10 @@ Object { } `; -exports[`OpenApiParser getOperationByPath should be able to retrieve a OasMappedOperation by pathRef with path param 1`] = ` +exports[`OpenApiParser getOperationById should be able to retrieve a OasMappedOperation by operationId 2`] = ` Object { - "description": "Create company", - "operationId": "companiesAdd", + "description": "List users", + "operationId": "usersAll", "parameters": Array [ Object { "description": "Include raw response. Mostly used for debugging purposes", @@ -40556,390 +40556,2474 @@ Object { "type": "string", }, }, + Object { + "description": "Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.", + "in": "query", + "name": "cursor", + "schema": Object { + "default": null, + "nullable": true, + "type": "string", + }, + }, + Object { + "description": "Number of records to return", + "in": "query", + "name": "limit", + "schema": Object { + "default": 20, + "maximum": 200, + "minimum": 1, + "type": "integer", + }, + }, ], - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "additionalProperties": false, - "properties": Object { - "addresses": Object { - "items": Object { - "properties": Object { - "city": Object { - "description": "Name of city.", - "example": "San Francisco", - "nullable": true, - "type": "string", - }, - "country": Object { - "description": "country code according to ISO 3166-1 alpha-2.", - "example": "US", - "nullable": true, - "type": "string", - }, - "id": Object { - "example": "123", - "nullable": true, - "type": "string", - }, - "latitude": Object { - "example": "40.759211", - "nullable": true, - "type": "string", - }, - "line1": Object { - "description": "Line 1 of the address e.g. number, street, suite, apt #, etc.", - "example": "Main street", - "nullable": true, - "type": "string", - }, - "line2": Object { - "description": "Line 2 of the address", - "example": "apt #", - "nullable": true, - "type": "string", - }, - "longitude": Object { - "example": "-73.984638", - "nullable": true, - "type": "string", - }, - "name": Object { - "example": "HQ US", - "nullable": true, - "type": "string", - }, - "postal_code": Object { - "description": "Zip code or equivalent.", - "example": "94104", - "nullable": true, - "type": "string", - }, - "state": Object { - "description": "Name of state", - "example": "CA", - "nullable": true, - "type": "string", - }, - "type": Object { - "enum": Array [ - "primary", - "secondary", - "home", - "office", - "shipping", - "billing", - "other", - ], - "example": "primary", - "type": "string", - "x-graphql-type-name": "AddressType", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$id": "https://developers.apideck.com/GetUsers.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": Object { + "data": Object { + "items": Object { + "properties": Object { + "created_at": Object { + "example": "2017-08-12T20:43:21.291Z", + "readOnly": true, + "type": "string", + }, + "email": Object { + "example": "elon@musk.com", + "format": "email", + "minLength": 1, + "type": "string", + }, + "first_name": Object { + "example": "Elon", + "nullable": true, + "type": "string", + }, + "id": Object { + "example": "12345", + "readOnly": true, + "type": "string", + }, + "image": Object { + "example": "https://logo.dev/spacex.com?s=128", + "nullable": true, + "type": "string", + }, + "language": Object { + "example": "EN", + "nullable": true, + "type": "string", + }, + "last_name": Object { + "example": "Musk", + "nullable": true, + "type": "string", + }, + "parent_id": Object { + "example": "54321", + "nullable": true, + "type": "string", + }, + "password": Object { + "example": "supersecretpassword", + "type": "string", + "writeOnly": true, + }, + "status": Object { + "example": "active", + "nullable": true, + "type": "string", + }, + "updated_at": Object { + "example": "2017-08-12T20:43:21.291Z", + "readOnly": true, + "type": "string", + }, + "username": Object { + "example": "masterofcoin", + "nullable": true, + "type": "string", + }, }, + "required": Array [ + "email", + ], + "x-pii": Array [ + "username", + "first_name", + "last_name", + "email", + ], }, - "type": "object", + "type": "array", }, - "type": "array", - }, - "bank_accounts": Object { - "items": Object { + "links": Object { + "description": "Links to navigate to previous or next pages through the API", "properties": Object { - "bic": Object { - "example": "AUDSCHGGXXX", + "current": Object { + "description": "Link to navigate to the current page through the API", + "example": "https://unify.apideck.com/crm/companies", + "type": "string", + }, + "next": Object { + "description": "Link to navigate to the previous page through the API", + "example": "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM", "nullable": true, "type": "string", }, - "iban": Object { - "example": "CH2989144532982975332", + "previous": Object { + "description": "Link to navigate to the previous page through the API", + "example": "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D", "nullable": true, "type": "string", }, }, "type": "object", }, - "type": "array", - }, - "created_at": Object { - "example": "2020-09-30T07:43:32.000Z", - "readOnly": true, - "type": "string", - }, - "created_by": Object { - "example": "12345", - "nullable": true, - "readOnly": true, - "type": "string", - }, - "currency": Object { - "example": "USD", - "nullable": true, - "type": "string", - }, - "custom_fields": Object { - "items": Object { - "additionalProperties": false, + "meta": Object { + "description": "Reponse metadata", "properties": Object { - "id": Object { - "example": "custom_technologies", - "type": "string", - }, - "value": Object { - "anyOf": Array [ - Object { - "example": "Uses Salesforce and Marketo", + "cursors": Object { + "description": "Cursors to navigate to previous or next pages through the API", + "properties": Object { + "current": Object { + "description": "Cursor to navigate to the current page of results through the API", + "example": "em9oby1jcm06OnBhZ2U6OjI=", "nullable": true, "type": "string", }, - Object { - "example": 10, + "next": Object { + "description": "Cursor to navigate to the next page of results through the API", + "example": "em9oby1jcm06OnBhZ2U6OjM=", "nullable": true, - "type": "number", + "type": "string", }, - Object { - "example": true, + "previous": Object { + "description": "Cursor to navigate to the previous page of results through the API", + "example": "em9oby1jcm06OnBhZ2U6OjE=", "nullable": true, - "type": "boolean", + "type": "string", + }, + }, + "type": "object", + }, + "items_on_page": Object { + "description": "Number of items returned in the data property of the response", + "example": 50, + "type": "integer", + }, + }, + "type": "object", + }, + "operation": Object { + "description": "Operation performed", + "example": "one", + "type": "string", + }, + "resource": Object { + "description": "Unified API resource name", + "example": "users", + "type": "string", + }, + "service": Object { + "description": "Apideck ID of service provider", + "example": "zoho-crm", + "type": "string", + }, + "status": Object { + "description": "HTTP Response Status", + "example": "OK", + "type": "string", + }, + "status_code": Object { + "description": "HTTP Response Status Code", + "example": 200, + "type": "integer", + }, + }, + "required": Array [ + "status_code", + "status", + "service", + "resource", + "operation", + "data", + ], + "type": "object", + "x-graphql-type-name": "UserList", + }, + }, + }, + "description": "Users", + }, + "400": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Missing property foobar", + "type": "string", + }, + Object { + "example": Object { + "missing": Array [ + Array [ + Object { + "foobar": "required", + }, + ], + ], + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Bad Request", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid Params", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#requestbodyvalidationerror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 400, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestHeadersValidationError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Bad Request", + }, + "401": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "Failed to generate valid JWT Session. Verify applicationId is correct", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Unauthorized", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Unauthorized Request", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#unauthorizederror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 401, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "UnauthorizedError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unauthorized", + }, + "402": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "You have reached your limit of 2000", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Payment Required", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Request Limit Reached", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#requestlimiterror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 402, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestLimitError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Payment Required", + }, + "404": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$id": "https://developers.apideck.com/NotFound.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Could not find widget with id: '123'", + "type": "string", + }, + Object { + "example": Object { + "not_found": Object { + "entity": "widget", + "id": "123", + }, + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Not Found", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Unknown Widget", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#entitynotfounderror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 404, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "EntityNotFoundError", + "type": "string", + }, + }, + }, + }, + }, + "description": "The specified resource was not found", + }, + "422": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "State did not include unified_api", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Unprocessable Entity", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid State", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#invalidstateerror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 422, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "InvalidStateError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unprocessable", + }, + "default": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Missing Header: x-apideck-consumer-id", + "type": "string", + }, + Object { + "example": Object { + "missing": Array [ + Array [ + Object { + "x-apideck-consumer-id": "required", + }, + ], + ], + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Bad Request", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid Params", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#unauthorizederror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 400, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestHeadersValidationError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unexpected error", + }, + }, + "security": Array [ + Object { + "apiKey": Array [], + }, + ], + "summary": "List users", + "tags": Array [ + "Users", + ], + "x-graphql-field-name": "users", +} +`; + +exports[`OpenApiParser getOperationByPath should be able to retrieve a OasMappedOperation by pathRef with path param 1`] = ` +Object { + "description": "Create company", + "operationId": "companiesAdd", + "parameters": Array [ + Object { + "description": "Include raw response. Mostly used for debugging purposes", + "in": "query", + "name": "raw", + "schema": Object { + "default": true, + "type": "boolean", + }, + }, + Object { + "description": "ID of the consumer which you want to get or push data from", + "in": "header", + "name": "x-apideck-consumer-id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "The ID of your Unify application", + "in": "header", + "name": "x-apideck-app-id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Provide the service id you want to call (e.g., pipedrive). [See the full list in the connector section.](#section/Connectors) Only needed when a consumer has activated multiple integrations for a Unified API.", + "in": "header", + "name": "x-apideck-service-id", + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "additionalProperties": false, + "properties": Object { + "addresses": Object { + "items": Object { + "properties": Object { + "city": Object { + "description": "Name of city.", + "example": "San Francisco", + "nullable": true, + "type": "string", + }, + "country": Object { + "description": "country code according to ISO 3166-1 alpha-2.", + "example": "US", + "nullable": true, + "type": "string", + }, + "id": Object { + "example": "123", + "nullable": true, + "type": "string", + }, + "latitude": Object { + "example": "40.759211", + "nullable": true, + "type": "string", + }, + "line1": Object { + "description": "Line 1 of the address e.g. number, street, suite, apt #, etc.", + "example": "Main street", + "nullable": true, + "type": "string", + }, + "line2": Object { + "description": "Line 2 of the address", + "example": "apt #", + "nullable": true, + "type": "string", + }, + "longitude": Object { + "example": "-73.984638", + "nullable": true, + "type": "string", + }, + "name": Object { + "example": "HQ US", + "nullable": true, + "type": "string", + }, + "postal_code": Object { + "description": "Zip code or equivalent.", + "example": "94104", + "nullable": true, + "type": "string", + }, + "state": Object { + "description": "Name of state", + "example": "CA", + "nullable": true, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "home", + "office", + "shipping", + "billing", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "AddressType", + }, + }, + "type": "object", + }, + "type": "array", + }, + "bank_accounts": Object { + "items": Object { + "properties": Object { + "bic": Object { + "example": "AUDSCHGGXXX", + "nullable": true, + "type": "string", + }, + "iban": Object { + "example": "CH2989144532982975332", + "nullable": true, + "type": "string", + }, + }, + "type": "object", + }, + "type": "array", + }, + "created_at": Object { + "example": "2020-09-30T07:43:32.000Z", + "readOnly": true, + "type": "string", + }, + "created_by": Object { + "example": "12345", + "nullable": true, + "readOnly": true, + "type": "string", + }, + "currency": Object { + "example": "USD", + "nullable": true, + "type": "string", + }, + "custom_fields": Object { + "items": Object { + "additionalProperties": false, + "properties": Object { + "id": Object { + "example": "custom_technologies", + "type": "string", + }, + "value": Object { + "anyOf": Array [ + Object { + "example": "Uses Salesforce and Marketo", + "nullable": true, + "type": "string", + }, + Object { + "example": 10, + "nullable": true, + "type": "number", + }, + Object { + "example": true, + "nullable": true, + "type": "boolean", + }, + Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + ], + }, + }, + "required": Array [ + "id", + ], + "type": "object", + }, + "type": "array", + }, + "description": Object { + "example": "A crm that works for you, so you can spend time on relationships instead of data.", + "nullable": true, + "type": "string", + }, + "emails": Object { + "items": Object { + "properties": Object { + "email": Object { + "example": "elon@musk.com", + "format": "email", + "minLength": 1, + "type": "string", + }, + "id": Object { + "example": "123", + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "work", + "personal", + "billing", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "EmailType", + }, + }, + "required": Array [ + "email", + ], + "type": "object", + }, + "type": "array", + }, + "fax": Object { + "example": "+12129876543", + "nullable": true, + "type": "string", + }, + "id": Object { + "example": "12345", + "readOnly": true, + "type": "string", + }, + "image_url": Object { + "example": "https://www.spacex.com/static/images/share.jpg", + "nullable": true, + "type": "string", + }, + "interaction_count": Object { + "example": 1, + "nullable": true, + "readOnly": true, + "type": "integer", + }, + "name": Object { + "example": "Copper", + "minLength": 1, + "type": "string", + }, + "owner_id": Object { + "example": "12345", + "type": "string", + }, + "phone_numbers": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "number": Object { + "example": "111-111-1111", + "minLength": 1, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "home", + "office", + "mobile", + "assistant", + "fax", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "PhoneType", + }, + }, + "required": Array [ + "number", + ], + "type": "object", + }, + "type": "array", + }, + "social_links": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "type": Object { + "example": "twitter", + "nullable": true, + "type": "string", + }, + "url": Object { + "example": "https://www.twitter.com/apideck-io", + "minLength": 1, + "type": "string", + }, + }, + "required": Array [ + "url", + ], + "type": "object", + }, + "type": "array", + }, + "status": Object { + "example": "Open", + "minLength": 1, + "nullable": true, + "type": "string", + }, + "tags": Object { + "example": Array [ + "New", + ], + "items": Object { + "type": "string", + }, + "type": "array", + }, + "updated_at": Object { + "example": "2020-09-30T07:43:32.000Z", + "readOnly": true, + "type": "string", + }, + "updated_by": Object { + "example": "12345", + "nullable": true, + "readOnly": true, + "type": "string", + }, + "vat_number": Object { + "description": "VAT number", + "example": "BE0689615164", + "nullable": true, + "type": "string", + }, + "websites": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "work", + "personal", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "WebsiteType", + }, + "url": Object { + "example": "http://example.com", + "minLength": 1, + "type": "string", + }, + }, + "required": Array [ + "url", + ], + "type": "object", + }, + "type": "array", + }, + }, + "required": Array [ + "name", + ], + "type": "object", + }, + }, + }, + "required": true, + }, + "responses": Object { + "201": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "data": Object { + "properties": Object { + "id": Object { + "example": "12345", + "readOnly": true, + "type": "string", + }, + }, + "required": Array [ + "id", + ], + "title": "UnifiedId", + }, + "operation": Object { + "description": "Operation performed", + "example": "one", + "type": "string", + }, + "resource": Object { + "description": "Unified API resource name", + "example": "companies", + "type": "string", + }, + "service": Object { + "description": "Apideck ID of service provider", + "example": "zoho-crm", + "type": "string", + }, + "status": Object { + "description": "HTTP Response Status", + "example": "OK", + "type": "string", + }, + "status_code": Object { + "description": "HTTP Response Status Code", + "example": 200, + "type": "integer", + }, + }, + "required": Array [ + "status_code", + "status", + "service", + "resource", + "operation", + "data", + ], + "type": "object", + }, + }, + }, + "description": "Company created", + }, + "400": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Missing property foobar", + "type": "string", + }, + Object { + "example": Object { + "missing": Array [ + Array [ + Object { + "foobar": "required", + }, + ], + ], + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Bad Request", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid Params", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#requestbodyvalidationerror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 400, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestHeadersValidationError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Bad Request", + }, + "401": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "Failed to generate valid JWT Session. Verify applicationId is correct", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Unauthorized", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Unauthorized Request", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#unauthorizederror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 401, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "UnauthorizedError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unauthorized", + }, + "402": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "You have reached your limit of 2000", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Payment Required", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Request Limit Reached", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#requestlimiterror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 402, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestLimitError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Payment Required", + }, + "404": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Could not find widget with id: '123'", + "type": "string", + }, + Object { + "example": Object { + "not_found": Object { + "entity": "widget", + "id": "123", + }, + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Not Found", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Unknown Widget", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#entitynotfounderror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 404, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "EntityNotFoundError", + "type": "string", + }, + }, + }, + }, + }, + "description": "The specified resource was not found", + }, + "422": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "State did not include unified_api", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Unprocessable Entity", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid State", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#invalidstateerror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 422, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "InvalidStateError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unprocessable", + }, + "default": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Missing Header: x-apideck-consumer-id", + "type": "string", + }, + Object { + "example": Object { + "missing": Array [ + Array [ + Object { + "x-apideck-consumer-id": "required", + }, + ], + ], + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Bad Request", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid Params", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#unauthorizederror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 400, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestHeadersValidationError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unexpected error", + }, + }, + "security": Array [ + Object { + "apiKey": Array [], + }, + ], + "summary": "Create company", + "tags": Array [ + "Companies", + ], +} +`; + +exports[`OpenApiParser getOperationByPath should be able to retrieve a OasMappedOperation by pathRef with path param 2`] = ` +Object { + "description": "Create company", + "operationId": "companiesAdd", + "parameters": Array [ + Object { + "description": "Include raw response. Mostly used for debugging purposes", + "in": "query", + "name": "raw", + "schema": Object { + "default": true, + "type": "boolean", + }, + }, + Object { + "description": "ID of the consumer which you want to get or push data from", + "in": "header", + "name": "x-apideck-consumer-id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "The ID of your Unify application", + "in": "header", + "name": "x-apideck-app-id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Provide the service id you want to call (e.g., pipedrive). [See the full list in the connector section.](#section/Connectors) Only needed when a consumer has activated multiple integrations for a Unified API.", + "in": "header", + "name": "x-apideck-service-id", + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "additionalProperties": false, + "properties": Object { + "addresses": Object { + "items": Object { + "properties": Object { + "city": Object { + "description": "Name of city.", + "example": "San Francisco", + "nullable": true, + "type": "string", + }, + "country": Object { + "description": "country code according to ISO 3166-1 alpha-2.", + "example": "US", + "nullable": true, + "type": "string", + }, + "id": Object { + "example": "123", + "nullable": true, + "type": "string", + }, + "latitude": Object { + "example": "40.759211", + "nullable": true, + "type": "string", + }, + "line1": Object { + "description": "Line 1 of the address e.g. number, street, suite, apt #, etc.", + "example": "Main street", + "nullable": true, + "type": "string", + }, + "line2": Object { + "description": "Line 2 of the address", + "example": "apt #", + "nullable": true, + "type": "string", + }, + "longitude": Object { + "example": "-73.984638", + "nullable": true, + "type": "string", + }, + "name": Object { + "example": "HQ US", + "nullable": true, + "type": "string", + }, + "postal_code": Object { + "description": "Zip code or equivalent.", + "example": "94104", + "nullable": true, + "type": "string", + }, + "state": Object { + "description": "Name of state", + "example": "CA", + "nullable": true, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "home", + "office", + "shipping", + "billing", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "AddressType", + }, + }, + "type": "object", + }, + "type": "array", + }, + "bank_accounts": Object { + "items": Object { + "properties": Object { + "bic": Object { + "example": "AUDSCHGGXXX", + "nullable": true, + "type": "string", + }, + "iban": Object { + "example": "CH2989144532982975332", + "nullable": true, + "type": "string", + }, + }, + "type": "object", + }, + "type": "array", + }, + "created_at": Object { + "example": "2020-09-30T07:43:32.000Z", + "readOnly": true, + "type": "string", + }, + "created_by": Object { + "example": "12345", + "nullable": true, + "readOnly": true, + "type": "string", + }, + "currency": Object { + "example": "USD", + "nullable": true, + "type": "string", + }, + "custom_fields": Object { + "items": Object { + "additionalProperties": false, + "properties": Object { + "id": Object { + "example": "custom_technologies", + "type": "string", + }, + "value": Object { + "anyOf": Array [ + Object { + "example": "Uses Salesforce and Marketo", + "nullable": true, + "type": "string", + }, + Object { + "example": 10, + "nullable": true, + "type": "number", + }, + Object { + "example": true, + "nullable": true, + "type": "boolean", + }, + Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + ], + }, + }, + "required": Array [ + "id", + ], + "type": "object", + }, + "type": "array", + }, + "description": Object { + "example": "A crm that works for you, so you can spend time on relationships instead of data.", + "nullable": true, + "type": "string", + }, + "emails": Object { + "items": Object { + "properties": Object { + "email": Object { + "example": "elon@musk.com", + "format": "email", + "minLength": 1, + "type": "string", + }, + "id": Object { + "example": "123", + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "work", + "personal", + "billing", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "EmailType", + }, + }, + "required": Array [ + "email", + ], + "type": "object", + }, + "type": "array", + }, + "fax": Object { + "example": "+12129876543", + "nullable": true, + "type": "string", + }, + "id": Object { + "example": "12345", + "readOnly": true, + "type": "string", + }, + "image_url": Object { + "example": "https://www.spacex.com/static/images/share.jpg", + "nullable": true, + "type": "string", + }, + "interaction_count": Object { + "example": 1, + "nullable": true, + "readOnly": true, + "type": "integer", + }, + "name": Object { + "example": "Copper", + "minLength": 1, + "type": "string", + }, + "owner_id": Object { + "example": "12345", + "type": "string", + }, + "phone_numbers": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "number": Object { + "example": "111-111-1111", + "minLength": 1, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "home", + "office", + "mobile", + "assistant", + "fax", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "PhoneType", + }, + }, + "required": Array [ + "number", + ], + "type": "object", + }, + "type": "array", + }, + "social_links": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "type": Object { + "example": "twitter", + "nullable": true, + "type": "string", + }, + "url": Object { + "example": "https://www.twitter.com/apideck-io", + "minLength": 1, + "type": "string", + }, + }, + "required": Array [ + "url", + ], + "type": "object", + }, + "type": "array", + }, + "status": Object { + "example": "Open", + "minLength": 1, + "nullable": true, + "type": "string", + }, + "tags": Object { + "example": Array [ + "New", + ], + "items": Object { + "type": "string", + }, + "type": "array", + }, + "updated_at": Object { + "example": "2020-09-30T07:43:32.000Z", + "readOnly": true, + "type": "string", + }, + "updated_by": Object { + "example": "12345", + "nullable": true, + "readOnly": true, + "type": "string", + }, + "vat_number": Object { + "description": "VAT number", + "example": "BE0689615164", + "nullable": true, + "type": "string", + }, + "websites": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "work", + "personal", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "WebsiteType", + }, + "url": Object { + "example": "http://example.com", + "minLength": 1, + "type": "string", + }, + }, + "required": Array [ + "url", + ], + "type": "object", + }, + "type": "array", + }, + }, + "required": Array [ + "name", + ], + "type": "object", + }, + }, + }, + "required": true, + }, + "responses": Object { + "201": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$id": "https://developers.apideck.com/CreateCompany.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": Object { + "data": Object { + "properties": Object { + "id": Object { + "example": "12345", + "readOnly": true, + "type": "string", + }, + }, + "required": Array [ + "id", + ], + "title": "UnifiedId", + }, + "operation": Object { + "description": "Operation performed", + "example": "one", + "type": "string", + }, + "resource": Object { + "description": "Unified API resource name", + "example": "companies", + "type": "string", + }, + "service": Object { + "description": "Apideck ID of service provider", + "example": "zoho-crm", + "type": "string", + }, + "status": Object { + "description": "HTTP Response Status", + "example": "OK", + "type": "string", + }, + "status_code": Object { + "description": "HTTP Response Status Code", + "example": 200, + "type": "integer", + }, + }, + "required": Array [ + "status_code", + "status", + "service", + "resource", + "operation", + "data", + ], + "type": "object", + }, + }, + }, + "description": "Company created", + }, + "400": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Missing property foobar", + "type": "string", + }, + Object { + "example": Object { + "missing": Array [ + Array [ + Object { + "foobar": "required", + }, + ], + ], + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Bad Request", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid Params", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#requestbodyvalidationerror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 400, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestHeadersValidationError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Bad Request", + }, + "401": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "Failed to generate valid JWT Session. Verify applicationId is correct", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Unauthorized", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Unauthorized Request", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#unauthorizederror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 401, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "UnauthorizedError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unauthorized", + }, + "402": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "You have reached your limit of 2000", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Payment Required", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Request Limit Reached", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#requestlimiterror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 402, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestLimitError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Payment Required", + }, + "404": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$id": "https://developers.apideck.com/NotFound.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Could not find widget with id: '123'", + "type": "string", + }, + Object { + "example": Object { + "not_found": Object { + "entity": "widget", + "id": "123", + }, + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Not Found", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Unknown Widget", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#entitynotfounderror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 404, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "EntityNotFoundError", + "type": "string", + }, + }, + }, + }, + }, + "description": "The specified resource was not found", + }, + "422": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "description": "Contains parameter or domain specific information related to the error and why it occured.", + "example": "State did not include unified_api", + "type": "string", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Unprocessable Entity", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid State", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#invalidstateerror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 422, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "InvalidStateError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unprocessable", + }, + "default": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "detail": Object { + "anyOf": Array [ + Object { + "example": "Missing Header: x-apideck-consumer-id", + "type": "string", + }, + Object { + "example": Object { + "missing": Array [ + Array [ + Object { + "x-apideck-consumer-id": "required", + }, + ], + ], + }, + "type": "object", + }, + ], + "description": "Contains parameter or domain specific information related to the error and why it occured.", + }, + "error": Object { + "description": "Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231)", + "example": "Bad Request", + "type": "string", + }, + "message": Object { + "description": "A human-readable message providing more details about the error.", + "example": "Invalid Params", + "type": "string", + }, + "ref": Object { + "description": "Link to documentation of error type", + "example": "https://developers.apideck.com/errors#unauthorizederror", + "type": "string", + }, + "status_code": Object { + "description": "HTTP status code", + "example": 400, + "type": "number", + }, + "typeName": Object { + "description": "The type of error returned", + "example": "RequestHeadersValidationError", + "type": "string", + }, + }, + }, + }, + }, + "description": "Unexpected error", + }, + }, + "security": Array [ + Object { + "apiKey": Array [], + }, + ], + "summary": "Create company", + "tags": Array [ + "Companies", + ], +} +`; + +exports[`OpenApiParser getOperationByPath should be able to retrieve a read OasMappedOperation by pathRef 1`] = ` +Object { + "description": "Get company", + "operationId": "companiesOne", + "parameters": Array [ + Object { + "description": "ID of the record you are acting upon.", + "in": "path", + "name": "id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Include raw response. Mostly used for debugging purposes", + "in": "query", + "name": "raw", + "schema": Object { + "default": true, + "type": "boolean", + }, + }, + Object { + "description": "ID of the consumer which you want to get or push data from", + "in": "header", + "name": "x-apideck-consumer-id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "The ID of your Unify application", + "in": "header", + "name": "x-apideck-app-id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Provide the service id you want to call (e.g., pipedrive). [See the full list in the connector section.](#section/Connectors) Only needed when a consumer has activated multiple integrations for a Unified API.", + "in": "header", + "name": "x-apideck-service-id", + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "data": Object { + "additionalProperties": false, + "properties": Object { + "addresses": Object { + "items": Object { + "properties": Object { + "city": Object { + "description": "Name of city.", + "example": "San Francisco", + "nullable": true, + "type": "string", + }, + "country": Object { + "description": "country code according to ISO 3166-1 alpha-2.", + "example": "US", + "nullable": true, + "type": "string", + }, + "id": Object { + "example": "123", + "nullable": true, + "type": "string", + }, + "latitude": Object { + "example": "40.759211", + "nullable": true, + "type": "string", + }, + "line1": Object { + "description": "Line 1 of the address e.g. number, street, suite, apt #, etc.", + "example": "Main street", + "nullable": true, + "type": "string", + }, + "line2": Object { + "description": "Line 2 of the address", + "example": "apt #", + "nullable": true, + "type": "string", + }, + "longitude": Object { + "example": "-73.984638", + "nullable": true, + "type": "string", + }, + "name": Object { + "example": "HQ US", + "nullable": true, + "type": "string", + }, + "postal_code": Object { + "description": "Zip code or equivalent.", + "example": "94104", + "nullable": true, + "type": "string", + }, + "state": Object { + "description": "Name of state", + "example": "CA", + "nullable": true, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "home", + "office", + "shipping", + "billing", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "AddressType", + }, }, - Object { - "items": Object { + "type": "object", + }, + "type": "array", + }, + "bank_accounts": Object { + "items": Object { + "properties": Object { + "bic": Object { + "example": "AUDSCHGGXXX", + "nullable": true, + "type": "string", + }, + "iban": Object { + "example": "CH2989144532982975332", + "nullable": true, "type": "string", }, - "type": "array", }, - ], + "type": "object", + }, + "type": "array", }, - }, - "required": Array [ - "id", - ], - "type": "object", - }, - "type": "array", - }, - "description": Object { - "example": "A crm that works for you, so you can spend time on relationships instead of data.", - "nullable": true, - "type": "string", - }, - "emails": Object { - "items": Object { - "properties": Object { - "email": Object { - "example": "elon@musk.com", - "format": "email", - "minLength": 1, + "created_at": Object { + "example": "2020-09-30T07:43:32.000Z", + "readOnly": true, "type": "string", }, - "id": Object { - "example": "123", + "created_by": Object { + "example": "12345", + "nullable": true, + "readOnly": true, "type": "string", }, - "type": Object { - "enum": Array [ - "primary", - "secondary", - "work", - "personal", - "billing", - "other", - ], - "example": "primary", + "currency": Object { + "example": "USD", + "nullable": true, "type": "string", - "x-graphql-type-name": "EmailType", }, - }, - "required": Array [ - "email", - ], - "type": "object", - }, - "type": "array", - }, - "fax": Object { - "example": "+12129876543", - "nullable": true, - "type": "string", - }, - "id": Object { - "example": "12345", - "readOnly": true, - "type": "string", - }, - "image_url": Object { - "example": "https://www.spacex.com/static/images/share.jpg", - "nullable": true, - "type": "string", - }, - "interaction_count": Object { - "example": 1, - "nullable": true, - "readOnly": true, - "type": "integer", - }, - "name": Object { - "example": "Copper", - "minLength": 1, - "type": "string", - }, - "owner_id": Object { - "example": "12345", - "type": "string", - }, - "phone_numbers": Object { - "items": Object { - "properties": Object { - "id": Object { - "example": "12345", + "custom_fields": Object { + "items": Object { + "additionalProperties": false, + "properties": Object { + "id": Object { + "example": "custom_technologies", + "type": "string", + }, + "value": Object { + "anyOf": Array [ + Object { + "example": "Uses Salesforce and Marketo", + "nullable": true, + "type": "string", + }, + Object { + "example": 10, + "nullable": true, + "type": "number", + }, + Object { + "example": true, + "nullable": true, + "type": "boolean", + }, + Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + ], + }, + }, + "required": Array [ + "id", + ], + "type": "object", + }, + "type": "array", + }, + "description": Object { + "example": "A crm that works for you, so you can spend time on relationships instead of data.", "nullable": true, "type": "string", }, - "number": Object { - "example": "111-111-1111", - "minLength": 1, - "type": "string", + "emails": Object { + "items": Object { + "properties": Object { + "email": Object { + "example": "elon@musk.com", + "format": "email", + "minLength": 1, + "type": "string", + }, + "id": Object { + "example": "123", + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "work", + "personal", + "billing", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "EmailType", + }, + }, + "required": Array [ + "email", + ], + "type": "object", + }, + "type": "array", }, - "type": Object { - "enum": Array [ - "primary", - "secondary", - "home", - "office", - "mobile", - "assistant", - "fax", - "other", - ], - "example": "primary", + "fax": Object { + "example": "+12129876543", + "nullable": true, "type": "string", - "x-graphql-type-name": "PhoneType", }, - }, - "required": Array [ - "number", - ], - "type": "object", - }, - "type": "array", - }, - "social_links": Object { - "items": Object { - "properties": Object { "id": Object { "example": "12345", - "nullable": true, + "readOnly": true, "type": "string", }, - "type": Object { - "example": "twitter", + "image_url": Object { + "example": "https://www.spacex.com/static/images/share.jpg", "nullable": true, "type": "string", }, - "url": Object { - "example": "https://www.twitter.com/apideck-io", + "interaction_count": Object { + "example": 1, + "nullable": true, + "readOnly": true, + "type": "integer", + }, + "name": Object { + "example": "Copper", "minLength": 1, "type": "string", }, - }, - "required": Array [ - "url", - ], - "type": "object", - }, - "type": "array", - }, - "status": Object { - "example": "Open", - "minLength": 1, - "nullable": true, - "type": "string", - }, - "tags": Object { - "example": Array [ - "New", - ], - "items": Object { - "type": "string", - }, - "type": "array", - }, - "updated_at": Object { - "example": "2020-09-30T07:43:32.000Z", - "readOnly": true, - "type": "string", - }, - "updated_by": Object { - "example": "12345", - "nullable": true, - "readOnly": true, - "type": "string", - }, - "vat_number": Object { - "description": "VAT number", - "example": "BE0689615164", - "nullable": true, - "type": "string", - }, - "websites": Object { - "items": Object { - "properties": Object { - "id": Object { + "owner_id": Object { "example": "12345", + "type": "string", + }, + "phone_numbers": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "number": Object { + "example": "111-111-1111", + "minLength": 1, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "home", + "office", + "mobile", + "assistant", + "fax", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "PhoneType", + }, + }, + "required": Array [ + "number", + ], + "type": "object", + }, + "type": "array", + }, + "social_links": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "type": Object { + "example": "twitter", + "nullable": true, + "type": "string", + }, + "url": Object { + "example": "https://www.twitter.com/apideck-io", + "minLength": 1, + "type": "string", + }, + }, + "required": Array [ + "url", + ], + "type": "object", + }, + "type": "array", + }, + "status": Object { + "example": "Open", + "minLength": 1, "nullable": true, "type": "string", }, - "type": Object { - "enum": Array [ - "primary", - "secondary", - "work", - "personal", - "other", + "tags": Object { + "example": Array [ + "New", ], - "example": "primary", - "type": "string", - "x-graphql-type-name": "WebsiteType", + "items": Object { + "type": "string", + }, + "type": "array", }, - "url": Object { - "example": "http://example.com", - "minLength": 1, + "updated_at": Object { + "example": "2020-09-30T07:43:32.000Z", + "readOnly": true, "type": "string", }, - }, - "required": Array [ - "url", - ], - "type": "object", - }, - "type": "array", - }, - }, - "required": Array [ - "name", - ], - "type": "object", - }, - }, - }, - "required": true, - }, - "responses": Object { - "201": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "data": Object { - "properties": Object { - "id": Object { + "updated_by": Object { "example": "12345", + "nullable": true, "readOnly": true, "type": "string", }, + "vat_number": Object { + "description": "VAT number", + "example": "BE0689615164", + "nullable": true, + "type": "string", + }, + "websites": Object { + "items": Object { + "properties": Object { + "id": Object { + "example": "12345", + "nullable": true, + "type": "string", + }, + "type": Object { + "enum": Array [ + "primary", + "secondary", + "work", + "personal", + "other", + ], + "example": "primary", + "type": "string", + "x-graphql-type-name": "WebsiteType", + }, + "url": Object { + "example": "http://example.com", + "minLength": 1, + "type": "string", + }, + }, + "required": Array [ + "url", + ], + "type": "object", + }, + "type": "array", + }, }, "required": Array [ - "id", + "name", ], - "title": "UnifiedId", + "type": "object", }, "operation": Object { "description": "Operation performed", @@ -40976,10 +43060,11 @@ Object { "data", ], "type": "object", + "x-graphql-type-name": "company", }, }, }, - "description": "Company created", + "description": "Company", }, "400": Object { "content": Object { @@ -41278,14 +43363,14 @@ Object { "apiKey": Array [], }, ], - "summary": "Create company", + "summary": "Get company", "tags": Array [ "Companies", ], } `; -exports[`OpenApiParser getOperationByPath should be able to retrieve a read OasMappedOperation by pathRef 1`] = ` +exports[`OpenApiParser getOperationByPath should be able to retrieve a read OasMappedOperation by pathRef 2`] = ` Object { "description": "Get company", "operationId": "companiesOne", @@ -41340,6 +43425,8 @@ Object { "content": Object { "application/json": Object { "schema": Object { + "$id": "https://developers.apideck.com/GetCompanyResponse.json", + "$schema": "http://json-schema.org/draft-07/schema#", "properties": Object { "data": Object { "additionalProperties": false, @@ -41883,6 +43970,8 @@ Object { "content": Object { "application/json": Object { "schema": Object { + "$id": "https://developers.apideck.com/NotFound.json", + "$schema": "http://json-schema.org/draft-07/schema#", "properties": Object { "detail": Object { "anyOf": Array [ diff --git a/src/services/OpenApiToPostmanService.ts b/src/services/OpenApiToPostmanService.ts index 61888cfe..b00649ac 100644 --- a/src/services/OpenApiToPostmanService.ts +++ b/src/services/OpenApiToPostmanService.ts @@ -1,18 +1,18 @@ import fs from 'fs-extra' import oaConverter from 'openapi-to-postmanv2' -import { OpenAPIV3 } from 'openapi-types' +import { OpenAPI } from 'openapi-types' import ora from 'ora' import path from 'path' export interface IOpenApiToPostmanConfig { inputFile?: string - openApiObj?: OpenAPIV3.Document + openApiObj?: OpenAPI.Document outputFile: string configFile: string } export class OpenApiToPostmanService { - openApiObj: OpenAPIV3.Document + openApiObj: OpenAPI.Document async convert(options: IOpenApiToPostmanConfig): Promise> { return await new Promise((resolve, reject) => { diff --git a/src/types/openapi-format.d.ts b/src/types/openapi-format.d.ts index 13c7a1aa..158d2ce4 100644 --- a/src/types/openapi-format.d.ts +++ b/src/types/openapi-format.d.ts @@ -1,7 +1,7 @@ // openapi-format.d.ts declare module 'openapi-format' { - import { OpenAPIV3 } from 'openapi-types' + import { OpenAPI } from 'openapi-types' interface OpenAPIFilterSet { methods?: string[] @@ -24,19 +24,19 @@ declare module 'openapi-format' { } interface OpenAPIResult { - data: OpenAPIV3.Document + data: OpenAPI.Document resultData: Record } /** * OpenAPI-format filter function * Traverse through all keys and based on the key name, filter the props according to the filter configuration. - * @param {OpenAPIV3.Document} oaObj OpenAPI document + * @param {OpenAPI.Document} oaObj OpenAPI document * @param {OpenAPIFilterOptions} options OpenAPI-format filter options * @returns {Promise} Filtered OpenAPI document */ export async function openapiFilter( - oaObj: OpenAPIV3.Document, + oaObj: OpenAPI.Document, options: OpenAPIFilterOptions ): Promise @@ -59,7 +59,7 @@ declare module 'openapi-format' { */ export async function writeFile( filePath: string, - data: Record | OpenAPIV3.Document, + data: Record | OpenAPI.Document, options: WriteFileOptions = {} ): Promise