Example #1
0
        public static void Main(string[] args)
        {
            // Initialize API
            ResflyApi resflyApi = new ResflyApi("https://api.resfly.com", "API-KEY");

            // Create a company
            Company company = new Company(resflyApi);
            company.Name = "ACME, Inc.";
            company.Type = "internal";
            company.JobSlots = 5;
            company.Url = "http://www.acmeinc.com";

            company.Save();

            Console.WriteLine(company.Id);
            Console.WriteLine(company.DateCreated.ToString());

            // Update company
            company.Name = "ACME International, Inc.";
            company.Save();

            Console.WriteLine(company.Name);

            // Create a job
            Job job = new Job(resflyApi);
            job.CompanyId = company.Id;
            job.Title = "Marketing Specialist";
            job.City = "Minneapolis";
            job.State = "MN";
            job.Category = "marketing_public_relations";
            job.Description = "This is the description for the job.";
            job.Type = "full_time";
            job.Salary.Amount = 50000;
            job.Salary.Type = "yearly";

            job.Save();

            Console.WriteLine(job.Id);
            Console.WriteLine(job.DateCreated.ToString());

            // Publish the job
            job.Publish();

            // Get all jobs for the company
            List<Job> companyJobs = company.GetJobs();

            foreach (Job companyJob in companyJobs)
            {
                Console.WriteLine(companyJob.Title);
            }

            // Get all candidates for the job
            List<Candidate> candidates = job.GetCandidates();

            foreach (Candidate candidate in candidates)
            {
                Console.WriteLine(candidate.FirstName + " " + candidate.LastName);
            }

            // Close the job
            job.Close();

            // Delete the job
            job.Delete();

            // Suspend the company and close all published jobs
            company.Suspend();

            // Error checking
            Company badCompany = new Company(resflyApi);

            try
            {
                badCompany.Save();
            }
            catch (WebException ex)
            {
                foreach (string errorMessage in resflyApi.Errors)
                {
                    Console.WriteLine(errorMessage);
                }
            }
        }
Example #2
0
 public Company(ResflyApi resflyApi)
 {
     this.ResflyApi = resflyApi;
 }
Example #3
0
 public Job(ResflyApi resflyApi)
 {
     this.ResflyApi = resflyApi;
     this.Salary = new Salary();
 }