-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from badsyntax/api-usage
Use api for contact page
- Loading branch information
Showing
14 changed files
with
453 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* DOCUMENTATION | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* 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 { | ||
Contactpage, | ||
ContactpageFromJSON, | ||
ContactpageToJSON, | ||
NewContactpage, | ||
NewContactpageFromJSON, | ||
NewContactpageToJSON, | ||
} from '../models'; | ||
|
||
export interface ContactpageGetRequest { | ||
limit?: number; | ||
sort?: string; | ||
start?: number; | ||
ne?: string; | ||
lt?: string; | ||
lte?: string; | ||
gt?: string; | ||
gte?: string; | ||
contains?: string; | ||
containss?: string; | ||
_in?: Array<string>; | ||
nin?: Array<string>; | ||
} | ||
|
||
export interface ContactpagePutRequest { | ||
newContactpage: NewContactpage; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class ContactpageApi extends runtime.BaseAPI { | ||
|
||
/** | ||
* Delete a single contactpage record | ||
*/ | ||
async contactpageDeleteRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<number>> { | ||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
if (this.configuration && this.configuration.accessToken) { | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("bearerAuth", []); | ||
|
||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
const response = await this.request({ | ||
path: `/contactpage`, | ||
method: 'DELETE', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.TextApiResponse(response) as any; | ||
} | ||
|
||
/** | ||
* Delete a single contactpage record | ||
*/ | ||
async contactpageDelete(initOverrides?: RequestInit): Promise<number> { | ||
const response = await this.contactpageDeleteRaw(initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
* Find all the contactpage\'s records | ||
*/ | ||
async contactpageGetRaw(requestParameters: ContactpageGetRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Contactpage>> { | ||
const queryParameters: any = {}; | ||
|
||
if (requestParameters.limit !== undefined) { | ||
queryParameters['_limit'] = requestParameters.limit; | ||
} | ||
|
||
if (requestParameters.sort !== undefined) { | ||
queryParameters['_sort'] = requestParameters.sort; | ||
} | ||
|
||
if (requestParameters.start !== undefined) { | ||
queryParameters['_start'] = requestParameters.start; | ||
} | ||
|
||
if (requestParameters.ne !== undefined) { | ||
queryParameters['_ne'] = requestParameters.ne; | ||
} | ||
|
||
if (requestParameters.lt !== undefined) { | ||
queryParameters['_lt'] = requestParameters.lt; | ||
} | ||
|
||
if (requestParameters.lte !== undefined) { | ||
queryParameters['_lte'] = requestParameters.lte; | ||
} | ||
|
||
if (requestParameters.gt !== undefined) { | ||
queryParameters['_gt'] = requestParameters.gt; | ||
} | ||
|
||
if (requestParameters.gte !== undefined) { | ||
queryParameters['_gte'] = requestParameters.gte; | ||
} | ||
|
||
if (requestParameters.contains !== undefined) { | ||
queryParameters['_contains'] = requestParameters.contains; | ||
} | ||
|
||
if (requestParameters.containss !== undefined) { | ||
queryParameters['_containss'] = requestParameters.containss; | ||
} | ||
|
||
if (requestParameters._in) { | ||
queryParameters['_in'] = requestParameters._in; | ||
} | ||
|
||
if (requestParameters.nin) { | ||
queryParameters['_nin'] = requestParameters.nin; | ||
} | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
if (this.configuration && this.configuration.accessToken) { | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("bearerAuth", []); | ||
|
||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
const response = await this.request({ | ||
path: `/contactpage`, | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => ContactpageFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Find all the contactpage\'s records | ||
*/ | ||
async contactpageGet(requestParameters: ContactpageGetRequest, initOverrides?: RequestInit): Promise<Contactpage> { | ||
const response = await this.contactpageGetRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
* Update a single contactpage record | ||
*/ | ||
async contactpagePutRaw(requestParameters: ContactpagePutRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Contactpage>> { | ||
if (requestParameters.newContactpage === null || requestParameters.newContactpage === undefined) { | ||
throw new runtime.RequiredError('newContactpage','Required parameter requestParameters.newContactpage was null or undefined when calling contactpagePut.'); | ||
} | ||
|
||
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("bearerAuth", []); | ||
|
||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
const response = await this.request({ | ||
path: `/contactpage`, | ||
method: 'PUT', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
body: NewContactpageToJSON(requestParameters.newContactpage), | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => ContactpageFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Update a single contactpage record | ||
*/ | ||
async contactpagePut(requestParameters: ContactpagePutRequest, initOverrides?: RequestInit): Promise<Contactpage> { | ||
const response = await this.contactpagePutRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* DOCUMENTATION | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
import { exists, mapValues } from '../runtime'; | ||
import { | ||
AboutpageSeo, | ||
AboutpageSeoFromJSON, | ||
AboutpageSeoFromJSONTyped, | ||
AboutpageSeoToJSON, | ||
} from './'; | ||
|
||
/** | ||
* | ||
* @export | ||
* @interface Contactpage | ||
*/ | ||
export interface Contactpage { | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof Contactpage | ||
*/ | ||
id: string; | ||
/** | ||
* | ||
* @type {AboutpageSeo} | ||
* @memberof Contactpage | ||
*/ | ||
seo?: AboutpageSeo; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof Contactpage | ||
*/ | ||
body?: string; | ||
/** | ||
* | ||
* @type {Date} | ||
* @memberof Contactpage | ||
*/ | ||
publishedAt?: Date; | ||
} | ||
|
||
export function ContactpageFromJSON(json: any): Contactpage { | ||
return ContactpageFromJSONTyped(json, false); | ||
} | ||
|
||
export function ContactpageFromJSONTyped(json: any, ignoreDiscriminator: boolean): Contactpage { | ||
if ((json === undefined) || (json === null)) { | ||
return json; | ||
} | ||
return { | ||
|
||
'id': json['id'], | ||
'seo': !exists(json, 'seo') ? undefined : AboutpageSeoFromJSON(json['seo']), | ||
'body': !exists(json, 'body') ? undefined : json['body'], | ||
'publishedAt': !exists(json, 'published_at') ? undefined : (new Date(json['published_at'])), | ||
}; | ||
} | ||
|
||
export function ContactpageToJSON(value?: Contactpage | null): any { | ||
if (value === undefined) { | ||
return undefined; | ||
} | ||
if (value === null) { | ||
return null; | ||
} | ||
return { | ||
|
||
'id': value.id, | ||
'seo': AboutpageSeoToJSON(value.seo), | ||
'body': value.body, | ||
'published_at': value.publishedAt === undefined ? undefined : (value.publishedAt.toISOString()), | ||
}; | ||
} | ||
|
||
|
Oops, something went wrong.