feedback-api-sdk

Feedback

const feedbackController = new FeedbackController(client);

Class Name

FeedbackController

Methods

Create Feedback

Create a new feedback

You can explore sample payloads below. Every feedback must have at least one properties:

In addition, you may provide any of context values:

async createFeedback(
  body: FeedbackReq,
  requestOptions?: RequestOptions
): Promise<ApiResponse<Feedback>>

Parameters

Parameter Type Tags Description
body FeedbackReq Body, Required -
requestOptions RequestOptions \| undefined Optional Pass additional request options.

Response Type

Feedback

Example Usage

const contentType = null;
const body: FeedbackReq = {};
body.rating = 4;
body.suggestion = 'Some screenshots would help';
body.page = 'https://example.com/docs/tutorial/1';
body.userId = 'abc-xyz';

try {
  const { result, ...httpResponse } = await feedbackController.createFeedback(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Request BadRequestError
401 Unauthorized UnauthorizedError
429 Too Many Requests TooManyRequestsError
500 Internal Server Error InternalServerError

Get Feedback

Get feedback.

async getFeedback(
  xAPIKEY: string,
  rating?: number[],
  sentiment?: boolean[],
  reasons?: string[],
  userId?: string[],
  userIP?: string[],
  page?: string[],
  category?: string[],
  apiOperationId?: string[],
  tags?: string[],
  xPAGE?: number,
  xPERPAGE?: number,
  xORDER?: XORDEREnum,
  xORDERBY?: XORDERBYEnum,
  requestOptions?: RequestOptions
): Promise<ApiResponse<FeedbackResponse>>

Parameters

Parameter Type Tags Description
xAPIKEY string Header, Required Private key. Create a tenant to generate.
rating number[] \| undefined Query, Optional Rating to filter by.
Constraints: >= 0
sentiment boolean[] \| undefined Query, Optional Sentiment to filter by.
reasons string[] \| undefined Query, Optional Reasons to filter by.
userId string[] \| undefined Query, Optional User ID to filter by.
userIP string[] \| undefined Query, Optional IP address to filter by.
page string[] \| undefined Query, Optional Page to filter by.
category string[] \| undefined Query, Optional Category to filter by.
apiOperationId string[] \| undefined Query, Optional Operation to filter by.
tags string[] \| undefined Query, Optional Tags to filter by.
xPAGE number \| undefined Header, Optional Page number.
Default: 1
xPERPAGE number \| undefined Header, Optional Items per page.
Default: 50
xORDER XORDEREnum \| undefined Header, Optional Sort order.
Default: XORDEREnum.Desc
xORDERBY XORDERBYEnum \| undefined Header, Optional Order by.
Default: XORDERBYEnum.CreatedAt
requestOptions RequestOptions \| undefined Optional Pass additional request options.

Response Type

FeedbackResponse

Example Usage

const xAPIKEY = 'X-API-KEY2';
const xPAGE = 1;
const xPERPAGE = 10;
const xORDER = 'desc';
const xORDERBY = 'createdAt';
try {
  const { result, ...httpResponse } = await feedbackController.getFeedback(xAPIKEY, None, None, None, None, None, None, None, None, None, xPAGE, xPERPAGE, xORDER, xORDERBY);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Errors

HTTP Status Code Error Description Exception Class
401 Unauthorized UnauthorizedError
429 Too Many Requests TooManyRequestsError
500 Internal Server Error InternalServerError

Get Feedback by Id

Get feedback by id.

async getFeedbackById(
  id: string,
  xAPIKEY: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<Feedback>>

Parameters

Parameter Type Tags Description
id string Template, Required Resource identifier string.
Constraints: Pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$
xAPIKEY string Header, Required Private key. Create a tenant to generate.
requestOptions RequestOptions \| undefined Optional Pass additional request options.

Response Type

Feedback

Example Usage

const id = 'c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd';
const xAPIKEY = 'X-API-KEY2';
try {
  const { result, ...httpResponse } = await feedbackController.getFeedbackById(id, xAPIKEY);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Request BadRequestError
401 Unauthorized UnauthorizedError
404 Not found NotFoundError
429 Too Many Requests TooManyRequestsError
500 Internal Server Error InternalServerError

Update Feedback by Id

Update feedback by id.

async updateFeedbackById(
  id: string,
  body: FeedbackReq,
  requestOptions?: RequestOptions
): Promise<ApiResponse<Feedback>>

Parameters

Parameter Type Tags Description
id string Template, Required Resource identifier string.
Constraints: Pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$
body FeedbackReq Body, Required -
requestOptions RequestOptions \| undefined Optional Pass additional request options.

Response Type

Feedback

Example Usage

const id = 'c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd';
const contentType = null;
const body: FeedbackReq = {};
body.rating = 4;
body.userId = 'abc-xyz';

try {
  const { result, ...httpResponse } = await feedbackController.updateFeedbackById(id, body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Request BadRequestError
401 Unauthorized UnauthorizedError
404 Not found NotFoundError
429 Too Many Requests TooManyRequestsError
500 Internal Server Error InternalServerError