Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using Newtonsoft.Json;
- // Query start
- namespace Generated
- {
- public interface IQuery
- {
- string GetQueryText();
- object GetParsedObject(string jsonText);
- }
- public interface IQuery<T> : IQuery
- {
- new T GetParsedObject(string jsonText);
- }
- }
- namespace Generated.MyQuery
- {
- /// <summary>Operation Type</sumary>
- public class Query : IQuery<Data>
- {
- private readonly int _id;
- public Query(int id)
- {
- _id = id;
- }
- public string GetQueryText()
- {
- return JsonConvert.SerializeObject(new
- {
- query = @"
- query MyQuery($id: Int = 1) {
- Property(propertyId: $id) {
- id
- name
- Continent {
- id
- name
- }
- Country {
- id
- Languages {
- languageId
- countryName
- }
- }
- Region {
- id
- name
- }
- State {
- id
- Languages {
- languageId
- stateName
- }
- }
- City {
- id
- Languages {
- languageId
- cityName
- }
- }
- Area {
- id
- name
- }
- }
- Languages {
- languageId
- name
- }
- }",
- variables = new {
- id = _id,
- }
- });
- }
- public Data GetParsedObject(string jsonText)
- {
- return JsonConvert.DeserializeObject<Result>(jsonText).Data;
- }
- string IQuery.GetQueryText()
- {
- return GetQueryText();
- }
- Data IQuery<Data>.GetParsedObject(string jsonText)
- {
- return GetParsedObject(jsonText);
- }
- object IQuery.GetParsedObject(string jsonText)
- {
- return GetParsedObject(jsonText);
- }
- }
- public class Result
- {
- [JsonProperty("data")]
- public Data Data { get; set; }
- }
- public class Data
- {
- [JsonProperty("Property")]
- public Property Property { get; set; }
- [JsonProperty("Languages")]
- public List<___Languages> Languages { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class Property
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("name")]
- public string Name { get; set; }
- [JsonProperty("Continent")]
- public Continent Continent { get; set; }
- [JsonProperty("Country")]
- public Country Country { get; set; }
- [JsonProperty("Region")]
- public Region Region { get; set; }
- [JsonProperty("State")]
- public State State { get; set; }
- [JsonProperty("City")]
- public City City { get; set; }
- [JsonProperty("Area")]
- public Area Area { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class Continent
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("name")]
- public string Name { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class Country
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("Languages")]
- public List<Languages> Languages { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class Languages
- {
- [JsonProperty("languageId")]
- public int LanguageId { get; set; }
- [JsonProperty("countryName")]
- public string CountryName { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class Region
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("name")]
- public string Name { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class State
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("Languages")]
- public List<_Languages> Languages { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class _Languages
- {
- [JsonProperty("languageId")]
- public int LanguageId { get; set; }
- [JsonProperty("stateName")]
- public string StateName { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class City
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("Languages")]
- public List<__Languages> Languages { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class __Languages
- {
- [JsonProperty("languageId")]
- public int LanguageId { get; set; }
- [JsonProperty("cityName")]
- public string CityName { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class Area
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("name")]
- public string Name { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class ___Languages
- {
- [JsonProperty("languageId")]
- public int LanguageId { get; set; }
- [JsonProperty("name")]
- public string Name { get; set; }
- }
- }
- namespace Generated.UpdateStuff
- {
- /// <summary>Operation Type</sumary>
- public class Mutation : IQuery<Data>
- {
- private readonly int _id;
- public Mutation(int id)
- {
- _id = id;
- }
- public string GetQueryText()
- {
- return JsonConvert.SerializeObject(new
- {
- query = @"
- mutation UpdateStuff($id: Int = 1) {
- ContractPropertyUpdateMutation(id: $id, userId: ""9d31af8d-a752-4a63-996a-019deb6cf269"", ipAddress: ""1.1.1.1"", userAgent: ""Some"") {
- id
- contractId
- hotelId
- }
- }",
- variables = new {
- id = _id,
- }
- });
- }
- public Data GetParsedObject(string jsonText)
- {
- return JsonConvert.DeserializeObject<Result>(jsonText).Data;
- }
- string IQuery.GetQueryText()
- {
- return GetQueryText();
- }
- Data IQuery<Data>.GetParsedObject(string jsonText)
- {
- return GetParsedObject(jsonText);
- }
- object IQuery.GetParsedObject(string jsonText)
- {
- return GetParsedObject(jsonText);
- }
- }
- public class Result
- {
- [JsonProperty("data")]
- public Data Data { get; set; }
- }
- public class Data
- {
- [JsonProperty("ContractPropertyUpdateMutation")]
- public ContractPropertyUpdateMutation ContractPropertyUpdateMutation { get; set; }
- }
- /// <summary>Inner Model</sumary>
- public class ContractPropertyUpdateMutation
- {
- [JsonProperty("id")]
- public int Id { get; set; }
- [JsonProperty("contractId")]
- public int ContractId { get; set; }
- [JsonProperty("hotelId")]
- public int HotelId { get; set; }
- }
- }
- // Query end
Add Comment
Please, Sign In to add comment