The platform for continuously improving AI agents.
/* tslint:disable */
/* eslint-disable */
/**
* Overbae API
* Backend API for the Overclaw / Overmind platform.
*
* The version of the OpenAPI document: 2.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
PaginatedProjectInviteList,
PaginatedProjectList,
PaginatedProjectMemberList,
PatchedProjectRequest,
Project,
ProjectInvite,
ProjectInviteCreateRequest,
ProjectMember,
ProjectMembershipCreateRequest,
ProjectRequest,
} from '../models/index';
import {
PaginatedProjectInviteListFromJSON,
PaginatedProjectInviteListToJSON,
PaginatedProjectListFromJSON,
PaginatedProjectListToJSON,
PaginatedProjectMemberListFromJSON,
PaginatedProjectMemberListToJSON,
PatchedProjectRequestFromJSON,
PatchedProjectRequestToJSON,
ProjectFromJSON,
ProjectToJSON,
ProjectInviteFromJSON,
ProjectInviteToJSON,
ProjectInviteCreateRequestFromJSON,
ProjectInviteCreateRequestToJSON,
ProjectMemberFromJSON,
ProjectMemberToJSON,
ProjectMembershipCreateRequestFromJSON,
ProjectMembershipCreateRequestToJSON,
ProjectRequestFromJSON,
ProjectRequestToJSON,
} from '../models/index';
export interface ProjectsCreateRequest {
projectRequest: ProjectRequest;
}
export interface ProjectsDestroyRequest {
id: string;
}
export interface ProjectsInvitesCreateRequest {
projectId: string;
projectInviteCreateRequest: ProjectInviteCreateRequest;
}
export interface ProjectsInvitesDestroyRequest {
id: string;
projectId: string;
}
export interface ProjectsInvitesListRequest {
projectId: string;
ordering?: string;
page?: number;
pageSize?: number;
search?: string;
}
export interface ProjectsListRequest {
name?: string;
ordering?: string;
page?: number;
pageSize?: number;
search?: string;
slug?: string;
}
export interface ProjectsMembershipsCreateRequest {
projectId: string;
projectMembershipCreateRequest: ProjectMembershipCreateRequest;
}
export interface ProjectsMembershipsDestroyRequest {
id: string;
projectId: string;
}
export interface ProjectsMembershipsListRequest {
projectId: string;
ordering?: string;
page?: number;
pageSize?: number;
search?: string;
}
export interface ProjectsPartialUpdateRequest {
id: string;
patchedProjectRequest?: PatchedProjectRequest;
}
export interface ProjectsRetrieveRequest {
id: string;
}
export interface ProjectsUpdateRequest {
id: string;
projectRequest: ProjectRequest;
}
/**
*
*/
export class ProjectsApi extends runtime.BaseAPI {
/**
* Create project
*/
async projectsCreateRaw(requestParameters: ProjectsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Project>> {
if (requestParameters['projectRequest'] == null) {
throw new runtime.RequiredError(
'projectRequest',
'Required parameter "projectRequest" was null or undefined when calling projectsCreate().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ProjectRequestToJSON(requestParameters['projectRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue));
}
/**
* Create project
*/
async projectsCreate(requestParameters: ProjectsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Project> {
const response = await this.projectsCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Delete project
*/
async projectsDestroyRaw(requestParameters: ProjectsDestroyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling projectsDestroy().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = await this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Delete project
*/
async projectsDestroy(requestParameters: ProjectsDestroyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.projectsDestroyRaw(requestParameters, initOverrides);
}
/**
* Pending invitations for a single project (nested under ``/api/projects/{project_id}/invites/``).
* Invite an email that has no account
*/
async projectsInvitesCreateRaw(requestParameters: ProjectsInvitesCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProjectInvite>> {
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError(
'projectId',
'Required parameter "projectId" was null or undefined when calling projectsInvitesCreate().'
);
}
if (requestParameters['projectInviteCreateRequest'] == null) {
throw new runtime.RequiredError(
'projectInviteCreateRequest',
'Required parameter "projectInviteCreateRequest" was null or undefined when calling projectsInvitesCreate().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{project_id}/invites/`;
urlPath = urlPath.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId'])));
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ProjectInviteCreateRequestToJSON(requestParameters['projectInviteCreateRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectInviteFromJSON(jsonValue));
}
/**
* Pending invitations for a single project (nested under ``/api/projects/{project_id}/invites/``).
* Invite an email that has no account
*/
async projectsInvitesCreate(requestParameters: ProjectsInvitesCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectInvite> {
const response = await this.projectsInvitesCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Pending invitations for a single project (nested under ``/api/projects/{project_id}/invites/``).
* Revoke a pending invite
*/
async projectsInvitesDestroyRaw(requestParameters: ProjectsInvitesDestroyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling projectsInvitesDestroy().'
);
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError(
'projectId',
'Required parameter "projectId" was null or undefined when calling projectsInvitesDestroy().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{project_id}/invites/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
urlPath = urlPath.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId'])));
const response = await this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Pending invitations for a single project (nested under ``/api/projects/{project_id}/invites/``).
* Revoke a pending invite
*/
async projectsInvitesDestroy(requestParameters: ProjectsInvitesDestroyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.projectsInvitesDestroyRaw(requestParameters, initOverrides);
}
/**
* Pending invitations for a single project (nested under ``/api/projects/{project_id}/invites/``).
* List pending project invites
*/
async projectsInvitesListRaw(requestParameters: ProjectsInvitesListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedProjectInviteList>> {
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError(
'projectId',
'Required parameter "projectId" was null or undefined when calling projectsInvitesList().'
);
}
const queryParameters: any = {};
if (requestParameters['ordering'] != null) {
queryParameters['ordering'] = requestParameters['ordering'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page_size'] = requestParameters['pageSize'];
}
if (requestParameters['search'] != null) {
queryParameters['search'] = requestParameters['search'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{project_id}/invites/`;
urlPath = urlPath.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedProjectInviteListFromJSON(jsonValue));
}
/**
* Pending invitations for a single project (nested under ``/api/projects/{project_id}/invites/``).
* List pending project invites
*/
async projectsInvitesList(requestParameters: ProjectsInvitesListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedProjectInviteList> {
const response = await this.projectsInvitesListRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* List projects
*/
async projectsListRaw(requestParameters: ProjectsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedProjectList>> {
const queryParameters: any = {};
if (requestParameters['name'] != null) {
queryParameters['name'] = requestParameters['name'];
}
if (requestParameters['ordering'] != null) {
queryParameters['ordering'] = requestParameters['ordering'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page_size'] = requestParameters['pageSize'];
}
if (requestParameters['search'] != null) {
queryParameters['search'] = requestParameters['search'];
}
if (requestParameters['slug'] != null) {
queryParameters['slug'] = requestParameters['slug'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedProjectListFromJSON(jsonValue));
}
/**
* List projects
*/
async projectsList(requestParameters: ProjectsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedProjectList> {
const response = await this.projectsListRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Memberships for a single project (nested under ``/api/projects/{project_id}/memberships/``).
* Add a user to the project
*/
async projectsMembershipsCreateRaw(requestParameters: ProjectsMembershipsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProjectMember>> {
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError(
'projectId',
'Required parameter "projectId" was null or undefined when calling projectsMembershipsCreate().'
);
}
if (requestParameters['projectMembershipCreateRequest'] == null) {
throw new runtime.RequiredError(
'projectMembershipCreateRequest',
'Required parameter "projectMembershipCreateRequest" was null or undefined when calling projectsMembershipsCreate().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{project_id}/memberships/`;
urlPath = urlPath.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId'])));
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ProjectMembershipCreateRequestToJSON(requestParameters['projectMembershipCreateRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectMemberFromJSON(jsonValue));
}
/**
* Memberships for a single project (nested under ``/api/projects/{project_id}/memberships/``).
* Add a user to the project
*/
async projectsMembershipsCreate(requestParameters: ProjectsMembershipsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectMember> {
const response = await this.projectsMembershipsCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Memberships for a single project (nested under ``/api/projects/{project_id}/memberships/``).
* Remove a user from the project
*/
async projectsMembershipsDestroyRaw(requestParameters: ProjectsMembershipsDestroyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling projectsMembershipsDestroy().'
);
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError(
'projectId',
'Required parameter "projectId" was null or undefined when calling projectsMembershipsDestroy().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{project_id}/memberships/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
urlPath = urlPath.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId'])));
const response = await this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Memberships for a single project (nested under ``/api/projects/{project_id}/memberships/``).
* Remove a user from the project
*/
async projectsMembershipsDestroy(requestParameters: ProjectsMembershipsDestroyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.projectsMembershipsDestroyRaw(requestParameters, initOverrides);
}
/**
* Memberships for a single project (nested under ``/api/projects/{project_id}/memberships/``).
* List project members
*/
async projectsMembershipsListRaw(requestParameters: ProjectsMembershipsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedProjectMemberList>> {
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError(
'projectId',
'Required parameter "projectId" was null or undefined when calling projectsMembershipsList().'
);
}
const queryParameters: any = {};
if (requestParameters['ordering'] != null) {
queryParameters['ordering'] = requestParameters['ordering'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page_size'] = requestParameters['pageSize'];
}
if (requestParameters['search'] != null) {
queryParameters['search'] = requestParameters['search'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{project_id}/memberships/`;
urlPath = urlPath.replace(`{${"project_id"}}`, encodeURIComponent(String(requestParameters['projectId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedProjectMemberListFromJSON(jsonValue));
}
/**
* Memberships for a single project (nested under ``/api/projects/{project_id}/memberships/``).
* List project members
*/
async projectsMembershipsList(requestParameters: ProjectsMembershipsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedProjectMemberList> {
const response = await this.projectsMembershipsListRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update project
*/
async projectsPartialUpdateRaw(requestParameters: ProjectsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Project>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling projectsPartialUpdate().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = await this.request({
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: PatchedProjectRequestToJSON(requestParameters['patchedProjectRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue));
}
/**
* Update project
*/
async projectsPartialUpdate(requestParameters: ProjectsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Project> {
const response = await this.projectsPartialUpdateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get project
*/
async projectsRetrieveRaw(requestParameters: ProjectsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Project>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling projectsRetrieve().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue));
}
/**
* Get project
*/
async projectsRetrieve(requestParameters: ProjectsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Project> {
const response = await this.projectsRetrieveRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async projectsUpdateRaw(requestParameters: ProjectsUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Project>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling projectsUpdate().'
);
}
if (requestParameters['projectRequest'] == null) {
throw new runtime.RequiredError(
'projectRequest',
'Required parameter "projectRequest" was null or undefined when calling projectsUpdate().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ClerkBearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Api-Key"] = await this.configuration.apiKey("X-Api-Key"); // ApiKeyAuth authentication
}
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("BearerAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/api/projects/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = await this.request({
path: urlPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: ProjectRequestToJSON(requestParameters['projectRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue));
}
/**
*/
async projectsUpdate(requestParameters: ProjectsUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Project> {
const response = await this.projectsUpdateRaw(requestParameters, initOverrides);
return await response.value();
}
}