ynab
Version:
Official JavaScript client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.85.0
161 lines (160 loc) • 7.75 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* YNAB API Endpoints
* Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
*
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.PayeeLocationsApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
*
*/
class PayeeLocationsApi extends runtime.BaseAPI {
/**
* Returns a single payee location
* Get a payee location
*/
async getPayeeLocationByIdRaw(requestParameters, initOverrides) {
if (requestParameters.planId === null || requestParameters.planId === undefined) {
throw new runtime.RequiredError('planId', 'Required parameter requestParameters.planId was null or undefined when calling getPayeeLocationById.');
}
if (requestParameters.payeeLocationId === null || requestParameters.payeeLocationId === undefined) {
throw new runtime.RequiredError('payeeLocationId', 'Required parameter requestParameters.payeeLocationId was null or undefined when calling getPayeeLocationById.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Accept'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/plans/{plan_id}/payee_locations/{payee_location_id}`.replace(`{${"plan_id"}}`, encodeURIComponent(String(requestParameters.planId))).replace(`{${"payee_location_id"}}`, encodeURIComponent(String(requestParameters.payeeLocationId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PayeeLocationResponseFromJSON)(jsonValue));
}
/**
* Returns a single payee location
* Get a payee location
*/
async getPayeeLocationById(planId, payeeLocationId, initOverrides) {
const response = await this.getPayeeLocationByIdRaw({ planId: planId, payeeLocationId: payeeLocationId }, initOverrides);
return await response.value();
}
/**
* Returns all payee locations
* Get all payee locations
*/
async getPayeeLocationsRaw(requestParameters, initOverrides) {
if (requestParameters.planId === null || requestParameters.planId === undefined) {
throw new runtime.RequiredError('planId', 'Required parameter requestParameters.planId was null or undefined when calling getPayeeLocations.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Accept'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/plans/{plan_id}/payee_locations`.replace(`{${"plan_id"}}`, encodeURIComponent(String(requestParameters.planId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PayeeLocationsResponseFromJSON)(jsonValue));
}
/**
* Returns all payee locations
* Get all payee locations
*/
async getPayeeLocations(planId, initOverrides) {
const response = await this.getPayeeLocationsRaw({ planId: planId }, initOverrides);
return await response.value();
}
/**
* Returns all payee locations for a specified payee
* Get all locations for a payee
*/
async getPayeeLocationsByPayeeRaw(requestParameters, initOverrides) {
if (requestParameters.planId === null || requestParameters.planId === undefined) {
throw new runtime.RequiredError('planId', 'Required parameter requestParameters.planId was null or undefined when calling getPayeeLocationsByPayee.');
}
if (requestParameters.payeeId === null || requestParameters.payeeId === undefined) {
throw new runtime.RequiredError('payeeId', 'Required parameter requestParameters.payeeId was null or undefined when calling getPayeeLocationsByPayee.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Accept'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/plans/{plan_id}/payees/{payee_id}/payee_locations`.replace(`{${"plan_id"}}`, encodeURIComponent(String(requestParameters.planId))).replace(`{${"payee_id"}}`, encodeURIComponent(String(requestParameters.payeeId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PayeeLocationsResponseFromJSON)(jsonValue));
}
/**
* Returns all payee locations for a specified payee
* Get all locations for a payee
*/
async getPayeeLocationsByPayee(planId, payeeId, initOverrides) {
const response = await this.getPayeeLocationsByPayeeRaw({ planId: planId, payeeId: payeeId }, initOverrides);
return await response.value();
}
}
exports.PayeeLocationsApi = PayeeLocationsApi;